patches Archives | Lee Willis https://www.leewillis.co.uk/tag/patches/ Tue, 01 Mar 2011 22:54:20 +0000 en-US hourly 1 https://wordpress.org/?v=6.6.1 Adding custom post type archives to your sitemap https://www.leewillis.co.uk/adding-custom-post-type-archives-to-your-sitemap/ https://www.leewillis.co.uk/adding-custom-post-type-archives-to-your-sitemap/#respond Tue, 01 Mar 2011 22:54:20 +0000 http://www.leewillis.co.uk/?p=362 The snippet below is a modification to Yoast’s excellent WordPress SEO plugin to include custom post type archives to the XML sitemaps it produces. Hope you find it useful. $post_type_archive_link = get_post_type_archive_link($post_type); if ($post_type_archive_link) { $url = array(); $url['loc'] = … Continue reading

The post Adding custom post type archives to your sitemap appeared first on Lee Willis.

]]>
The snippet below is a modification to Yoast’s excellent WordPress SEO plugin to include custom post type archives to the XML sitemaps it produces. Hope you find it useful.

            $post_type_archive_link = get_post_type_archive_link($post_type);
            if ($post_type_archive_link) {
                $url = array();
                $url['loc'] = $post_type_archive_link;
                $url['pri'] = 0.8;
                $url['chf'] = 'weekly';
                $this->write_sitemap_loc( $f, $url, $echo );
            }

Just add this snippet inside wp-content/plugins/wordpress-seo/sitemaps/xml-sitemap-class.php inside the function generate_sitemap. The code should go just inside the loop through the custom post types, e.g. after this chunk:

           if ( isset($options['post_types-'.$post_type.'-not_in_sitemap']) && $options['post_types-'.$post_type.'-not_in_sitemap'] )
                continue;
            if ( in_array( $post_type, array('revision','nav_menu_item','attachment') ) )
                continue;

Once you’ve added the code – just rebuild your Sitemap by visiting Seo » Dashboard » (Re)build XML Sitemap.

The post Adding custom post type archives to your sitemap appeared first on Lee Willis.

]]>
https://www.leewillis.co.uk/adding-custom-post-type-archives-to-your-sitemap/feed/ 0
Adding Virtuemart Product Images to your Sitemap https://www.leewillis.co.uk/virtuemart-product-images-sitemap/ https://www.leewillis.co.uk/virtuemart-product-images-sitemap/#comments Wed, 28 Apr 2010 20:58:28 +0000 http://www.leewillis.co.uk/?p=266 I wrote in a recent post about how to add post images into your sitemap based on WordPress post images. However I look after a couple of sites, and they’re not all WordPress. So I set off on a quest … Continue reading

The post Adding Virtuemart Product Images to your Sitemap appeared first on Lee Willis.

]]>
I wrote in a recent post about how to add post images into your sitemap based on WordPress post images. However I look after a couple of sites, and they’re not all WordPress. So I set off on a quest to add images to sitemaps on my Joomla! sites.

The good news is that my sitemap plugin of choice, Xmap, had recently added basic image support to their XML sitemaps. However, while Xmap can generate sitemaps for a wide variety of Joomla! components – the only one to have image support currently is the standard com_content extension. One of my main Joomla! sites though is a store based on Virtuemart, and I wanted to add product images to the sitemap.

The result is a revised version of the com_virtuemart extension for Xmap, and a small change to the Xmap XML output code.

To get things up and running there’s five simple steps:

  1. Make sure you’re running version 1.2.7 of Xmap
  2. Take backups of all of these files from your existing Joomla! installation:
    • components/com_xmap/xmap.xml.php
    • administrator/components/com_xmap/extensions/com_virtuemart.xml
    • administrator/components/com_xmap/extensions/com_virtuemart.php
  3. Download com_virtuemart.xml and com_virtuemart.php from here, and save them into administrator/components/com_xmap/extensions/
  4. Download xmap.xml.php from the same place, and save it into components/com_xmap/
  5. Configure the com_virtuemart extension under com_xmap settings in your Joomla! administrator area. Make sure you’ve got images turned on, and a license URL specified if you want one.

That’s it – your sitemap should now include images for all of your products.

PS. The default Joomla! robots.txt bans Googlebot from crawling the Virtuemart image folders, you can allow them, by adding:

