<?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>Dare to Think &#124; Web Design, Blog Development, Hosting and Print and Print made Simple &#187; Wordpress</title>
	<atom:link href="http://www.daretothink.co.uk/blog/category/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.daretothink.co.uk</link>
	<description>All made simple</description>
	<lastBuildDate>Mon, 19 Jul 2010 14:53:24 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>10 Tips to Clean, Optimize and Speed up your Wordpress Site</title>
		<link>http://www.daretothink.co.uk/blog/10-tips-to-clean-optimize-and-speed-up-your-wordpress-site/</link>
		<comments>http://www.daretothink.co.uk/blog/10-tips-to-clean-optimize-and-speed-up-your-wordpress-site/#comments</comments>
		<pubDate>Sat, 03 Oct 2009 19:30:43 +0000</pubDate>
		<dc:creator>alan</dc:creator>
				<category><![CDATA[Guides and Info]]></category>
		<category><![CDATA[Tips and Advice]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://www.daretothink.co.uk/?p=1132</guid>
		<description><![CDATA[If you find your Wordpress Site is struggling speed-wise or you&#8217;ve been given your marching orders from your web hosts (due to high CPU usage) then read on and hopefully these few tips will help sort out and speed up your Wordpress Blog.
Before doing any of the following it&#8217;ll be a good idea to back [...]


Related posts:<ol><li><a href='http://www.daretothink.co.uk/blog/redirect-your-site-the-search-engine-friendly-way/' rel='bookmark' title='Permanent Link: Redirect your site the Search Engine Friendly way'>Redirect your site the Search Engine Friendly way</a></li>
<li><a href='http://www.daretothink.co.uk/blog/remove-the-wordpress-meta-tag-from-your-blog/' rel='bookmark' title='Permanent Link: Remove the Wordpress Meta Tag from your Blog'>Remove the Wordpress Meta Tag from your Blog</a></li>
<li><a href='http://www.daretothink.co.uk/blog/secure-your-wordpress-blog/' rel='bookmark' title='Permanent Link: Secure your Wordpress Blog'>Secure your Wordpress Blog</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>If you find your Wordpress Site is struggling speed-wise or you&#8217;ve been given your marching orders from your web hosts (due to high CPU usage) then read on and hopefully these few tips will help sort out and speed up your Wordpress Blog.<span id="more-1132"></span></p>
<p>Before doing any of the following it&#8217;ll be a good idea to back up your database. You can do this via phpMyAdmin (if you know what your&#8217;re doing) or there&#8217;s a handy little plugin called <a title="Wordpress Database Manager Plugin" href="http://wordpress.org/extend/plugins/wp-dbmanager/" target="_blank">WP-DBManager</a> which will do it for you and lots lots more. Whilst we&#8217;re on that note, please remember to back up your database every now and again, just in case!</p>
<h3>1. Remove any plugins that you simply don&#8217;t use</h3>
<p>Visit your Wordpress Admin site and click on Plugins &gt; Inactive to find out which will be safe to remove. You should also take a look at your Active plugins as there might be some in there to delete as well (be careful though as they may be used somewhere on your site.</p>
<h3>2. Update Wordpress to the latest version</h3>
<p>You should see a warning at the top of Wordpress Admin page if you need to upgrade to the latest version. It&#8217;s a wise idea for security reasons to keep up to date. Here&#8217;s a <a title="Guide to upgrading Wordpress" href="http://codex.wordpress.org/Upgrading_WordPress" target="_blank">handy guide to upgrading Wordpress</a>.</p>
<h3>3. Upgrade any out of date plugins</h3>
<p>If there&#8217;re are newer versions of plugins available then you will see a little number next to &#8220;Plugins&#8221; in your Wordpress Admin page.</p>
<h3>4. Find orphan options in your database</h3>
<p>Luckily there&#8217;s a plugin for this, as hunting through a MySQL database &#8211; if you don&#8217;t know what you&#8217;re doing &#8211; can be a daunting task. So install <a title="Find orphan database options with Clean Options" href="http://wordpress.org/extend/plugins/clean-options/" target="_blank">Clean Options</a> and select &#8220;Find Orphaned Options&#8221;. You&#8217;ll more than likely be presented with a huge list. Now, take your time and look at these carefully. If there&#8217;s any that are obvious then select them and delete. There&#8217;s also a useful search option where you can search for that option in Google &#8211; there you might be able to find out what it is and whether it&#8217;s safe to delete. Just because it&#8217;s an orphan file it doesn&#8217;t mean that it&#8217;s not being used by one of your plugins. So, really, just take your time with this.</p>
<h3>5. Optimize your database</h3>
<p>Download <a title="Optimize your Wordpress Database" href="http://wordpress.org/extend/plugins/wp-optimize/" target="_blank">WP-Optimize</a> and  remove all post revisions, clean marked spam comments, clean unapproved comments and optimize database tables. A great tool that can save a lot of space in your database. I got one site down from 16mb to 10mb.</p>
<h3>6. Cache your pages and posts</h3>
<p>Every time somebody views a post on your blog there are numerous scripts that have to be run each and every time. This can be very processor intensive and your web hosts won&#8217;t like you for it. So download <a title="Cache your Wordpress Posts" href="http://wordpress.org/extend/plugins/wp-super-cache/" target="_blank">WP Super Cache</a> and use it. It will then only have to run a load of scripts once &#8211; then everybody else will see the cached version of the page. Don&#8217;t worry if you update it or somebody adds a new comment &#8211; it&#8217;s clever enough to then generate a new page.</p>
<h3>7. Cache your Wordpress Widgets</h3>
<p>Widgets work in a different way and so you&#8217;ll need another plugin for this called <a title="Cache your Wordpress Widgets" href="http://wordpress.org/extend/plugins/wp-widget-cache/" target="_blank">WP Widget Cache</a>.  Now, I was a bit confused as to where the options were for this plugin but they are actually on the Widgets Admin page, above your widget.</p>
<h3>8. Reduce the amount of Tags you use</h3>
<p>Now, I think and I&#8217;m in the process of testing this but, I think that tags are a major problem with CPU usage and so I think you really need to reduce the amount you use. Don&#8217;t 20 or 30 tags for every article you publish &#8211; stick to a handful.</p>
<h3>9. There isn&#8217;t really a ninth or tenth tip but 10 Top Tips sounds better than 8!</h3>
<h3>10. Keep your Wordpress site up to date</h3>
<p>Upgade plugins when required, backup your database, backup your files every now and again, clean and optimize your database. If you do these things then everything should run smoothly.</p>
<p>I hope you&#8217;ve found this useful if so, then remember to retweet it or share it below. Also, be sure to check out another useful Wordpress post: <a title="Secure your Wordpress Blog" href="http://www.daretothink.co.uk/blog/secure-your-wordpress-blog/" target="_blank">How to Secure your Wordpress Blog</a></p>


<!-- Begin SexyBookmarks Menu Code -->
<div class="sexy-bookmarks sexy-bookmarks-expand sexy-bookmarks-bg-caring">
<ul class="socials">
		<li class="sexy-delicious">
			<a href="http://del.icio.us/post?url=http://www.daretothink.co.uk/blog/10-tips-to-clean-optimize-and-speed-up-your-wordpress-site/&amp;title=10+Tips+to+Clean%2C+Optimize+and+Speed+up+your+Wordpress+Site" rel="nofollow" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="sexy-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://www.daretothink.co.uk/blog/10-tips-to-clean-optimize-and-speed-up-your-wordpress-site/&amp;title=10+Tips+to+Clean%2C+Optimize+and+Speed+up+your+Wordpress+Site" rel="nofollow" title="Digg this!">Digg this!</a>
		</li>
		<li class="sexy-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://www.daretothink.co.uk/blog/10-tips-to-clean-optimize-and-speed-up-your-wordpress-site/&amp;title=10+Tips+to+Clean%2C+Optimize+and+Speed+up+your+Wordpress+Site" rel="nofollow" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="sexy-twitter">
			<a href="http://twitter.com/home?status=10+Tips+to+Clean%2C+Optimize+and+Speed+up+your+Wordpress+Site+-+http://tinyurl.com/yb67kcn+(via+@daretothink)" rel="nofollow" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="sexy-mail">
			<a href="mailto:?subject=%2210%20Tips%20to%20Clean%2C%20Optimize%20and%20Speed%20up%20your%20Wordpress%20Site%22&amp;body=I%20thought%20this%20article%20might%20interest%20you.%0A%0A%22If%20you%20find%20your%20Wordpress%20Site%20is%20struggling%20speed-wise%20or%20you%27ve%20been%20given%20your%20marching%20orders%20from%20your%20web%20hosts%20%28due%20to%20high%20CPU%20usage%29%20then%20read%20on%20and%20hopefully%20these%20few%20tips%20will%20help%20sort%20out%20and%20speed%20up%20your%20Wordpress%20Blog.%0D%0A%0D%0ABefore%20doing%20any%20of%20the%20following%20it%27ll%20be%20a%20good%20idea%20to%20b%22%0A%0AYou%20can%20read%20the%20full%20article%20here%3A%20http://www.daretothink.co.uk/blog/10-tips-to-clean-optimize-and-speed-up-your-wordpress-site/" rel="nofollow" title="Email this to a friend?">Email this to a friend?</a>
		</li>
		<li class="sexy-comfeed">
			<a href="http://www.daretothink.co.uk/blog/10-tips-to-clean-optimize-and-speed-up-your-wordpress-site/feed" rel="nofollow" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a>
		</li>
		<li class="sexy-reddit">
			<a href="http://reddit.com/submit?url=http://www.daretothink.co.uk/blog/10-tips-to-clean-optimize-and-speed-up-your-wordpress-site/&amp;title=10+Tips+to+Clean%2C+Optimize+and+Speed+up+your+Wordpress+Site" rel="nofollow" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="sexy-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://www.daretothink.co.uk/blog/10-tips-to-clean-optimize-and-speed-up-your-wordpress-site/&amp;t=10+Tips+to+Clean%2C+Optimize+and+Speed+up+your+Wordpress+Site" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="sexy-linkedin">
			<a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://www.daretothink.co.uk/blog/10-tips-to-clean-optimize-and-speed-up-your-wordpress-site/&amp;title=10+Tips+to+Clean%2C+Optimize+and+Speed+up+your+Wordpress+Site&amp;summary=If%20you%20find%20your%20Wordpress%20Site%20is%20struggling%20speed-wise%20or%20you%27ve%20been%20given%20your%20marching%20orders%20from%20your%20web%20hosts%20%28due%20to%20high%20CPU%20usage%29%20then%20read%20on%20and%20hopefully%20these%20few%20tips%20will%20help%20sort%20out%20and%20speed%20up%20your%20Wordpress%20Blog.%0D%0A%0D%0ABefore%20doing%20any%20of%20the%20following%20it%27ll%20be%20a%20good%20idea%20to%20b&amp;source=Dare to Think | Web Design, Blog Development, Hosting and Print and Print made Simple" rel="nofollow" title="Share this on Linkedin">Share this on Linkedin</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>
<!-- End SexyBookmarks Menu Code -->



<p>Related posts:<ol><li><a href='http://www.daretothink.co.uk/blog/redirect-your-site-the-search-engine-friendly-way/' rel='bookmark' title='Permanent Link: Redirect your site the Search Engine Friendly way'>Redirect your site the Search Engine Friendly way</a></li>
<li><a href='http://www.daretothink.co.uk/blog/remove-the-wordpress-meta-tag-from-your-blog/' rel='bookmark' title='Permanent Link: Remove the Wordpress Meta Tag from your Blog'>Remove the Wordpress Meta Tag from your Blog</a></li>
<li><a href='http://www.daretothink.co.uk/blog/secure-your-wordpress-blog/' rel='bookmark' title='Permanent Link: Secure your Wordpress Blog'>Secure your Wordpress Blog</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.daretothink.co.uk/blog/10-tips-to-clean-optimize-and-speed-up-your-wordpress-site/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Secure your Wordpress Blog</title>
		<link>http://www.daretothink.co.uk/blog/secure-your-wordpress-blog/</link>
		<comments>http://www.daretothink.co.uk/blog/secure-your-wordpress-blog/#comments</comments>
		<pubDate>Wed, 06 May 2009 09:22:41 +0000</pubDate>
		<dc:creator>alan</dc:creator>
				<category><![CDATA[Guides and Info]]></category>
		<category><![CDATA[Websites]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://www.daretothink.co.uk/?p=790</guid>
		<description><![CDATA[When anything gets big and popular there are always unscrupulous folk out there wanting to hack your site or as they put it showing you the security downfalls of the software. With that in mind you&#8217;ll need to secure your Wordpress Site so they can&#8217;t get in and ruin your site. There&#8217;s a number of [...]


Related posts:<ol><li><a href='http://www.daretothink.co.uk/blog/10-tips-to-clean-optimize-and-speed-up-your-wordpress-site/' rel='bookmark' title='Permanent Link: 10 Tips to Clean, Optimize and Speed up your Wordpress Site'>10 Tips to Clean, Optimize and Speed up your Wordpress Site</a></li>
<li><a href='http://www.daretothink.co.uk/blog/backup-your-website-using-cpanel/' rel='bookmark' title='Permanent Link: Backing up your Website using cPanel'>Backing up your Website using cPanel</a></li>
<li><a href='http://www.daretothink.co.uk/blog/iphone-to-mac-wireless-networking/' rel='bookmark' title='Permanent Link: iPhone to Mac Wireless Networking'>iPhone to Mac Wireless Networking</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>When anything gets big and popular there are always unscrupulous folk out there wanting to hack your site or as they put it showing you the security downfalls of the software. With that in mind you&#8217;ll need to secure your Wordpress Site so they can&#8217;t get in and ruin your site. There&#8217;s a number of steps to follow, as shown here.<span id="more-790"></span></p>
<p>If you&#8217;re unsure about anything or you&#8217;re a little scared to do it yourself then please <a title="Secure your Wordpress Blog with help from Dare to Think" href="http://www.daretothink.co.uk/contact" target="_blank">get in touch</a> where I&#8217;ll be more than happy to help or provide a quote for securing your Wordpress Blog. If you know of any other ways to increase the security on your Wordpress Blog then please leave a comment below for others to see.</p>
<h3><strong>Remove the ability to browse directories</strong></h3>
<p>For example enter www.yourblog.com/wp-content/plugins/ into your browser. If you&#8217;ve not yet removed this access then you&#8217;ll see a list of all your Wordpress Plugins. This isn&#8217;t good as hackers can locate plugins that have security issues and target them in their next attack.</p>
<p>Add the following text to your .htaccess file (usually located in your blog or site&#8217;s root directory):</p>
<blockquote><p>Options All -Indexes</p></blockquote>
<h3>Remove the Wordpress Version Meta Tag</h3>
<p>Add the following text to your Wordpress Theme&#8217;s &#8220;function.php&#8221; file. Or use this <a title="Remove Wordpress Generator Meta Tag" href="http://wordpress.org/extend/plugins/jr-remove-generator-metatag/" target="_blank">remove wordpress generator meta tag plugin</a>:</p>
<blockquote><p>&lt;?php remove_action(&#8216;wp_head&#8217;, &#8216;wp_generator&#8217;); ?&gt;</p></blockquote>
<h3>Remove or disguise your &#8220;mailto&#8221; links</h3>
<p>This doesn&#8217;t really affect the security of your site but merely helps to combat the ever increasing amount of SPAM you receive. A useful plugin for this is <a title="Email Masking" href="http://wordpress.org/extend/plugins/spamshiv-lite-e-mail-address-protection/" target="_blank">Spamshiv</a> which masks any mailto links it finds on your site, automatically.</p>
<h3>Set the minimum file and directory permissions</h3>
<p>Your files will need a certain amount of permission rights for your blog to write files to your server. This can sometime leave them vulnerable especially with 777 set to your files and folders. Download the install the very useful <a title="Wordpress Security Scan Plugin" href="http://wordpress.org/extend/plugins/wp-security-scan/" target="_blank">WP Security Scan</a> plugin which will tell you what your folders are currently set to and what they need to be set at to function correctly but also securing them at the same time.</p>
<h3>Change or remove your &#8220;admin&#8221; username</h3>
<p>Again, another one where hackers use the admin username and attempt a brute force password guessing attack. If you have a really secure password (minimum 12 characters using upper and lower case letters, numbers and symbols) then there&#8217;s no need to worry but it might be worth changing the username to something less generic. Go into the Wordpress Users panel and see if there&#8217;s any posts attributed to the admin user. You can then delete that user but remember even if it says zero posts you may have created pages with that user so make sure you select &#8220;Attribute all posts and links to&#8221; and then select another user. Make sure you have another user on the list with administrator privileges. If there are then you&#8217;ll need to go into phpMyAdmin (accessible via your website&#8217;s cPanel) and locate your Wordpress Database (from those listed in the left column). Locate the and click users (from the left column &#8211; should be something_users). Tick the user_login checkbox and select the Browse tab. Click Edit (Pencil icon) and change the user_login text to something else. This will change the username and also replicate those changes to your Wordpress Admin.</p>
<h3>Keep Wordpress and your Plugins up to date</h3>
<p>This can help with security vulnerabilities that may occur in an older version. You will be notified that an update to Wordpress is available when you login to your Admin Site. Likewise, if there are Plugin updates available these will be shown in the Plugins Panel.</p>
<h3>Change your Wordpress Database Prefix</h3>
<p>Firstly before doing this make sure you backup both your site and your SQL database &#8211; at least then if anything goes wrong you can revert back. By default Wordpress adds a wp_ prefix to it&#8217;s database tables (if you haven&#8217;t installed Wordpress yet then this can be prevented by searching for &#8220;wp_&#8221; in the wp_config.php file to something less obvious such as &#8220;pju12tr_&#8221; or whatever you like &#8211; you can then continue with your installation) this needs to be changed to something less Wordpress orientated. Do this using the WP Security Scan plugin (mentioned above) or via phpMyAdmin in your website&#8217;s cPanel.</p>
<h3>Deny access to you wp-admin directory</h3>
<p>If you&#8217;re the only person that needs to access the Wordpress Admin Panel and you do so from one location, then it might be worth denying access to all other IP addresses. Your IP address can be found at What is My IP then add the following to your .htaccess file, located in the wp-admin directory (If no file exists then create a plain text file, name it .htaccess and upload it to that directory). The xx below need to be replaced with your IP address.</p>
<blockquote><p>allow from xx.xx.xx.xx<br />
deny from all</p></blockquote>
<h3>Remove the readme.html folder from your Wordpress root directory</h3>
<p>There&#8217;s no need to have this on your server and it can contain version numbers and other useful info for hackers. Best to simply delete it.</p>


<!-- Begin SexyBookmarks Menu Code -->
<div class="sexy-bookmarks sexy-bookmarks-expand sexy-bookmarks-bg-caring">
<ul class="socials">
		<li class="sexy-delicious">
			<a href="http://del.icio.us/post?url=http://www.daretothink.co.uk/blog/secure-your-wordpress-blog/&amp;title=Secure+your+Wordpress+Blog" rel="nofollow" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="sexy-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://www.daretothink.co.uk/blog/secure-your-wordpress-blog/&amp;title=Secure+your+Wordpress+Blog" rel="nofollow" title="Digg this!">Digg this!</a>
		</li>
		<li class="sexy-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://www.daretothink.co.uk/blog/secure-your-wordpress-blog/&amp;title=Secure+your+Wordpress+Blog" rel="nofollow" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="sexy-twitter">
			<a href="http://twitter.com/home?status=Secure+your+Wordpress+Blog+-+http://tinyurl.com/ox57nn+(via+@daretothink)" rel="nofollow" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="sexy-mail">
			<a href="mailto:?subject=%22Secure%20your%20Wordpress%20Blog%22&amp;body=I%20thought%20this%20article%20might%20interest%20you.%0A%0A%22When%20anything%20gets%20big%20and%20popular%20there%20are%20always%20unscrupulous%20folk%20out%20there%20wanting%20to%20hack%20your%20site%20or%20as%20they%20put%20it%20showing%20you%20the%20security%20downfalls%20of%20the%20software.%20With%20that%20in%20mind%20you%27ll%20need%20to%20secure%20your%20Wordpress%20Site%20so%20they%20can%27t%20get%20in%20and%20ruin%20your%20site.%20There%27s%20a%20number%20of%20ste%22%0A%0AYou%20can%20read%20the%20full%20article%20here%3A%20http://www.daretothink.co.uk/blog/secure-your-wordpress-blog/" rel="nofollow" title="Email this to a friend?">Email this to a friend?</a>
		</li>
		<li class="sexy-comfeed">
			<a href="http://www.daretothink.co.uk/blog/secure-your-wordpress-blog/feed" rel="nofollow" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a>
		</li>
		<li class="sexy-reddit">
			<a href="http://reddit.com/submit?url=http://www.daretothink.co.uk/blog/secure-your-wordpress-blog/&amp;title=Secure+your+Wordpress+Blog" rel="nofollow" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="sexy-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://www.daretothink.co.uk/blog/secure-your-wordpress-blog/&amp;t=Secure+your+Wordpress+Blog" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="sexy-linkedin">
			<a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://www.daretothink.co.uk/blog/secure-your-wordpress-blog/&amp;title=Secure+your+Wordpress+Blog&amp;summary=When%20anything%20gets%20big%20and%20popular%20there%20are%20always%20unscrupulous%20folk%20out%20there%20wanting%20to%20hack%20your%20site%20or%20as%20they%20put%20it%20showing%20you%20the%20security%20downfalls%20of%20the%20software.%20With%20that%20in%20mind%20you%27ll%20need%20to%20secure%20your%20Wordpress%20Site%20so%20they%20can%27t%20get%20in%20and%20ruin%20your%20site.%20There%27s%20a%20number%20of%20ste&amp;source=Dare to Think | Web Design, Blog Development, Hosting and Print and Print made Simple" rel="nofollow" title="Share this on Linkedin">Share this on Linkedin</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>
<!-- End SexyBookmarks Menu Code -->



<p>Related posts:<ol><li><a href='http://www.daretothink.co.uk/blog/10-tips-to-clean-optimize-and-speed-up-your-wordpress-site/' rel='bookmark' title='Permanent Link: 10 Tips to Clean, Optimize and Speed up your Wordpress Site'>10 Tips to Clean, Optimize and Speed up your Wordpress Site</a></li>
<li><a href='http://www.daretothink.co.uk/blog/backup-your-website-using-cpanel/' rel='bookmark' title='Permanent Link: Backing up your Website using cPanel'>Backing up your Website using cPanel</a></li>
<li><a href='http://www.daretothink.co.uk/blog/iphone-to-mac-wireless-networking/' rel='bookmark' title='Permanent Link: iPhone to Mac Wireless Networking'>iPhone to Mac Wireless Networking</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.daretothink.co.uk/blog/secure-your-wordpress-blog/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Useful Wordpress Snippets</title>
		<link>http://www.daretothink.co.uk/blog/useful-wordpress-snippets/</link>
		<comments>http://www.daretothink.co.uk/blog/useful-wordpress-snippets/#comments</comments>
		<pubDate>Sun, 21 Mar 2010 11:40:33 +0000</pubDate>
		<dc:creator>alan</dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.daretothink.co.uk/?p=1295</guid>
		<description><![CDATA[There&#8217;s lots and lots of things to remember when using Wordpress and you can&#8217;t remember everything. Here&#8217;s a list of useful little snippets that I&#8217;ll keep on adding to over time. To be honest it&#8217;s more for my record as it&#8217;s stuff that I use regularly but thought I&#8217;d add for all to share.
Wordpress Cheat [...]


Related posts:<ol><li><a href='http://www.daretothink.co.uk/blog/10-tips-to-clean-optimize-and-speed-up-your-wordpress-site/' rel='bookmark' title='Permanent Link: 10 Tips to Clean, Optimize and Speed up your Wordpress Site'>10 Tips to Clean, Optimize and Speed up your Wordpress Site</a></li>
<li><a href='http://www.daretothink.co.uk/blog/remove-the-wordpress-meta-tag-from-your-blog/' rel='bookmark' title='Permanent Link: Remove the Wordpress Meta Tag from your Blog'>Remove the Wordpress Meta Tag from your Blog</a></li>
<li><a href='http://www.daretothink.co.uk/blog/secure-your-wordpress-blog/' rel='bookmark' title='Permanent Link: Secure your Wordpress Blog'>Secure your Wordpress Blog</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s lots and lots of things to remember when using Wordpress and you can&#8217;t remember everything. Here&#8217;s a list of useful little snippets that I&#8217;ll keep on adding to over time. To be honest it&#8217;s more for my record as it&#8217;s stuff that I use regularly but thought I&#8217;d add for all to share.<span id="more-1295"></span></p>
<h2>Wordpress Cheat sheets</h2>
<p>Not so much cheating as great reference guides. There are lots and lots of useful Wordpress tags that you can add to pages and templates. Here are a couple of great Wordpress Cheat Sheets:</p>
<p><a title="Wordpress Visual Cheat Sheet" href="http://woorkup.com/2009/11/01/wordpress-visual-cheat-sheet/" target="_blank">WordPress Visual Cheat Sheet</a></p>
<p><a title="Free Wordpress Cheat Sheet" href="http://ekinertac.com/?p=259" target="_blank">Free Complete Wordpress Cheat Sheet</a></p>
<h2>Body Class</h2>
<p>Replace the &lt;body&gt; tag with</p>
<pre class="brush: xml;">&lt;body &lt;?php body_class(); ?&gt;&gt;</pre>
<p>This will allow you to change elements on the page on a page-by-page basis simply by referencing the body in your CSS. For example you may see this, when you view the source code of your live page:</p>
<p>&lt;body class=&#8221;page page-id-2 page-template page-template-default logged-in&#8221;&gt;</p>
<p>which would then allow you to target elements on that specific page in your CSS.</p>
<p>For more information visit the <a href="http://codex.wordpress.org/Template_Tags/body_class" target="_blank">Official Wordpress page</a>.</p>
<h2>Custom field in Wordpress template</h2>
<p>Adds a field within your template that will show custom bits of text, images etc that you add from within the post/page admin. Add the code to your template e.g.</p>
<pre class="brush: php;">&lt;?php echo get_post_meta($post-&gt;ID, 'custom-field-name', true); ?&gt;</pre>
<p>Then add a new custom field to your page/post and add the name e.g. custom-field-name.</p>
<h2>Custom field in Wordpress template with if else statement</h2>
<p>There are situations where you need to see whether the custom field has content of a certain criteria and then display something else.</p>
<p>In this example the &#8220;custom-field-name&#8221; is the name of the custom field you are calling. If the content of that custom field contains &#8220;London&#8221; then the outputted text will show as &#8220;capital of England&#8221;. If &#8220;Edinburgh&#8221; then the content will be &#8220;capital of Scotland&#8221;. If no content exists in that custom field then the text &#8220;No capitals&#8221; will be displayed.</p>
<pre class="brush: php;">&lt;?php
$key = 'custom-field-name';
$themeta = get_post_meta($post-&amp;gt;ID, $key, TRUE);
if ($themeta == 'London'){
echo 'capital of England';
} else if ($themeta == 'Edinburgh') {
echo 'capital of Scotland';
} else {
echo 'No capitals';
}
?&gt;</pre>
<h2>If Else Wordpress</h2>
<p>The following code will add tags to the post, if there are any, if there&#8217;s not then it will add a bit of text. This function can be used in lots of different ways and is incredibly useful.</p>
<pre class="brush: php;">&lt;?php if (has_tag()) : ?&gt;
&lt;div&gt;&lt;?php the_tags('Tagged with: ',' / ','&lt;br /&gt;'); ?&gt;&lt;/div&gt;
&lt;?php else : ?&gt;
&lt;div&gt;Sorry, no tags here!&lt;/div&gt;
&lt;?php endif; ?&gt;</pre>
<p>Another example is that if you want to continually add elseif statements:</p>
<pre class="brush: php;">&lt;?php
if (is_page('about')) {
get_sidebar('about');
} elseif (is_page('what-we-do')) {
get_sidebar('blog');
} else {
get_sidebar('page');
}
?&gt;</pre>
<h2>Wrap your Custom Field in DIV tags</h2>
<p>It&#8217;s straight forward to show your custom field using the code mentioned above but what it would like to wrap that custom field in DIV tags or Paragraph tags or whatever else you fancy. Here&#8217;s a few options:</p>
<p>Display and wrap the custom field named &#8220;custom-field-name&#8221; in the div class &#8220;my-class&#8221;. If there&#8217;s no Custom Field by that name or nothing is entered in that field then display the text &#8220;No Custom Field here&#8221;.</p>
<pre class="brush: php;">&lt;?php $customfield = get_post_meta($post-&gt;ID, 'custom-field-name', true);
if ($customfield) {
?&gt;
&lt;?php echo '&lt;div class=&quot;my-class&quot;&gt;'.$customfield.'&lt;/div&gt;'; ?&gt;
&lt;?php } else { ?&gt;
&lt;div class=&quot;my-class&quot;&gt;No Custom Field here&lt;/div&gt;
&lt;?php } ?&gt;</pre>
<p>The following will only show the Custom field if it exists. It will also be wrapped in list tags. If not then nothing will be shown:</p>
<pre class="brush: php;">&lt;?php $customfield = get_post_meta($post-&gt;ID, 'custom-field-name', true);
if ($customfield) {
?&gt;
&lt;?php echo '&lt;li&gt;'.$customfield.'&lt;/li&gt;';
}?&gt;</pre>
<h2>Conditional tags</h2>
<p>Useful tags for use in your Wordpress templates: <a title="Wordpress Conditional Tags for Templates" href="http://codex.wordpress.org/Conditional_Tags" target="_blank">http://codex.wordpress.org/Conditional_Tags</a></p>
<h2>Control the amount of posts per page/category/search or archive</h2>
<p>Open the Wordpress template file and locate the following:</p>
<pre class="brush: php;">&lt;?php if (have_posts()) : while (have_posts()) : the_post(); ?&gt;</pre>
<p>and add the following code directly above:</p>
<pre class="brush: php;">&lt;?php $posts=query_posts($query_string . '&amp;posts_per_page=-1'); ?&gt;</pre>
<p>The -1 indicates an infinite amount of posts &#8211; you can change this to whatever amount you&#8217;d like to appear. Bear in mind the page load time and file size if using an infinite amount.</p>
<h2>Get all Sticky Posts</h2>
<p>Insert this code into your template file to display all of your Sticky Posts</p>
<pre class="brush: php;">&lt;?php query_posts(array('post__in'=&gt;get_option('sticky_posts'))); ?&gt;</pre>
<h2>Execute shortcode inside custom field</h2>
<p>Allows shortcode to be used inside a custom field</p>
<pre class="brush: php;">&lt;?php echo apply_filters('the_content', get_post_meta($post-&gt;ID, 'custom-field-name', true)); ?&gt;</pre>


<!-- Begin SexyBookmarks Menu Code -->
<div class="sexy-bookmarks sexy-bookmarks-expand sexy-bookmarks-bg-caring">
<ul class="socials">
		<li class="sexy-delicious">
			<a href="http://del.icio.us/post?url=http://www.daretothink.co.uk/blog/useful-wordpress-snippets/&amp;title=Useful+Wordpress+Snippets" rel="nofollow" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="sexy-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://www.daretothink.co.uk/blog/useful-wordpress-snippets/&amp;title=Useful+Wordpress+Snippets" rel="nofollow" title="Digg this!">Digg this!</a>
		</li>
		<li class="sexy-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://www.daretothink.co.uk/blog/useful-wordpress-snippets/&amp;title=Useful+Wordpress+Snippets" rel="nofollow" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="sexy-twitter">
			<a href="http://twitter.com/home?status=Useful+Wordpress+Snippets+-+http://bit.ly/cXkIv9+(via+@daretothink)" rel="nofollow" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="sexy-mail">
			<a href="mailto:?subject=%22Useful%20Wordpress%20Snippets%22&amp;body=I%20thought%20this%20article%20might%20interest%20you.%0A%0A%22There%27s%20lots%20and%20lots%20of%20things%20to%20remember%20when%20using%20Wordpress%20and%20you%20can%27t%20remember%20everything.%20Here%27s%20a%20list%20of%20useful%20little%20snippets%20that%20I%27ll%20keep%20on%20adding%20to%20over%20time.%20To%20be%20honest%20it%27s%20more%20for%20my%20record%20as%20it%27s%20stuff%20that%20I%20use%20regularly%20but%20thought%20I%27d%20add%20for%20all%20to%20share.%0D%0AWordpress%20%22%0A%0AYou%20can%20read%20the%20full%20article%20here%3A%20http://www.daretothink.co.uk/blog/useful-wordpress-snippets/" rel="nofollow" title="Email this to a friend?">Email this to a friend?</a>
		</li>
		<li class="sexy-comfeed">
			<a href="http://www.daretothink.co.uk/blog/useful-wordpress-snippets/feed" rel="nofollow" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a>
		</li>
		<li class="sexy-reddit">
			<a href="http://reddit.com/submit?url=http://www.daretothink.co.uk/blog/useful-wordpress-snippets/&amp;title=Useful+Wordpress+Snippets" rel="nofollow" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="sexy-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://www.daretothink.co.uk/blog/useful-wordpress-snippets/&amp;t=Useful+Wordpress+Snippets" rel="nofollow" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="sexy-linkedin">
			<a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://www.daretothink.co.uk/blog/useful-wordpress-snippets/&amp;title=Useful+Wordpress+Snippets&amp;summary=There%27s%20lots%20and%20lots%20of%20things%20to%20remember%20when%20using%20Wordpress%20and%20you%20can%27t%20remember%20everything.%20Here%27s%20a%20list%20of%20useful%20little%20snippets%20that%20I%27ll%20keep%20on%20adding%20to%20over%20time.%20To%20be%20honest%20it%27s%20more%20for%20my%20record%20as%20it%27s%20stuff%20that%20I%20use%20regularly%20but%20thought%20I%27d%20add%20for%20all%20to%20share.%0D%0AWordpress%20&amp;source=Dare to Think | Web Design, Blog Development, Hosting and Print and Print made Simple" rel="nofollow" title="Share this on Linkedin">Share this on Linkedin</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>
<!-- End SexyBookmarks Menu Code -->



<p>Related posts:<ol><li><a href='http://www.daretothink.co.uk/blog/10-tips-to-clean-optimize-and-speed-up-your-wordpress-site/' rel='bookmark' title='Permanent Link: 10 Tips to Clean, Optimize and Speed up your Wordpress Site'>10 Tips to Clean, Optimize and Speed up your Wordpress Site</a></li>
<li><a href='http://www.daretothink.co.uk/blog/remove-the-wordpress-meta-tag-from-your-blog/' rel='bookmark' title='Permanent Link: Remove the Wordpress Meta Tag from your Blog'>Remove the Wordpress Meta Tag from your Blog</a></li>
<li><a href='http://www.daretothink.co.uk/blog/secure-your-wordpress-blog/' rel='bookmark' title='Permanent Link: Secure your Wordpress Blog'>Secure your Wordpress Blog</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.daretothink.co.uk/blog/useful-wordpress-snippets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
