<?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>WordPress Craftsman &#187; Snippets</title>
	<atom:link href="https://www.wpcraftsman.com/category/snippets/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.wpcraftsman.com</link>
	<description>WordPress developer offering code snippets, tips and expert advice</description>
	<lastBuildDate>Sun, 01 Dec 2024 22:08:29 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=3.7.33</generator>
	<item>
		<title>Developer bookmarks</title>
		<link>https://www.wpcraftsman.com/developer-bookmarks/</link>
		<comments>https://www.wpcraftsman.com/developer-bookmarks/#comments</comments>
		<pubDate>Sun, 12 Jul 2015 18:44:27 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Snippets]]></category>
		<category><![CDATA[Bookmarks]]></category>
		<category><![CDATA[Codex]]></category>
		<category><![CDATA[WordPress Developer]]></category>

		<guid isPermaLink="false">http://www.wpcraftsman.com/?p=541</guid>
		<description><![CDATA[Here are a couple of quick-access bookmarks that perform searches directly on WordPress&#8217; Developer Resources. I like to have these handy for quick lookups; they simply prompt me for an input string and go straight to WP search results. (You may need to enable JavaScript within your browser&#8217;s URL bar.) First, a good one to [&#8230;]]]></description>
		<wfw:commentRss>https://www.wpcraftsman.com/developer-bookmarks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Improving Nonce Security</title>
		<link>https://www.wpcraftsman.com/improving-nonce-security/</link>
		<comments>https://www.wpcraftsman.com/improving-nonce-security/#comments</comments>
		<pubDate>Thu, 15 Jan 2015 22:36:10 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Snippets]]></category>
		<category><![CDATA[nonce]]></category>

		<guid isPermaLink="false">http://www.wpcraftsman.com/?p=164</guid>
		<description><![CDATA[WordPress nonces are pretty good at ensuring your ajax calls and form submissions are legit. A nonce is a coded string generated by incorporating the (logged-in) user ID, the $action string, and a timestamp-based &#8220;tick&#8221; value. The &#8220;tick&#8221; changes (globally) every 48 hours by default. The nonce key is unique for each logged-in user. However, [&#8230;]]]></description>
		<wfw:commentRss>https://www.wpcraftsman.com/improving-nonce-security/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Image Upload Adjustments</title>
		<link>https://www.wpcraftsman.com/image-upload-adjustments/</link>
		<comments>https://www.wpcraftsman.com/image-upload-adjustments/#comments</comments>
		<pubDate>Wed, 14 Jan 2015 00:13:15 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Snippets]]></category>
		<category><![CDATA[crop]]></category>
		<category><![CDATA[image sizes]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[upload]]></category>

		<guid isPermaLink="false">http://www.wpcraftsman.com/?p=151</guid>
		<description><![CDATA[When uploading images, WordPress&#8217; default behavior is to skip any defined image size if the uploaded image is too small to fill it. If the image&#8217;s width or height (but not both) is big enough, WP shrinks to fit within the rectangle but does not fill it. When both the width and height are big [&#8230;]]]></description>
		<wfw:commentRss>https://www.wpcraftsman.com/image-upload-adjustments/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Preload Images</title>
		<link>https://www.wpcraftsman.com/preload-images/</link>
		<comments>https://www.wpcraftsman.com/preload-images/#comments</comments>
		<pubDate>Tue, 13 Jan 2015 21:15:45 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Essentials]]></category>
		<category><![CDATA[Snippets]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.wpcraftsman.com/?p=141</guid>
		<description><![CDATA[Here&#8217;s an easy way to manage your image preloads from anywhere in your PHP functions. We can simply build a globalized array of all image sources prior to outputting the page, then hook into the wp_footer action to output the required Javascript. Each time your code encounters an image source that must be preloaded, simply [&#8230;]]]></description>
		<wfw:commentRss>https://www.wpcraftsman.com/preload-images/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Admin-triggered e-mail</title>
		<link>https://www.wpcraftsman.com/admin-triggered-e-mail/</link>
		<comments>https://www.wpcraftsman.com/admin-triggered-e-mail/#comments</comments>
		<pubDate>Fri, 09 Jan 2015 00:23:31 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Snippets]]></category>
		<category><![CDATA[admin]]></category>
		<category><![CDATA[capability]]></category>
		<category><![CDATA[e-mail]]></category>
		<category><![CDATA[metaboxes]]></category>
		<category><![CDATA[PHPMailer]]></category>
		<category><![CDATA[ThickBox]]></category>
		<category><![CDATA[wp_editor]]></category>

		<guid isPermaLink="false">http://www.wpcraftsman.com/?p=117</guid>
		<description><![CDATA[Here&#8217;s something that touches on lots of topics. A &#8216;send e-mail&#8217; button within an admin panel, that opens up a ThickBox window with a standalone form and wp_editor. The metabox This requires two functions: one hooked into &#8216;add_meta_boxes&#8217; which calls the second, the metabox output function: Most of the second function builds the URL for [&#8230;]]]></description>
		<wfw:commentRss>https://www.wpcraftsman.com/admin-triggered-e-mail/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Conditional Excerpt Function</title>
		<link>https://www.wpcraftsman.com/conditional-excerpt-function/</link>
		<comments>https://www.wpcraftsman.com/conditional-excerpt-function/#comments</comments>
		<pubDate>Wed, 07 Jan 2015 21:35:01 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Essentials]]></category>
		<category><![CDATA[Snippets]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[excerpt]]></category>
		<category><![CDATA[more]]></category>

		<guid isPermaLink="false">http://www.wpcraftsman.com/?p=107</guid>
		<description><![CDATA[I use this function on practically every site that has any posts/archives section. This enables us to display a standardized excerpt inside or outside the Loop. Arguments (all optional): $ex_length the word count $postref the post or text to excerpt. Can be an ID, a post object, a block of text, or if called within [&#8230;]]]></description>
		<wfw:commentRss>https://www.wpcraftsman.com/conditional-excerpt-function/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Disabling autosave</title>
		<link>https://www.wpcraftsman.com/disabling-autosave/</link>
		<comments>https://www.wpcraftsman.com/disabling-autosave/#comments</comments>
		<pubDate>Tue, 06 Jan 2015 00:29:13 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Essentials]]></category>
		<category><![CDATA[Snippets]]></category>
		<category><![CDATA[admin]]></category>
		<category><![CDATA[autosave]]></category>
		<category><![CDATA[custom post type]]></category>
		<category><![CDATA[post type]]></category>

		<guid isPermaLink="false">http://www.wpcraftsman.com/?p=97</guid>
		<description><![CDATA[You may already know, custom post types are the real workhorses of most customized WordPress themes. But often, they&#8217;re not meant to be read by the public; they&#8217;re functional things like &#8216;albums&#8217; or &#8216;reservations&#8217; or &#8216;index cards.&#8217; By default, WordPress tries to create auto-drafts of any post type when an author is adding / editing [&#8230;]]]></description>
		<wfw:commentRss>https://www.wpcraftsman.com/disabling-autosave/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Draft status highlighting</title>
		<link>https://www.wpcraftsman.com/draft-status-highlighting/</link>
		<comments>https://www.wpcraftsman.com/draft-status-highlighting/#comments</comments>
		<pubDate>Mon, 05 Jan 2015 22:44:24 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Snippets]]></category>
		<category><![CDATA[admin]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[lists]]></category>
		<category><![CDATA[pagenow]]></category>
		<category><![CDATA[typenow]]></category>

		<guid isPermaLink="false">http://www.wpcraftsman.com/?p=78</guid>
		<description><![CDATA[A client wanted to display items with &#8216;Draft&#8217; status differently (gray color) in the admin list pages. Some might argue I&#8217;m a sloppy coder for using inline CSS, but there&#8217;s something I like about targeted post types, particularly in admin pages. Anyway, here&#8217;s a good example of using the &#8216;admin_footer&#8217; action and certain global variables, [&#8230;]]]></description>
		<wfw:commentRss>https://www.wpcraftsman.com/draft-status-highlighting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>No comments!</title>
		<link>https://www.wpcraftsman.com/no-comments/</link>
		<comments>https://www.wpcraftsman.com/no-comments/#comments</comments>
		<pubDate>Mon, 05 Jan 2015 21:30:16 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Essentials]]></category>
		<category><![CDATA[Snippets]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[comments]]></category>

		<guid isPermaLink="false">http://www.wpcraftsman.com/?p=66</guid>
		<description><![CDATA[WordPress is now commonly used as a content-management system for many websites, without any need for common blog functions. Or, the blog functions are announcement-only, comments are unwelcome. Even if you turn off comments for all posts, the admin backend can still get polluted by robot comment requests. That&#8217;s why it&#8217;s a good idea to [&#8230;]]]></description>
		<wfw:commentRss>https://www.wpcraftsman.com/no-comments/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Members Only</title>
		<link>https://www.wpcraftsman.com/members-only/</link>
		<comments>https://www.wpcraftsman.com/members-only/#comments</comments>
		<pubDate>Thu, 24 Oct 2013 18:37:57 +0000</pubDate>
		<dc:creator><![CDATA[admin]]></dc:creator>
				<category><![CDATA[Snippets]]></category>
		<category><![CDATA[admin]]></category>
		<category><![CDATA[login]]></category>
		<category><![CDATA[members-only]]></category>
		<category><![CDATA[metaboxes]]></category>
		<category><![CDATA[password]]></category>
		<category><![CDATA[WooCommerce]]></category>

		<guid isPermaLink="false">http://www.wpcraftsman.com/?p=44</guid>
		<description><![CDATA[Recently, I was tasked with coding a &#8216;members only&#8217; site which required a login to view all but a few pages. This turned out to be a surprisingly simple task, so I thought I&#8217;d  share the code here. The job broke down into three tasks: Allow anyone who&#8217;s logged in or else redirect to the [&#8230;]]]></description>
		<wfw:commentRss>https://www.wpcraftsman.com/members-only/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
