<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Tortoise IT &#187; Time Savers</title>
	<atom:link href="http://www.sean-barton.co.uk/category/time-savers/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sean-barton.co.uk</link>
	<description>by Sean Barton, a freelance PHP website developer in Crewe, Cheshire</description>
	<lastBuildDate>Tue, 31 Jan 2012 17:34:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Turn off theme CSS for the visual editor in WordPress 3.3+</title>
		<link>http://www.sean-barton.co.uk/2012/01/wordpress-visual-editor-css-deactivate/</link>
		<comments>http://www.sean-barton.co.uk/2012/01/wordpress-visual-editor-css-deactivate/#comments</comments>
		<pubDate>Thu, 05 Jan 2012 10:59:32 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[Bug Fixes]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[Themes]]></category>
		<category><![CDATA[Time Savers]]></category>
		<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.sean-barton.co.uk/?p=701</guid>
		<description><![CDATA[It&#8217;s been on the cards for months and WordPress has finally added the inbuilt function whereby CSS files declared on the front end are now also declared on the edit item (post/page/custom post type) pages within the admin system. This is wonderful for some but, as someone who looks at a fair few sites using a range of free, premium and bespoke themes, actually it&#8217;s a curse in disguise. Let me explain&#8230; Let&#8217;s say you go to the WordPress theme repository and grab a nice free theme which has been written by a developer less than &#8216;au fait&#8217; with WordPress &#8230; <a class="continue_reading" href="http://www.sean-barton.co.uk/2012/01/wordpress-visual-editor-css-deactivate/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been on the cards for months and WordPress has finally added the inbuilt function whereby CSS files declared on the front end are now also declared on the edit item (post/page/custom post type) pages within the admin system. This is wonderful for some but, as someone who looks at a fair few sites using a range of free, premium and bespoke themes, actually it&#8217;s a curse in disguise. Let me explain&#8230;</p>
<p>Let&#8217;s say you go to the WordPress theme repository and grab a nice free theme which has been written by a developer less than &#8216;au fait&#8217; with WordPress functionality or best practice. You turn on the theme, all looks good and then go to write a post only to be presented with the page from hell because loose CSS rules used in style.css have broken the editor page look and feel all together. As there is no way in CSS to set a priority without rewriting the code itself you are left with a mess.</p>
<p>Pre WordPress 3.3 this wasn&#8217;t an issue as you needed to explicitly declare an editor style sheet in order to use the styles and make it look somewhat closer to that which you might find on the front end of the site.</p>
<p>Now.. turning it off! Well it will require some coding and in actual fact the simplest way to do anything about it is to make your stylesheet invisible to WordPress. Let me explain: The correct way to enqueue any CSS and JS on your site is to do something like the following:</p>
<pre>add_action('wp_print_styles', 'theme_add_stylesheet');
function theme_add_stylesheet() {
    wp_register_style('theme_stylesheet', get_stylesheet_directory_uri() . '/style.css');
    wp_enqueue_style( 'theme_stylesheet');
}</pre>
<p>This means that when the <em>wp_head</em> action is triggered from header.php in your theme the style will be printed to screen along with the other styles and scripts. The enqueue style function adds the name and location of the script to a global array which can be reused at any time. In short, WordPress knows that it is a CSS file declared by a plugin or theme and therefore can reuse it at will.</p>
<p>The fix is simple.. don&#8217;t use that method and, instead, use the original crude method of adding a stylesheet which is to write the HTML yourself as follows:</p>
<pre>&lt;link rel="stylesheet" href="&lt;?php bloginfo('stylesheet_url'); ?&gt;" type="text/css" media="screen" /&gt;</pre>
<p>This code, when placed in header.php of your theme, simply outputs the line in the head section of your page and includes the stylesheet unbeknown to WordPress and therefore won&#8217;t be used in the editor.</p>
<p>99% of the themes I have seen and used use the latter method so it&#8217;s not an issue but hopefully this will hel someone who has just upgraded and has some sort of multicoloured and wierdly laid out admin post page.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sean-barton.co.uk/2012/01/wordpress-visual-editor-css-deactivate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress plugin queue jumping made easy</title>
		<link>http://www.sean-barton.co.uk/2012/01/wordpress-plugin-queue-jumping-easy/</link>
		<comments>http://www.sean-barton.co.uk/2012/01/wordpress-plugin-queue-jumping-easy/#comments</comments>
		<pubDate>Sun, 01 Jan 2012 21:58:31 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[Bug Fixes]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[Time Savers]]></category>
		<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.sean-barton.co.uk/?p=692</guid>
		<description><![CDATA[Hi all. Happy new year etc.. I have plenty of plans for the next 12 months but won&#8217;t go into them unlike every other person with a blog is undoubtedly doing at the moment. I want to keep this strictly useful information and me telling you I want to shift some weight, buy something or do something isn&#8217;t going to improve your lives any really is it. So here goes.. I have had an interesting problem for some months now which I have just solved albeit crudely! I have written several plugins and released them into the WordPress plugin repository &#8230; <a class="continue_reading" href="http://www.sean-barton.co.uk/2012/01/wordpress-plugin-queue-jumping-easy/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><img class="alignright  wp-image-696" title="LEAPFROG" src="http://www.sean-barton.co.uk/wp-content/uploads/2012/01/LEAPFROG-300x279.jpg" alt="" width="210" height="195" />Hi all. Happy new year etc.. I have plenty of plans for the next 12 months but won&#8217;t go into them unlike every other person with a blog is undoubtedly doing at the moment. I want to keep this strictly useful information and me telling you I want to shift some weight, buy something or do something isn&#8217;t going to improve your lives any really is it. So here goes..</p>
<p>I have had an interesting problem for some months now which I have just solved albeit crudely! I have written several plugins and released them into the WordPress plugin repository as regular readers of this site might already know. What you are unlikely to know though is that in doing so all you get is an influx of support questions. I personally like these.. it gives me the illusion of helping people out whilst really knowing that it should have been right to begin with <img src='http://www.sean-barton.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>The worst of these aforementioned support questions are to do with plugin conflicts. Cue potential threads and threads about how the &#8216;other guy&#8217; did something wrong which is going to need to poor user to go to their site/forum to get it sorted before our plugins can work in harmony as they were originally intended. This isn&#8217;t the best answer to a support question and certainly won&#8217;t get you any repeat custom. In all likelihood the user will ditch the plugin he finds least useful (yours.. after all he came to you to sort it in the first place meaning yours is likely the plugin they have just installed and are playing with) and install one of the other counterparts which undoubtedly does the same job but with umpteen donate buttons plastered all over it (I won&#8217;t go into that one right now but see <a href="http://www.sean-barton.co.uk/2011/12/donation-buttons-promotion-plugins-themes/">my previous post</a> for my thoughts on that particular subject).</p>
<p>One such example of a conflict I have been getting all year. It&#8217;s to do with my Welcome Email Editor plugin. WordPress does a fair few things very well indeed but sadly there are a few where it really could improve. This is why my Welcome Email Editor plugin exists at all. Can you guess what it does? Really? Ok so it lets you edit the WordPress welcome email.. the one that gives the user their user name and password if they decide to sign up for your site. The default offering is a little dull but luckily the guys who wrote WordPress have half heartedly thought about how it can be improved. Why let plugin writers like me do it of course. Sadly they opted not to use the action and filter system which already is ingrained in the rest of WordPress (for good reason I&#8217;m sure.. likely to do with load order) but instead just wrapped the entire wp_new_user_notification function in a PHP function called function_exists. This does what it says on the tin and only declares the function if someone else (a plugin or theme) doesn&#8217;t get there first.</p>
<p>In most cases this system works fine when you install a plugin dedicated to editing the welcome email and leave it at that. In reality most blogs have 30+ plugins active at any one time and probability and inevitability both say that more than one person is likely to want to jump on this handy feature for their plugin or theme. This means that one of the plugins needs to go! Normally if it were two plugins designed to edit the welcome email then we would be ok.. an obvious conflict of interest but what if one were a forum or shopping cart in conjunction with my plugin? Which goes then? Well the one which provides less functionality of course which, sadly, in that example would be my little plugin.</p>
<p>To make it somewhat more awkward, some plugins like to call WordPress core files directly thus causing the default function for the welcome email to be called before any other plugins and therefore chucking everyone else out of the race to declare the function first. Maintenance Mode is a plugin I know which does this when the system is active although it sorts itself out when you come out of maintenance mode so not really an issue. I have just been informed of another conflict with a plugin which makes dealing with WP Ecommerce in bulk easier (and we all know that was needed years ago!). Whatever reason they have called pluggable.php for I don&#8217;t know but it means that my plugin (or any other trying to declare a function first like this (it&#8217;s more common than you think!)) won&#8217;t function.</p>
<p>It&#8217;s such a simple solution but it works.. to fix you just need to rename my plugin directory to something else. WordPress naming conventions make calling a plugin anything starting with &#8216;WP&#8217; very trendy indeed. My plugins are all prefixed SB, my initial, for archiving more than anything else but the people who do the same with initials AA are laughing at us all right now I assure you (or not laughing but living in blissful ignorance!). Here&#8217;s the logic.. it&#8217;s really simple:</p>
<p>On any given page load WordPress will load it&#8217;s core files first and then look for plugins to bolt on to the system using the action/filter system. This is where the PHP files are initially &#8216;required&#8217;/'included&#8217; and individual balls (controlled by the plugin writers) set in motion. WordPress keeps a list of active plugins to call in the database in the wp_options table under an imaginatively named row called &#8216;active_plugins&#8217;. This is an alphabetically ordered list of plugins labelled by their location beneath the plugins directory (eg: <em>welcome-email-editor/sb_welcome_email_editor.php</em>). It will run from top to bottom including these files. This means there is a priority order for code defined only by the fact it has a name higher up the alphabet.</p>
<p>So to conclude the way to get your plugin run first to avoid conflicts with other plugins just put it in a directory called something beginning with a low alphabetical letter or special character. In my case I get a conflict every few months so it&#8217;s not worth changing but I am going to recommend that the next person to mention a conflict just renames their plugin folder from <em>welcome-email-editor</em> to <em>-welcome-email-editor</em> (note the leading hyphen). Job done!</p>
<p>I might add that changing the name of a plugin directory once a site is live isn&#8217;t a good idea on account of some plugins storing pathing information in the DB and WordPress itself storing the fact that plugin is active or not by it&#8217;s name in the directory tree. Put plainly if I change the name of my Welcome Email Editor plugin on my own site then it will deactivate itself and I shall need to reactivate it for it to continue working. Not a huge feat but try explaining that to normal user. Cue yet more support emails.</p>
<p>Hope this explains an issue for one or two of you. Perhaps plugin writers will learn not to call core PHP files directly in future to make my day run more smoothly&#8230; I doubt it!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sean-barton.co.uk/2012/01/wordpress-plugin-queue-jumping-easy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SB Mail Attachment Widget</title>
		<link>http://www.sean-barton.co.uk/2011/12/sb-mail-attachment-widget/</link>
		<comments>http://www.sean-barton.co.uk/2011/12/sb-mail-attachment-widget/#comments</comments>
		<pubDate>Mon, 05 Dec 2011 13:19:59 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[Time Savers]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[job application widget]]></category>
		<category><![CDATA[mail attachment widget]]></category>
		<category><![CDATA[wordpress email attachment]]></category>

		<guid isPermaLink="false">http://www.sean-barton.co.uk/?p=662</guid>
		<description><![CDATA[Ever wanted to use a simple contact form for your site where people can attach a file? Well I did for a recent project of mine. We wanted people to be able to apply for jobs whilst keeping the site very simple. Each post linked to a job and the consultant responsible for the job was set as the post author. Using a plugin like Contact Form 7 or Gravity Forms we thought we would be able to make up a form that people could fill in and, depending on the author of the post/page it&#8217;s on, send the email &#8230; <a class="continue_reading" href="http://www.sean-barton.co.uk/2011/12/sb-mail-attachment-widget/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-full wp-image-663" title="sb_mail_attachment_widget" src="http://www.sean-barton.co.uk/wp-content/uploads/2011/11/sb_mail_attachment_widget.png" alt="" width="289" height="310" />Ever wanted to use a simple contact form for your site where people can attach a file? Well I did for a recent project of mine. We wanted people to be able to apply for jobs whilst keeping the site very simple. Each post linked to a job and the consultant responsible for the job was set as the post author. Using a plugin like Contact Form 7 or Gravity Forms we thought we would be able to make up a form that people could fill in and, depending on the author of the post/page it&#8217;s on, send the email to one of many recipients.</p>
<p>Simple right using one of those bulky and, sometimes, advanced plugins? No&#8230;</p>
<p>I decided to write a plugin for it. The fields we wanted were clear, who are you, how can we get in touch with you and can you attach your CV? Well I wrote just that. This plugin adds a widget which allows you to configure the form and the email which gets sent. Most importantly it allows you to either set a fixed recipient address for the email or allow it to be set by the post author when the form is submitted. Emails sent with an attachment and it does work very well indeed (or did for us).</p>
<p>Note from the screenshot that you can include in the intro paragraph the name of the person who is to be informed if you so wish (admin2 in our case).</p>
<p>I am happy to make amends to this plugin for anyone if they will use it. I dare say I shall use it again in the future. I hope someone finds it useful if only for something to base their own plugin on.</p>
<p>Download it here: <a href="http://www.sean-barton.co.uk/wp-content/plugins/download-monitor/download.php?id=28" title="Downloaded 41 times">SB Mail Attachment Widget (2.7 kB)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sean-barton.co.uk/2011/12/sb-mail-attachment-widget/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SB Tell a Friend Widget</title>
		<link>http://www.sean-barton.co.uk/2011/11/sb-tell-a-friend-widget/</link>
		<comments>http://www.sean-barton.co.uk/2011/11/sb-tell-a-friend-widget/#comments</comments>
		<pubDate>Wed, 30 Nov 2011 13:17:07 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[Time Savers]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[free plugin]]></category>
		<category><![CDATA[recommend a friend]]></category>
		<category><![CDATA[tell a friend]]></category>

		<guid isPermaLink="false">http://www.sean-barton.co.uk/?p=658</guid>
		<description><![CDATA[I was looking for a widget to allow people to tell their friends about a site for a client of mine and realised that any I found in the WordPress repository were forcing you to use a third party service to do such a simple job. I wrote this plugin to do just that. It creates a widget for you to use on your site which is very flexible and requires no signups or payments to anything. It was written for a recruitment company so the screenshot shows it in the job vacancy context. The title, intro paragraph (optional) and &#8230; <a class="continue_reading" href="http://www.sean-barton.co.uk/2011/11/sb-tell-a-friend-widget/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-full wp-image-659" title="sb_taf" src="http://www.sean-barton.co.uk/wp-content/uploads/2011/11/sb_taf.png" alt="" width="288" height="205" />I was looking for a widget to allow people to tell their friends about a site for a client of mine and realised that any I found in the WordPress repository were forcing you to use a third party service to do such a simple job. I wrote this plugin to do just that. It creates a widget for you to use on your site which is very flexible and requires no signups or payments to anything.</p>
<p>It was written for a recruitment company so the screenshot shows it in the job vacancy context. The title, intro paragraph (optional) and labels for the boxes are all configurable via the widget as is the content of the email sent to the recommended person.</p>
<p>Currently there are no stats logged for usage of this plugin but it&#8217;s something I am going to be looking at in due course. It would be nice, for instance, to record the details of each recommendation sent either in our own system or in Google Analytics.</p>
<p>Download it here: <a href="http://www.sean-barton.co.uk/wp-content/plugins/download-monitor/download.php?id=27" title="Downloaded 33 times">SB Tell a Friend (2.03 kB)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sean-barton.co.uk/2011/11/sb-tell-a-friend-widget/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Getting the WordPress Excerpt outside of The Loop</title>
		<link>http://www.sean-barton.co.uk/2011/11/getting-the-wordpress-excerpt-outside-of-the-loop/</link>
		<comments>http://www.sean-barton.co.uk/2011/11/getting-the-wordpress-excerpt-outside-of-the-loop/#comments</comments>
		<pubDate>Wed, 16 Nov 2011 14:36:13 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[Bug Fixes]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[Themes]]></category>
		<category><![CDATA[Time Savers]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.sean-barton.co.uk/?p=654</guid>
		<description><![CDATA[I have been working my way around this one for a few months now, never bothering to think about the best solution. There is not, in fact, a WordPress simple function to get the excerpt outside of the WordPress loop. Why would you want to do that you ask&#8230; Example: I have a plugin I have written to create a basic shopping cart and shop front. It makes use of a simple shortcode on a Page to generate the shop which is based on a custom post type called Products. The Loop is used on the main page itself to &#8230; <a class="continue_reading" href="http://www.sean-barton.co.uk/2011/11/getting-the-wordpress-excerpt-outside-of-the-loop/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I have been working my way around this one for a few months now, never bothering to think about the best solution. There is not, in fact, a WordPress simple function to get the excerpt outside of the WordPress loop. Why would you want to do that you ask&#8230;</p>
<p>Example:</p>
<p>I have a plugin I have written to create a basic shopping cart and shop front. It makes use of a simple shortcode on a Page to generate the shop which is based on a custom post type called Products. The Loop is used on the main page itself to generate the WordPress Page and subsequently process the shortcode. I loop through the products using a query_posts statement to bung the data into an array (for caching and manipulating so using a child Loop isn&#8217;t possible here) and then loop over it again later on. I want to show the Excerpt (which may or may not exist) on the shop front and the full description for my individual product pages.</p>
<p>So I initially thought of doing something like the following:</p>
<pre>&lt;?php
$product = get_page($product_id);
echo $product-&gt;post_excerpt;
?&gt;</pre>
<p>What this approach does wrong is returns nothing at all when the user hasn&#8217;t filled in an Excerpt for the product they entered. WordPress normally takes a selection of text from the main content, strips out any HTML and shortcodes and shows that instead.</p>
<p>Next option is this:</p>
<pre>&lt;?php
echo get_the_excerpt();
?&gt;</pre>
<p>What this does is prints the excerpt for the page which the shop front it hosted on (the parent page) because, as far as The Loop is concerned, the context of the page isn&#8217;t a shop front, it&#8217;s just a normal Page.</p>
<p>So why does this not work?</p>
<pre>&lt;?php
echo get_the_excerpt($product_id);
?&gt;</pre>
<p>Well some bright spark on a blog out in the ether thought it did however, regardless of what the argument for the function was initially, it no longer works as has been depracated (the argument that is).</p>
<p>So what&#8217;s the solution&#8230; well sadly it&#8217;s a custom function of your own. Luckily for you I have backtraced the code and writted my own little version of the above and it works a treat&#8230;</p>
<pre>&lt;?php
        function get_the_excerpt($id=false) {
            global $post;

            $old_post = $post;
            if ($id != $post-&gt;ID) {
                $post = get_page($id);
            }

            if (!$excerpt = trim($post-&gt;post_excerpt)) {
                $excerpt = $post-&gt;post_content;
                $excerpt = strip_shortcodes( $excerpt );
                $excerpt = apply_filters('the_content', $excerpt);
                $excerpt = str_replace(']]&gt;', ']]&amp;gt;', $excerpt);
                $excerpt = strip_tags($excerpt);
                $excerpt_length = apply_filters('excerpt_length', 55);
                $excerpt_more = apply_filters('excerpt_more', ' ' . '[...]');

                $words = preg_split("/[\n\r\t ]+/", $excerpt, $excerpt_length + 1, PREG_SPLIT_NO_EMPTY);
                if ( count($words) &gt; $excerpt_length ) {
                    array_pop($words);
                    $excerpt = implode(' ', $words);
                    $excerpt = $excerpt . $excerpt_more;
                } else {
                    $excerpt = implode(' ', $words);
                }
            }

            $post = $old_post;

            return $excerpt;
        }
?&gt;</pre>
<p>I have put mine in a class I used for my plugins these days as a helper function however just rename it (to avoid a naming conflict with it&#8217;s namesake) and call it from your plugin or theme as you would normally.</p>
<p>hope this helps someone out. Please let me know if anyone knows a better or simpler way. This works for me but I really wish there wasn&#8217;t such a monumental oversight by the WordPress guys on this one (other than creating sub loops which just feels wrong and inflexible to me)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sean-barton.co.uk/2011/11/getting-the-wordpress-excerpt-outside-of-the-loop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to get into a WordPress site without a login, just FTP</title>
		<link>http://www.sean-barton.co.uk/2011/08/how-to-get-into-a-wordpress-site-without-a-login-just-ftp/</link>
		<comments>http://www.sean-barton.co.uk/2011/08/how-to-get-into-a-wordpress-site-without-a-login-just-ftp/#comments</comments>
		<pubDate>Mon, 22 Aug 2011 11:14:42 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[Time Savers]]></category>
		<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.sean-barton.co.uk/?p=634</guid>
		<description><![CDATA[Ok interesting problem for you&#8230; your client gives you the FTP information for his server but has no idea what the admin password is for the WordPress site you are supposed to be working on is. Sounds a little odd but in the case I experienced the user account was an Editor role which is, in effect, useless if you want to play with plugins or users etc&#8230; Here&#8217;s how I got in&#8230; WordPress stores it&#8217;s passwords as hashes in the database for security purposes. Annoying if you are trying to find out other people&#8217;s passwords though. Luckily the hashinh &#8230; <a class="continue_reading" href="http://www.sean-barton.co.uk/2011/08/how-to-get-into-a-wordpress-site-without-a-login-just-ftp/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Ok interesting problem for you&#8230; your client gives you the FTP information for his server but has no idea what the admin password is for the WordPress site you are supposed to be working on is. Sounds a little odd but in the case I experienced the user account was an Editor role which is, in effect, useless if you want to play with plugins or users etc&#8230;</p>
<p><strong>Here&#8217;s how I got in&#8230;</strong></p>
<p>WordPress stores it&#8217;s passwords as hashes in the database for security purposes. Annoying if you are trying to find out other people&#8217;s passwords though. Luckily the hashinh algorithm is standard md5 across any site you use. I have several WordPress sites of my own set up so I opened up Navicat and got the password hash for a site I know the password to.</p>
<p>I then opened up the functions.php file for the theme I knew was active on the clients server and added the following code:</p>
<pre>global $wpdb;
$sql = 'SELECT * FROM ' . $wpdb-&gt;users;
echo '&lt;pre&gt;';
print_r($wpdb-&gt;get_results($sql));
echo '&lt;/pre&gt;';

$sql = 'UPDATE ' . $wpdb-&gt;users . ' SET user_pass = "$P$Ba8do3KsWiaThA80UbfHygumoUFu3i1" WHERE ID = 1';
$wpdb-&gt;query($sql);</pre>
<p>Idiot proof right! You need the first query to give you the name of the admin account. This is the one with the ID of 1 and the original hash to put back once you have your own user. The second part updates that record with your own password hash. Only run the page the once and make sure to write down the old password hash because you will lose it on the second refresh otherwise.</p>
<p>Once in I simply created my own administrator user and then replaced the hash in the second query for the original, ran it, removed the code and I was done.</p>
<p>It&#8217;s an odd situation when you would need to do this but the same method works for most site authentication systems assuming they aren&#8217;t doing anything really clever with the hashes&#8230; in my experience, they don&#8217;t!</p>
<p><em>Note: if you were wondering what $P$Ba8do3KsWiaThA80UbfHygumoUFu3i1 means when not hashed&#8230;. it&#8217;s &#8216;sausages&#8217; <img src='http://www.sean-barton.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sean-barton.co.uk/2011/08/how-to-get-into-a-wordpress-site-without-a-login-just-ftp/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>WP Ecommerce template redirect</title>
		<link>http://www.sean-barton.co.uk/2011/08/wp-ecommerce-template-redirect/</link>
		<comments>http://www.sean-barton.co.uk/2011/08/wp-ecommerce-template-redirect/#comments</comments>
		<pubDate>Thu, 18 Aug 2011 14:50:18 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[Bug Fixes]]></category>
		<category><![CDATA[Ecommerce]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[Time Savers]]></category>
		<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.sean-barton.co.uk/?p=632</guid>
		<description><![CDATA[Today I spent a good two to three hours making zero progress on a site which I was upgrading. I am making changes to the design but sadly didn&#8217;t get that far as first I decided to update WordPress and the plugins. The upgrade to WP 3.2.1 went well as did every other plugin except WP Ecommerce. I know this plugin to be a troublemaker but sadly as it&#8217;s the only half decent cart WordPress has to offer (and it&#8217;s pretty dire really). The issue I was facing is that we have a custom page template for the shop to &#8230; <a class="continue_reading" href="http://www.sean-barton.co.uk/2011/08/wp-ecommerce-template-redirect/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Today I spent a good two to three hours making zero progress on a site which I was upgrading. I am making changes to the design but sadly didn&#8217;t get that far as first I decided to update WordPress and the plugins. The upgrade to WP 3.2.1 went well as did every other plugin except WP Ecommerce. I know this plugin to be a troublemaker but sadly as it&#8217;s the only half decent cart WordPress has to offer (and it&#8217;s pretty dire really).</p>
<p>The issue I was facing is that we have a custom page template for the shop to include a different sidebar and some other small changes. Upon upgrading the page template decided to revert to the theme&#8217;s page.php file instead of the template-shop.php we were using previously. Lots of head scratching and shouting followed and a couple of reverts from backups but eventually I got it down to a single function in the <strong>theme.functions.php</strong> file in the <strong>wpsc-includes</strong> directory. There are a couple of fixes you could use although the most straightforward is a hack to one of their core files&#8230; Sadly for me I don&#8217;t like doing that as the next time you upgrade you get to do it all over again. Luckily they had the foresight to add an action call at the top of the function so I wrote the following.</p>
<p><strong>The Code</strong></p>
<pre>add_action('wpsc_swap_the_template', 'include_shop');

function include_shop() {
    global $wp_query,$wpsc_query;

    $products_page_id = wpec_get_the_post_id_by_shortcode('[productspage]');
    $term = get_query_var( 'wpsc_product_category' );
    $tax_term = get_query_var ('product_tag' );
    $obj = $wp_query-&gt;get_queried_object();
    $id = isset( $obj-&gt;ID ) ? $obj-&gt;ID : null;

    if( get_query_var( 'post_type' ) == 'wpsc-product' || $term || $tax_term || ( $id == $products_page_id )){

	$shop_template = trailingslashit(TEMPLATEPATH) . 'template-shop.php';
	require_once($shop_template);
	die;
    }
}</pre>
<p><strong>How to integrate it</strong></p>
<p>To get this to work you just need to add it to your theme functions.php file and change where I have &#8220;template-shop.php&#8221; to be the name of your own template. This may well not even be an issue unless upgrading from an old version of WPSC but this fix worked for me.</p>
<p>As an aside I note the following comment left by one of the developers</p>
<pre>// have to pass 'page' as the template type. This is lame, btw, and needs a rewrite in 4.0</pre>
<p><em>Note: this was an issue when migrating from WP Ecommerce versions 3.7.7 to 3.8.6</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sean-barton.co.uk/2011/08/wp-ecommerce-template-redirect/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Simple custom post type features for WordPress</title>
		<link>http://www.sean-barton.co.uk/2011/07/simple-custom-post-type-features-for-wordpress/</link>
		<comments>http://www.sean-barton.co.uk/2011/07/simple-custom-post-type-features-for-wordpress/#comments</comments>
		<pubDate>Fri, 15 Jul 2011 12:50:24 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[Personal Blog]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[Themes]]></category>
		<category><![CDATA[Time Savers]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.sean-barton.co.uk/?p=601</guid>
		<description><![CDATA[I have been using custom post types in WordPress for a long time now&#8230;. In fact each new theme or plugin I write I tend to integrate a custom post type and some supplementary meta boxes here and there. If you have no idea what i&#8217;m talking about then this article probably isn&#8217;t for you&#8230; however read on and I shall explain briefly. Custom post types are wonderful for parts of sites that don&#8217;t generally fit into the standard Post or Page model. For instance WP Ecommerce (the most popular WP shopping cart) has just started using custom post types &#8230; <a class="continue_reading" href="http://www.sean-barton.co.uk/2011/07/simple-custom-post-type-features-for-wordpress/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-thumbnail wp-image-609" title="WordPress-Introduction-icon_big-en" src="http://www.sean-barton.co.uk/wp-content/uploads/2011/07/WordPress-Introduction-icon_big-en-150x150.png" alt="" width="150" height="150" />I have been using custom post types in WordPress for a long time now&#8230;. In fact each new theme or plugin I write I tend to integrate a custom post type and some supplementary meta boxes here and there. If you have no idea what i&#8217;m talking about then this article probably isn&#8217;t for you&#8230; however read on and I shall explain briefly.</p>
<p>Custom post types are wonderful for parts of sites that don&#8217;t generally fit into the standard Post or Page model. For instance WP Ecommerce (the most popular WP shopping cart) has just started using custom post types for storing their products&#8230; you will get the idea, products being a custom post type. If I say that they are a way of storing things in WordPress that can, if needed, provide a way of administering these objects as if they were a page like any other.</p>
<p>Adding them yourself requires some code and adding the fields that will appear on the page will require some more. This isn&#8217;t what I want to go over right now as there is an easier way. To get an idea of what I mean, see the following screenshots&#8230;</p>
<div id="attachment_602" class="wp-caption alignleft" style="width: 160px"><a rel="lightbox" href="http://www.sean-barton.co.uk/wp-content/uploads/2011/07/Screen-shot-2011-07-15-at-13.24.28.png"><img class="size-thumbnail wp-image-602" title="Screen shot 2011-07-15 at 13.24.28" src="http://www.sean-barton.co.uk/wp-content/uploads/2011/07/Screen-shot-2011-07-15-at-13.24.28-150x150.png" alt="" width="150" height="150" /></a><p class="wp-caption-text">Note the bottom three, they are custom post types</p></div>
<div id="attachment_603" class="wp-caption alignleft" style="width: 160px"><a rel="lightbox" href="http://www.sean-barton.co.uk/wp-content/uploads/2011/07/Screen-shot-2011-07-15-at-13.25.10.png"><img class="size-thumbnail wp-image-603" title="Screen shot 2011-07-15 at 13.25.10" src="http://www.sean-barton.co.uk/wp-content/uploads/2011/07/Screen-shot-2011-07-15-at-13.25.10-150x150.png" alt="" width="150" height="150" /></a><p class="wp-caption-text">This admin interface is generated for you with 0 effort.</p></div>
<p>&#8220;Products&#8221; is generated by WP Ecommerce and my theme added &#8220;FAQs&#8221; and &#8220;Photography&#8221;. The second screenshot shows the admin interface, similar to the post/page editor, which is generated and the meta boxes which can be added very easily indeed to make it appear that way. The way that these can be added without writing any code would be to use one of the &#8216;More&#8217; plugins&#8230;. These are More Fields, More Types and More Taxonomies&#8230; all freely available WordPress plugins although I tend not to use them these days (I write them into my themes instead). Take a look though.</p>
<p>This article was really to outline what you do with the data within these types in the real world. Of course storing the data is easy, using it requires some imagination really. The post type items are stored in the wp_posts table and the fields you add as meta data are stored in wp_usermeta. You can easily retrieve the information using standard WordPress functions.</p>
<p>The following function can be used to get all of the photography items and store them in an Array of Objects for looping and output any way you see fit&#8230;</p>
<pre>function get_custom_post_type_items($custom_post_type) {
	$args = array(
	'post_type' =&gt; $custom_post_type,
	'post_status' =&gt; 'publish',
	'posts_per_page' =&gt;-1,
	'orderby' =&gt; 'post_date',
	'order' =&gt; 'DESC'
	);

	$posts = new WP_Query($args);
	$return = array();

	if ($posts-&gt;have_posts()) {
		while ($posts-&gt;have_posts()) {
			$posts-&gt;the_post();

			$post_id = get_the_ID();

			$sub_post = new stdClass();
			$sub_post-&gt;post_id = $post_id;
			$sub_post-&gt;title = get_the_title();
			$sub_post-&gt;permalink = get_permalink($post_id);
			$sub_post-&gt;content = wpautop(get_the_content());
			$sub_post-&gt;meta_data = get_post_meta($post_id, 'meta_data_name, true);

			$return[] = $sub_post;
		}
	}

	wp_reset_query();

	return $return;
}</pre>
<p>You can use this function in your functions.php file in your theme to be called by a page template or a shortcode if you add one to return the items you have added as custom post types. I have added a single meta data item called meta_data in each row which gets a custom field from the custom post type item called meta_data_name. In my Photography example I would just have more lines like this to get the various items from my custom meta box</p>
<pre>$sub_post-&gt;png_image = get_post_meta($post_id, 'png_image_url, true);</pre>
<p>Another good example use of this function would be for a featured items slider that you often see at the top of websites. One or more pages might have a portfolio item slider or a rotating banner or something. In that case you would call my function from your header.php file then loop through it outputting the appropriate HTML per line before using something like a jQuery call to construct the slider.</p>
<p>When you understand the applications for custom post types you might be finding yourself using them in more and more creative ways. I wrote a custom meta box a while back to link custom post type items to each other across different types. This was to allow staff member types to be linked to team and office types and so on. Then using this association you can output something like a dynamic organisational chart using a shortcode or a custom page template without having to hard code a thing.</p>
<p>This is a thinker, I imagine, for some people. Get in touch with me if you want any help putting these custom post types in place and utilising them on your site.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sean-barton.co.uk/2011/07/simple-custom-post-type-features-for-wordpress/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Zen Cart Welcome Email Editor Update</title>
		<link>http://www.sean-barton.co.uk/2011/07/zen-cart-welcome-email-editor-update/</link>
		<comments>http://www.sean-barton.co.uk/2011/07/zen-cart-welcome-email-editor-update/#comments</comments>
		<pubDate>Tue, 12 Jul 2011 22:25:52 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[Time Savers]]></category>
		<category><![CDATA[Zen Cart]]></category>

		<guid isPermaLink="false">http://www.sean-barton.co.uk/?p=588</guid>
		<description><![CDATA[Just a quick one today. I have recently updated my Welcome email editor for Zencart. Not much of a change but a helpful user said that coupon codes weren&#8217;t working. They now do along with a few more hooks and options. Comments and suggestions welcome! Enjoy! Original post here: http://www.sean-barton.co.uk/2008/07/zen-cart-welcome-email-editor/ Here&#8217;s the download link:]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-thumbnail wp-image-589" title="zencart-logo" src="http://www.sean-barton.co.uk/wp-content/uploads/2011/07/zencart-logo-150x150.png" alt="" width="150" height="150" />Just a quick one today. I have recently updated my Welcome email editor for Zencart. Not much of a change but a helpful user said that coupon codes weren&#8217;t working. They now do along with a few more hooks and options. Comments and suggestions welcome! Enjoy!</p>
<p>Original post here: <a href="http://www.sean-barton.co.uk/2008/07/zen-cart-welcome-email-editor/">http://www.sean-barton.co.uk/2008/07/zen-cart-welcome-email-editor/</a></p>
<p>Here&#8217;s the download link: <code><a class="downloadlink" href="http://www.sean-barton.co.uk/wp-content/plugins/download-monitor/download.php?id=3" title="Version 1.2 downloaded 909 times" >Welcome Email Editor for ZenCart (5.29 kB)</a></code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sean-barton.co.uk/2011/07/zen-cart-welcome-email-editor-update/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SB Uploader gets an upgrade</title>
		<link>http://www.sean-barton.co.uk/2011/06/sb-uploader-gets-an-upgrade/</link>
		<comments>http://www.sean-barton.co.uk/2011/06/sb-uploader-gets-an-upgrade/#comments</comments>
		<pubDate>Mon, 27 Jun 2011 22:01:04 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[Time Savers]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.sean-barton.co.uk/?p=574</guid>
		<description><![CDATA[It&#8217;s been a while since I have posted anything, simply because I have been too busy with work and family etc&#8230; However, this is a good one for you. I have just spent the last couple of days on and off extending the SB Uploader plugin. For those of you that don&#8217;t know what it does it&#8217;s a meta box that sits in the post/page interface within WordPress and allows you to upload images and attach them to your content effortlessly and without being bombarded with options such as those that WordPress gives by default. This new update adds some &#8230; <a class="continue_reading" href="http://www.sean-barton.co.uk/2011/06/sb-uploader-gets-an-upgrade/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been a while since I have posted anything, simply because I have been too busy with work and family etc&#8230; However, this is a good one for you. I have just spent the last couple of days on and off extending the SB Uploader plugin. For those of you that don&#8217;t know what it does it&#8217;s a meta box that sits in the post/page interface within WordPress and allows you to upload images and attach them to your content effortlessly and without being bombarded with options such as those that WordPress gives by default.</p>
<p>This new update adds some really useful features to the plugin. They are as follows:</p>
<ul>
<li>Multiple instances of an uploader meaning you can have more than one image per page</li>
<li>Shortcodes added so you can effortlessly use your images within your content without coding</li>
<li>Configurable names (custom field names) for uploads so you aren&#8217;t stuck with post_image (see screenshot in gallery below)</li>
<li>Not only posts and pages, it now works with categories, tags and other taxonomies as well</li>
<li>Widgets added for both post and taxonomy images. Backup text/HTML added or optionally hides widget if no image uploaded</li>
</ul>
<p>Grab a copy now from the WordPress extend directory. It&#8217;s free remember so worth a go. Please do let me know if you would like help using it or if you can think of any way of bettering it. I always enjoy a good challenge!</p>
<p>Download it here <a title="Wordpress Extend directory SB Uploader" href="http://wordpress.org/extend/plugins/sb-uploader" target="_blank">http://wordpress.org/extend/plugins/sb-uploader</a></p>

<a href='http://www.sean-barton.co.uk/2011/06/sb-uploader-gets-an-upgrade/screen-shot-2011-06-27-at-22-32-00/' title='Single simple meta box'><img width="150" height="150" src="http://www.sean-barton.co.uk/wp-content/uploads/2011/06/Screen-shot-2011-06-27-at-22.32.00-150x150.png" class="attachment-thumbnail" alt="Single simple meta box" title="Single simple meta box" /></a>
<a href='http://www.sean-barton.co.uk/2011/06/sb-uploader-gets-an-upgrade/screen-shot-2011-06-27-at-22-32-13/' title='Multiple instances for a post/page example'><img width="150" height="150" src="http://www.sean-barton.co.uk/wp-content/uploads/2011/06/Screen-shot-2011-06-27-at-22.32.13-150x150.png" class="attachment-thumbnail" alt="Multiple instances for a post/page example" title="Multiple instances for a post/page example" /></a>
<a href='http://www.sean-barton.co.uk/2011/06/sb-uploader-gets-an-upgrade/screen-shot-2011-06-27-at-22-32-39/' title='Edit taxonomy interface'><img width="150" height="150" src="http://www.sean-barton.co.uk/wp-content/uploads/2011/06/Screen-shot-2011-06-27-at-22.32.39-150x150.png" class="attachment-thumbnail" alt="Edit taxonomy interface" title="Edit taxonomy interface" /></a>
<a href='http://www.sean-barton.co.uk/2011/06/sb-uploader-gets-an-upgrade/screen-shot-2011-06-27-at-22-32-50/' title='NEW configuration page for managing instances'><img width="150" height="150" src="http://www.sean-barton.co.uk/wp-content/uploads/2011/06/Screen-shot-2011-06-27-at-22.32.50-150x150.png" class="attachment-thumbnail" alt="NEW configuration page for managing instances" title="NEW configuration page for managing instances" /></a>
<a href='http://www.sean-barton.co.uk/2011/06/sb-uploader-gets-an-upgrade/screen-shot-2011-06-27-at-22-33-10/' title='Post image widget settings'><img width="150" height="150" src="http://www.sean-barton.co.uk/wp-content/uploads/2011/06/Screen-shot-2011-06-27-at-22.33.10-150x150.png" class="attachment-thumbnail" alt="Post image widget settings" title="Post image widget settings" /></a>
<a href='http://www.sean-barton.co.uk/2011/06/sb-uploader-gets-an-upgrade/screen-shot-2011-06-27-at-22-33-14/' title='Taxonomy image widget settings'><img width="150" height="150" src="http://www.sean-barton.co.uk/wp-content/uploads/2011/06/Screen-shot-2011-06-27-at-22.33.14-150x150.png" class="attachment-thumbnail" alt="Taxonomy image widget settings" title="Taxonomy image widget settings" /></a>

]]></content:encoded>
			<wfw:commentRss>http://www.sean-barton.co.uk/2011/06/sb-uploader-gets-an-upgrade/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (enhanced)
Database Caching 8/60 queries in 0.092 seconds using disk
Object Caching 1185/1290 objects using disk

Served from: www.sean-barton.co.uk @ 2012-02-08 23:19:49 -->