Allow: /components/com_virtuemart/shop_image/product/

to the bottom of your robots.txt …

The post Adding Virtuemart Product Images to your Sitemap appeared first on Lee Willis.

]]>
https://www.leewillis.co.uk/virtuemart-product-images-sitemap/feed/ 11
Adding Post Thumbnails To Your Sitemap https://www.leewillis.co.uk/adding-post-thumbnails-to-sitemap/ https://www.leewillis.co.uk/adding-post-thumbnails-to-sitemap/#comments Sat, 17 Apr 2010 07:47:32 +0000 http://www.leewillis.co.uk/?p=243 Google recently blogged about Adding Images to your Sitemaps. When I read this my thoughts jumped straight to a friend’s site that is image-orientated, and could really benefit from this. His site uses WordPress’ post thumbnails to store an image … Continue reading

The post Adding Post Thumbnails To Your Sitemap appeared first on Lee Willis.

]]>
Google recently blogged about Adding Images to your Sitemaps. When I read this my thoughts jumped straight to a friend’s site that is image-orientated, and could really benefit from this. His site uses WordPress’ post thumbnails to store an image against each post, and I wanted to get those images into his sitemap.

His site already uses the great Google XML Sitemaps plugin to auto-generate an XML sitemap, so I thought I’d have a go at extending it to support post thumbnails.

The resulting XML looks a little like this:

<url>
  <loc>http://test.leewillis.co.uk/hello-world/</loc>
  <image:image>
    <image:loc>http://test.leewillis.co.uk/wp-content/uploads/test.jpg</image:loc>
    <image:title>Hello world!</image:title>
    <image:license>http://test.leewillis.co.uk/license/</image:license>
  </image:image>
  <lastmod>2010-04-14T21:15:15+00:00</lastmod>
  <changefreq>monthly</changefreq>
  <priority>1.0</priority>
</url>

Some notes on the above. The image title is set the same as the post’s title – which I figure should be a reasonable result, from a user and SEO point of view. The license URL is configurable (One per site).

I’ve submitted the code to the plugin author to hopefully get included, but if you can’t wait, there’s a patch file available here – just apply it with the “patch” utility.

The post Adding Post Thumbnails To Your Sitemap appeared first on Lee Willis.

]]>
https://www.leewillis.co.uk/adding-post-thumbnails-to-sitemap/feed/ 20
Custom Taxonomies In WordPress Plugins https://www.leewillis.co.uk/custom-taxonomies-wordpress-plugins/ https://www.leewillis.co.uk/custom-taxonomies-wordpress-plugins/#comments Fri, 07 Aug 2009 09:00:29 +0000 http://www.leewillis.co.uk/?p=113 Taxonomy Support I wrote recently about building a brand directory using a fantastic feature of WordPress called “Taxonomies”. Now that that feature is live I’ve realised that a number of my favourite WordPress plugins simply don’t support taxonomies. Among the … Continue reading

The post Custom Taxonomies In WordPress Plugins appeared first on Lee Willis.

]]>
Taxonomy Support

I wrote recently about building a brand directory using a fantastic feature of WordPress called “Taxonomies”. Now that that feature is live I’ve realised that a number of my favourite WordPress plugins simply don’t support taxonomies.

Among the casualities were Google XML Sitemaps, and the otherwise excellent Headspace2.

Now, the beauty of open source is that when you get an itch like this, you can go and scratch it. So, I whipped out my coding gloves and set to work.

The results are below:

Google XML Sitemaps

The patch below will ensure that the pages for all of your taxonomy terms are listed in your sitemap – helping Google find the pages quicker.

http://www.leewillis.co.uk/patches/google-sitemap-generator/include_taxonomies.txt

HeadSpace2

The patch below lets you add %%term_description%% so you can populate your META tags properly on your term pages – great for us and our product directory.

http://www.leewillis.co.uk/patches/taxonomy_support_for_headspace/patch_v2.diff

Both of these have been submitted to the plugin authors – so hopefully they’ll get included by default in a future release. If you find them useful – please add to the threads here:

Google XML Sitemaps

Headspace2

