Latest posts by Bryan (see all)
- Smart Watches are a Brilliant Productivity Tool, Not Just for Nerds - October 26, 2014
- Why Your Demo Site Sucks, and What to Do About It - July 4, 2014
- Experiments in Conversion Rate Optimization - January 14, 2014
WordPress is an extremely flexible CMS platform with hundreds of useful plugins available from various different developers – many for free. If you want to do something with WordPress that’s not a built-in feature, chances are, there’s someone out there that has published a plugin to do that. There are plugins for Search Engine Optimization, track SEO performance, embed video, Social Media integration, implement AJAX and JQuery functionality… the list goes on and on.
Sometimes a problem arises when you have multiple plugins that don’t jive with one another- either conflict or they simply aren’t aware of changes made by another plugin. One example is the Google XML Sitemaps Generator plugin
As the name suggests, this plugin generates an XML-Sitemap supported by all the major search engines. It works by querying the wp_posts table and outputs the full URL of each page or post, formatting it appropriately in xml. (There’s also a built-in xslt so it’s easily readable if you navigate to it using a web browser). There are options regarding search engine notification, the content of the sitemap (homepage, posts, categories, tag pages, etc).
One thing this plugin fails to take into account, however, is that there are some plugins that create new post types, such as the Q&A plugin which lets you create a separate quasi-post for each question, and then display the Q&A categories on a single page, allowing the use of j-query animations to navigate through them. There’s also wp-property, and a few others. You might not want some of these post types showing up in your sitemap, but it would be nice to have that option. One plugin that is aware of other post types is the SEO Ultimate , which provides several tools for search engine optimization for your WordPress site.
In the particular case of the Google XML Sitemaps plugin, there is a fairly simple solution involving a minor adjustment to the plugin. This doesn’t give the user the ability to turn other post types on and off independently, and if there was ever an update to this plugin, you’d have to repeat this process, but at least it works:
- Determine what the post type is that you want in your sitemap,
- create a post using the appropriate plugin – in this case, it’s the Q&A plugin – give it a unique title.
- Get into phpmyadmin and browse the wp_posts table looking for this post.
- Once you’ve found it, check out the post_type field on that record. In this case it’s ‘qa_faqs’
- Edit the plugin
- Go to plugins>editor, and select the google xml sitemaps plugin
- Search each file to find a reference to post_type
- For this particular plugin, that is found in the sitemap-core.php
- In my case, I replaced all instances of post_type = ‘post’ to post_type in(‘post’, ‘qa_faqs’)