<?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>Swift Themes &#187; Hacks</title>
	<atom:link href="http://swiftthemes.com/category/wordpress/hacks/feed/" rel="self" type="application/rss+xml" />
	<link>http://swiftthemes.com</link>
	<description>The fastest loading, premium quality free wordpress themes</description>
	<lastBuildDate>Sun, 05 Feb 2012 19:23:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Fix for 404 error while updating and editing posts</title>
		<link>http://swiftthemes.com/2010/06/wordpress/fix-for-404-error-while-updating-and-editing-posts/</link>
		<comments>http://swiftthemes.com/2010/06/wordpress/fix-for-404-error-while-updating-and-editing-posts/#comments</comments>
		<pubDate>Sun, 27 Jun 2010 05:00:06 +0000</pubDate>
		<dc:creator>Satish</dc:creator>
				<category><![CDATA[Hacks]]></category>
		<category><![CDATA[How to]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[404 error]]></category>
		<category><![CDATA[Bugs]]></category>
		<category><![CDATA[post update error]]></category>
		<category><![CDATA[WordPress Troubleshooting]]></category>

		<guid isPermaLink="false">http://swiftthemes.com/?p=760</guid>
		<description><![CDATA[Yesterday when I was trying to publish a post it was redirecting me to 404 error page. The problem was with only one particular page and it was some way related to the post content. I was able to save the post when I removed some part of the post. I tried a lot of [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://swiftthemes.com/blog/wp-content/uploads/2010/06/404-error.png"><img class="aligncenter size-full wp-image-762" title="404-error" src="http://swiftthemes.com/blog/wp-content/uploads/2010/06/404-error.png" alt="" width="580" height="387" /></a></p>
<p>Yesterday when I was trying to publish a post it was redirecting me to 404 error page. The problem was with only one particular page and it was some way related to the post content. I was able to save the post when I removed some part of the post. I tried a lot of things like</p>
<ul>
<li>Disabling plugins</li>
<li>Activating the default theme</li>
<li>Updating and reinstalling WordPress</li>
<li>Rewriting htaccess and updating permalinks</li>
</ul>
<p>Nothing helped, some of the threads on this problem referred to <strong>mod_security rules</strong>. The problem was due to the mod security rules. As my post had some strings that directly relate to security issues.  These  obviously triggered some mod_security rules I had to disable mod_security rules temporarily to publish the post.</p>
<p>This is what I added to /<strong>usr/local/apache/conf/modsec2/whitelist.conf</strong>, (location may be different in your case)</p>
<p>[code]</p>
<p>&lt;LocationMatch &quot;/wp-admin/*&quot;&gt;<br />
 SecRuleRemoveById 300015<br />
&lt;/LocationMatch&gt;</p>
<p>[/code]</p>
<p>If don&#8217;t have the permissions to edit mod_security rules, ask your hosting support team to update them for you. You may want to show this post as reference to them.</p>
]]></content:encoded>
			<wfw:commentRss>http://swiftthemes.com/2010/06/wordpress/fix-for-404-error-while-updating-and-editing-posts/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>[Security Risk] Add this fix asap</title>
		<link>http://swiftthemes.com/2009/10/wordpress-themes/security-risk-add-this-fix-asap/</link>
		<comments>http://swiftthemes.com/2009/10/wordpress-themes/security-risk-add-this-fix-asap/#comments</comments>
		<pubDate>Sun, 11 Oct 2009 15:55:38 +0000</pubDate>
		<dc:creator>Satish</dc:creator>
				<category><![CDATA[Free Themes]]></category>
		<category><![CDATA[Hacks]]></category>
		<category><![CDATA[Themes]]></category>
		<category><![CDATA[Bugs]]></category>
		<category><![CDATA[Swift]]></category>

		<guid isPermaLink="false">http://swiftthemes.com/?p=213</guid>
		<description><![CDATA[There is an XSS vulnerability in SWIFT, you should fix it asap.
Even if you are not a swift user you should check your theme for the following vulnerability and fix it.]]></description>
			<content:encoded><![CDATA[<p>There is an XSS vulnerability in SWIFT, replace the search.php file with this <strong><a href="http://swiftthemes.com/blog/wp-content/uploads/2009/10/search.zip">search.php</a></strong>.</p>
<p>In case if you are using version less than 2.1.4, or If you don&#8217;t want to lose the customization you did find this in <strong>&lt;?php echo $_GET['s']; ?&gt;</strong> search.php  and replace it with (There are 2 occurences)</p>
<p>[php]&lt;?php the_search_query(); ?&gt;[/php]</p>
<p><strong>Even if you are not a swift user you should check your theme for the following vulnerability and fix it ASAP.</strong><br />
Search for something like this in your theme’s PHP files:</p>
<p>[php]Search results for &quot;&lt;?php echo $_GET['s']; ?&gt;&quot;[/php]</p>
<p>and replace with</p>
<p>[php]Search results for &quot;&lt;?php the_search_query(); ?&gt;&quot;[/php]</p>
<blockquote><p><span style="color: #ff0000;">Note: This vulnerability is taken care in version 3.1.7, so you dont have to do any modifications.</span></p></blockquote>
<p>Thanks to <a href="http://www.reneschmidt.de/">Rene Schmidt</a> for reporting this vulnerability.</p>
]]></content:encoded>
			<wfw:commentRss>http://swiftthemes.com/2009/10/wordpress-themes/security-risk-add-this-fix-asap/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Ultimate method to add post thumbanils to your wordpress theme</title>
		<link>http://swiftthemes.com/2009/10/wordpress/best-way-to-add-post-thumbanils-to-your-wordpress-theme/</link>
		<comments>http://swiftthemes.com/2009/10/wordpress/best-way-to-add-post-thumbanils-to-your-wordpress-theme/#comments</comments>
		<pubDate>Sat, 03 Oct 2009 17:22:43 +0000</pubDate>
		<dc:creator>Satish</dc:creator>
				<category><![CDATA[Hacks]]></category>
		<category><![CDATA[How to]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Themes]]></category>
		<category><![CDATA[wordpress how-to]]></category>
		<category><![CDATA[wordpress images]]></category>
		<category><![CDATA[wordpress thumbnails]]></category>
		<category><![CDATA[WordPress Tips]]></category>

		<guid isPermaLink="false">http://swiftthemes.com/?p=160</guid>
		<description><![CDATA[In this tutorial, I will show you the best method to add post thumbnail feature to your wordpress theme. This is what we are going to do. We will check if there is any image set in custom fields, if yes we display that image. Else we check if there is any image stored in [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_171" class="wp-caption alignright" style="width: 290px"><a href="http://swiftthemes.com/blog/wp-content/uploads/2009/10/post-image-thumb.png"><img class="size-full wp-image-171" title="post-image-thumb" src="http://swiftthemes.com/blog/wp-content/uploads/2009/10/post-image-thumb.png" alt="Wordpress Hacks" width="280" height="150" /></a><p class="wp-caption-text">Wordpress Hacks</p></div>
<p>In this tutorial, I will show you the best method to add <strong>post thumbnail</strong> feature to your wordpress theme. This is what we are going to do.</p>
<ol>
<li>We will check if there is any image set in <strong>custom fields</strong>, if yes we display that image.</li>
<li>Else we check if there is any image stored in the gallery associated with that post, if found we display that image.</li>
<li>Else we do a <strong>pattern match for image url&#8217;s</strong> over the post content and extract the images used in the post, with this method we will be able to pull out images that are not part of wordpress gallery.</li>
</ol>
<h2>How to create a custom field?</h2>
<p>To do this, simply start making a New Post, and scroll down the page until you see “<strong>Advanced Options</strong>“.  Under this heading, you should see something like, <em>Excerpt, Trackback, and <strong>Custom Fields</strong>.</em></p>
<div id="attachment_163" class="wp-caption aligncenter" style="width: 570px"><a href="http://swiftthemes.com/blog/wp-content/uploads/2009/10/wordpress-custom-fields.png"><img class="size-medium wp-image-163" title="wordpress-custom-fields" src="http://swiftthemes.com/blog/wp-content/uploads/2009/10/wordpress-custom-fields-560x163.png" alt="Adding post thumbnails using wordpress custom fields" width="560" height="163" /></a><p class="wp-caption-text">Adding post thumbnails using wordpress custom fields</p></div>
<p>To add a Custom Field for a Thumbnail, just fill in the <em><strong>Key</strong></em> with “image”.  For the <em><strong>Value</strong></em>, post the full URL of the thumbnail you would like to use.</p>
<p>Click Add Custom Field, and it will apply to that post.</p>
<h2>Adding thumbnail to our post</h2>
<p>Add the following code before<br />
<strong>the_content() / excerpt()</strong></p>
<p>[php]<br />
&lt;?php<br />
 //Getting the image url from custom field<br />
 $img = get_post_meta($post-&gt;;ID, &#8216;image&#8217;, $single = true);<br />
 /*If the custom field url is empty, then we look for<br />
 images stored in galler associated with the post. If<br />
 there are no images associated with the gallery we<br />
 proceed further and do a pattern matching to identify<br />
 images in the post content.<br />
 */<br />
 if(!$img){<br />
 //Get images attached to the post<br />
 $args = array(<br />
 &#8216;post_type&#8217; =&gt; &#8216;attachment&#8217;,<br />
 &#8216;post_mime_type&#8217; =&gt; &#8216;image&#8217;,<br />
 &#8216;numberposts&#8217; =&gt; -1,<br />
 &#8216;order&#8217; =&gt; &#8216;ASC&#8217;,<br />
 &#8216;post_status&#8217; =&gt; null,<br />
 &#8216;post_parent&#8217; =&gt; $post-&gt;ID);<br />
 $attachments = get_posts($args);<br />
 if ($attachments) {<br />
 foreach ($attachments as $attachment)<br />
 $img = wp_get_attachment_thumb_url( $attachment-&gt;ID );<br />
 }<br />
 else{<br />
 //Extracting the content of the post to do a pattern match<br />
 $content = $post-&gt;post_content;<br />
 //A simple regular expression to identify image urls.<br />
 $searchimages = &#8216;~http://[^&gt;]*.(jpg|jpeg|gif|png)~&#8217;;<br />
 preg_match( $searchimages, $content, $pics );<br />
 $iNumberOfPics = count($pics[0]);<br />
 if ( $iNumberOfPics &gt; 0 )<br />
 $img=$pics[0];<br />
 }<br />
 }<br />
 /*If we get a image url in any of the above steps, we echo the<br />
 following code to display the image. set the height or width<br />
 attribute so that image doesn&#8217;t break the layout and doesnt look<br />
 distorted.<br />
 */<br />
if($img){?&gt;&lt;img src=&quot;&lt;?php echo $img;$img=NULL; ?&gt;&quot;   height=&quot;150&quot;/&gt;&lt;?php }<br />
?&gt;<br />
[/php]</p>
]]></content:encoded>
			<wfw:commentRss>http://swiftthemes.com/2009/10/wordpress/best-way-to-add-post-thumbanils-to-your-wordpress-theme/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Served from: swiftthemes.com @ 2012-02-07 19:58:01 -->