The post Custom Taxonomies In WordPress Plugins appeared first on Lee Willis.

]]>
https://www.leewillis.co.uk/custom-taxonomies-wordpress-plugins/feed/ 9
Tracking Twitter Traffic https://www.leewillis.co.uk/tracking-twitter-traffic/ https://www.leewillis.co.uk/tracking-twitter-traffic/#comments Fri, 24 Apr 2009 22:45:55 +0000 http://www.leewillis.co.uk/?p=16 Twitter is a revolution So, Twitter is a revolution (Apparently). The important thing about Twitter isn’t that you can find out what Stephen Fry had for lunch, or when Oprah is having her makeup done. No, the important thing, for … Continue reading

The post Tracking Twitter Traffic appeared first on Lee Willis.

]]>
Twitter is a revolution

So, Twitter is a revolution (Apparently). The important thing about Twitter isn’t that you can find out what Stephen Fry had for lunch, or when Oprah is having her makeup done. No, the important thing, for people trying to use Twitter as a a weapon in their digital marketing arsenal, is that Twitter traffic is 10x higher through their API, than through their website.

What is Twitter doing for you?

So what does that mean for Average Joe Ltd. trying to engage with his customers in a brave new digital world?

Simple – links that you post are likely to get read on a mobile phone, or in any one of hundreds of different desktop clients . There’s every chance that if someone clicks through to your site you will have no idea that they came from a Twitter link (Desktop clients particularly tend not to send the all-important HTTP-Referrer information).

So – what’s to be done?

For SnugBaby, as well as twittering as a normal user, we use the excellent WordPress “Twitter Tools” plugin to tweet when we update our blog. So – how to track how much traffic we were generating from these links? Fortunately there’s a fairly straightforward solution to the problem. We analyse our traffic using Google Analytics, which provides the ability to “tag” links with extra information. This is commonly used to track inbound links relating to specific marketing, or email campaigns – but we use it to track Twitter as a campaign all of it’s own. This is nothing new.

However – our blog-related links are tweeted automatically – so we needed to make some changes to the Twitter Tools plugin to add on the tracking codes.

The Solution

For those that are interested I’ll step through the changes below – but if you want a quick twitter tracking fix, then you can download a patch (Against version 1.6 of twitter tools), or a complete copy of the twitter-tools.php file.

Step 1. Flexibility is king

We want to make our solution a little bit flexible, so we set up the tagging as a setting which can be controlled through the WordPress admin pages. We called it extra_query_args:

Line 120-146:
	$this->options = array(
			'twitter_username'
			, 'twitter_password'
			, 'create_blog_posts'
			, 'create_digest'
			, 'create_digest_weekly'
			, 'digest_daily_time'
			, 'digest_weekly_time'
			, 'digest_weekly_day'
			, 'digest_title'
			, 'digest_title_weekly'
			, 'blog_post_author'
			, 'blog_post_category'
			, 'blog_post_tags'
			, 'notify_twitter'
			, 'sidebar_tweet_count'
			, 'tweet_from_sidebar'
			, 'give_tt_credit'
			, 'exclude_reply_tweets'
			, 'last_tweet_download'
			, 'doing_tweet_download'
			, 'doing_digest_post'
			, 'install_date'
			, 'js_lib'
			, 'digest_tweet_order'
			, 'notify_twitter_default'
			, 'extra_query_args'
		);

We also provide a sensible default for people installing the first time:

Line 178:
$this->extra_query_args = '?utm_source=twitter&
utm_medium=twitter&utm_campaign=twitter';

The final step is to build the form that will let users change the value of the new parameter:

Line 1580:

<div class="option">
  <label for="aktt_extra_query_args">'.__('Text to tag on
the end of URLs in generated tweets', 'twitter-tools').
'</label>
  <input type="text" size="30" name="aktt_extra_query_args"
id="aktt_extra_query_args" value="'.$aktt->extra_query_args
.'" />
  <span>'.__('Include the leading ? before query args',
'twitter-tools').'</span>
</div>

Step 2. The magic bit

The final change simply adds the contents of your parameter onto the end of the post URL before passing it off to the URL shortener.

Line 466:

$url = $url . $this->extra_query_args;

Job Done

And that’s that. Twitter tools will now post URLs that include tracking information – all you have to do know is keep an eye out for them in Google Analytics!

The post Tracking Twitter Traffic appeared first on Lee Willis.

]]>
https://www.leewillis.co.uk/tracking-twitter-traffic/feed/ 2