<?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>Dave Jesch &#187; Dave Jesch</title>
	<atom:link href="http://davejesch.com/author/dave/feed/" rel="self" type="application/rss+xml" />
	<link>http://davejesch.com</link>
	<description>Software Architect</description>
	<lastBuildDate>Sat, 19 May 2012 16:46:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>PHP Vulnerability</title>
		<link>http://davejesch.com/technology/php-vulnerability/</link>
		<comments>http://davejesch.com/technology/php-vulnerability/#comments</comments>
		<pubDate>Tue, 08 May 2012 18:16:45 +0000</pubDate>
		<dc:creator>Dave Jesch</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://davejesch.com/?p=221</guid>
		<description><![CDATA[There&#8217;s a new exploit in PHP that&#8217;s going around. With this vulnerability, you can cause a file to be written to a remote server. This file can have any contents you like. So you can upload a script that will allow you access to a server and then use that script to perform actions on [...]]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s a new exploit in PHP that&#8217;s going around. With this vulnerability, you can cause a file to be written to a remote server. This file can have any contents you like. So you can upload a script that will allow you access to a server and then use that script to perform actions on that server.</p>
<p>To block it is pretty straightforward. Just add the following to your <span class="code">.htaccess</span> file:</p>
<pre class="brush: plain; title: ; notranslate">
RewriteEngine on
RewriteCond %{QUERY_STRING} ^[^=]*$
RewriteCond %{QUERY_STRING} %2d|\- [NC]
RewriteRule .? – [F,L]
</pre>
<p>This vulnerability effects <em>any</em> PHP based web site. So it doesn&#8217;t matter if you&#8217;re using WordPress, Drupal, Joomla or anything else. If your server is set up for PHP running via CGI, then you&#8217;re a potential security risk.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://davejesch.com/wordpress/wordpress-security-using-htaccess/" rel="bookmark" class="crp_title">WordPress Security Using .htaccess</a></li><li><a href="http://davejesch.com/wordpress/wordpress-tech/displaying-post-view-counts/" rel="bookmark" class="crp_title">Displaying Post View Counts</a></li><li><a href="http://davejesch.com/wordpress/wordpress-tech/conditionally-set-debug-mode/" rel="bookmark" class="crp_title">Conditionally Set Debug Mode</a></li><li><a href="http://davejesch.com/wordpress/wordpress-tech/moving-a-wordpress-install-to-another-domain/" rel="bookmark" class="crp_title">Moving a WordPress Install to Another Domain</a></li><li><a href="http://davejesch.com/wordpress/wordpress-tech/local-wordpress-development/" rel="bookmark" class="crp_title">Local WordPress Development</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://davejesch.com/technology/php-vulnerability/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Americans with Disabilities Act and Your Web Site</title>
		<link>http://davejesch.com/technology/americans-with-disabilities-act-and-your-web-site/</link>
		<comments>http://davejesch.com/technology/americans-with-disabilities-act-and-your-web-site/#comments</comments>
		<pubDate>Sat, 17 Mar 2012 20:37:13 +0000</pubDate>
		<dc:creator>Dave Jesch</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://davejesch.com/?p=217</guid>
		<description><![CDATA[On March 15, 2012 some new changes went into effect regarding the Americans with Disabilities Act (ADA) and web site development. Web site accessibility under the Act now apply to both a company&#8217;s web site as well as their online reservation system. The guidelines to meet ADA accessibility: Design your website design with a consistent [...]]]></description>
			<content:encoded><![CDATA[<p>On March 15, 2012 some new changes went into effect regarding the Americans with Disabilities Act (ADA) and web site development. Web site accessibility under the Act now apply to both a company&#8217;s web site as well as their online reservation system.</p>
<p>The guidelines to meet ADA accessibility:</p>
<ol>
<li>Design your website design with a consistent and clean layout for both content and navigation throughout all pages.</li>
<li>Use clear and consistent language on your website.</li>
<li>Use sufficient color contrast in text and images on your website.</li>
<li>Your website should be designed using valid HTML and be able to pass W3C (World Wide Web consortium) tests for errors.</li>
<li>A person with disabilities should be able to navigate your website using just the keyboard.</li>
</ol>
<p>Additionally, image alt tags (with correct text descriptions) must be used for all images and any visual content on your website. Alt tags also have to be manually evaluated and changed so that they make sense to someone with disabilities. This process is critical for ADA compliance.</p>
<h3>ADA Accessibility online Testing</h3>
<p>Once your website has been modified to comply with ADA guidelines, it must be re-tested. There are a number of online tools that can assist you in this process.</p>
<p>Free tool in Firefox: <a href="http://worldspace.deque.com/FireEyes/login/auth" target="_blank" rel="nofollow">http://worldspace.deque.com/FireEyes/login/auth</a><br />
Free tool in Windows Explorer: <a href="http://www.paciellogroup.com/node/18?q=node%2F22" target="_blank" rel="nofollow">http://www.paciellogroup.com/node/18?q=node%2F22</a></p>
<p>Compliance testing also requires human testing by an ADA compliance expert.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://davejesch.com/technology/facebook-extends-protocol/" rel="bookmark" class="crp_title">Facebook Extends Protocol</a></li><li><a href="http://davejesch.com/technology/seo-workshop/" rel="bookmark" class="crp_title">SEO Workshop</a></li><li><a href="http://davejesch.com/seo/another-seo-meetup/" rel="bookmark" class="crp_title">Another SEO Meetup</a></li><li><a href="http://davejesch.com/wordpress/wordpress-seo-presentation/" rel="bookmark" class="crp_title">WordPress SEO Presentation</a></li><li><a href="http://davejesch.com/technology/page-rank-now-considers-site-speed/" rel="bookmark" class="crp_title">Page Rank Now Considers Site Speed</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://davejesch.com/technology/americans-with-disabilities-act-and-your-web-site/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Conditionally Enqueueing Stylesheets</title>
		<link>http://davejesch.com/wordpress/wordpress-tech/conditionally-enqueueing-stylesheets/</link>
		<comments>http://davejesch.com/wordpress/wordpress-tech/conditionally-enqueueing-stylesheets/#comments</comments>
		<pubDate>Wed, 14 Mar 2012 22:09:32 +0000</pubDate>
		<dc:creator>Dave Jesch</dc:creator>
				<category><![CDATA[WordPress Tech]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://davejesch.com/?p=211</guid>
		<description><![CDATA[I saw this while looking for some other information on enqueueing stylesheets and thought it interesting. You can enqueue CSS style sheets and javascript with similar APIs, as in: wp_register_style($handle, $src, $deps, $ver, $media) and wp_enqueue_style($handle, $src, $deps, $ver, $media). You can look up the WordPress Codex entry for wp_enqueue_script() for more information. After enqueuing [...]]]></description>
			<content:encoded><![CDATA[<p>I saw this while looking for some other information on enqueueing stylesheets and thought it interesting.</p>
<p>You can enqueue CSS style sheets and javascript with similar APIs, as in: <span class="code">wp_register_style($handle, $src, $deps, $ver, $media)</span> and <span class="code">wp_enqueue_style($handle, $src, $deps, $ver, $media)</span>. You can look up the WordPress Codex entry for <a href="http://codex.wordpress.org/Function_Reference/wp_enqueue_script" rel="nofollow"><span class="code">wp_enqueue_script()</span></a> for more information.</p>
<p>After enqueuing the stylesheet, you can add a conditional &#8212; for example, if you want something added for older IE versions, as in the following example:</p>
<pre class="brush: php; title: ; notranslate">
wp_enqueue_style('ie7-style', get_template_directory_uri() . '/ie7.css');

global $wp_styles;
$wp_styles-&gt;add_data('ie7-style', 'conditional', 'lte IE 7');
</pre>
<p>This adds the conditional to the <span class="code">&lt;link&gt;</span> tag so what gets rendered looks something like:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;!--[if lte IE 7]&gt;
&lt;link rel=&quot;stylesheet&quot; href=&quot;http://mydomain.com/wp-content/themes/mytheme/ie7.css&quot; type=&quot;text/css&quot; media=&quot;all&quot;/&gt;
&lt;![endif]--&gt;
</pre>
<p>Personally, I try to avoid requiring conditionals but in some cases it&#8217;s unavoidable. This is a nice way to do it and still use the recommended WordPress APIs for your scripts, so your <a href="http://davejesch.com/services/wordpress-theme-developer/">theme</a> or <a href="http://davejesch.com/services/wordpress-plugin-developer/">plugin</a> will work nicely with others.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://davejesch.com/wordpress/wordpress-tech/custom-user-data/" rel="bookmark" class="crp_title">Custom User Data</a></li><li><a href="http://davejesch.com/wordpress/wordpress-tech/local-wordpress-development/" rel="bookmark" class="crp_title">Local WordPress Development</a></li><li><a href="http://davejesch.com/wordpress/tracking-form-submisstions-using-google-analytics/" rel="bookmark" class="crp_title">Tracking Form Submisstions Using Google Analytics</a></li><li><a href="http://davejesch.com/technology/optimizing-page-speed/" rel="bookmark" class="crp_title">Optimizing Page Speed</a></li><li><a href="http://davejesch.com/wordpress/wordpress-tech/plugin-custom-post-type-ui/" rel="bookmark" class="crp_title">Plugin: Custom Post Type UI</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://davejesch.com/wordpress/wordpress-tech/conditionally-enqueueing-stylesheets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress Constants</title>
		<link>http://davejesch.com/wordpress/wordpress-tech/wordpress-constants/</link>
		<comments>http://davejesch.com/wordpress/wordpress-tech/wordpress-constants/#comments</comments>
		<pubDate>Thu, 09 Feb 2012 00:55:04 +0000</pubDate>
		<dc:creator>Dave Jesch</dc:creator>
				<category><![CDATA[WordPress Tech]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://davejesch.com/?p=204</guid>
		<description><![CDATA[WordPress makes use of a number of constants to control its behavior. Below, I&#8217;ve listed a number of these and how they are used within the WordPress system &#8211; along with reasons why you might changes their values to customize how your web site behaves. What are Constants? Many programming languages have the concept of [...]]]></description>
			<content:encoded><![CDATA[<p>WordPress makes use of a number of constants to control its behavior. Below, I&#8217;ve listed a number of these and how they are used within the WordPress system &#8211; along with reasons why you might changes their values to customize how your web site behaves.</p>
<h3>What are Constants?</h3>
<p>Many programming languages have the concept of a constant. This is like a variable, but once set it&#8217;s value never changes &#8212; making it a constant. You can go here for more information on <a href="http://us3.php.net/manual/en/function.define.php" rel="nofollow">defining Constants in PHP</a>.</p>
<h3>Where are They Used?</h3>
<p>Constants can be used almost anywhere. However, they are most often declared early on in the processing of a PHP script. The reason for this is that if they&#8217;re not you may need to check to make sure if the constant exists before using it. This is easily done using the <a href="http://us3.php.net/manual/en/function.defined.php" rel="nofollow"><span class="code">defined()</span></a> function. An example of this can be found below.</p>
<p>WordPress declares most of its constants in the <span class="code">wp-config.php</span> file. You can declare a constant in a plugin, which is loaded much later on in the WordPress bootstrap process, but if you do that you should definitely check to see if the constant has already been declared. Once declared, you cannot change the value of a constant &#8212; this is what makes them <em>constant</em>.</p>
<h3>Why Would You Use Constants?</h3>
<p>Using constants, you can reduce your plugin footprint. Since many parts of the WordPress core code make use of these, it can reduce the amount of code you need to write for some operations.</p>
<p>Constants are great for optimization. They can significantly increase speed as well as security.</p>
<h3>Cautions</h3>
<p>Only use constants if you have a good idea of what you&#8217;re doing and can properly keep track of changes to the Codex with new releases of WordPress.</p>
<p>Some constants may change when new major version upgrades are made.</p>
<h3>WordPress Constants</h3>
<p>Here are some of the constants and how they are used. There are probably a few that I missed. I&#8217;ll add to this as I find more.</p>
<h4>Security Constants</h4>
<p>These constants are declared in <span class="code">wp-config.php</span> and are required for the normal operation of WordPress. All of these constants are 64 character random strings and are used for hashes, nonces and other security purposes. Each installation of WordPress should use different strings to ensure that your site is harder to &#8220;hack.&#8221; If you haven&#8217;t already changed your security keys, you can use WordPress&#8217;s <a href="http://codex.wordpress.org/Editing_wp-config.php#Security_Keys" rel="nofollow">online security key generator</a>.</p>
<ul>
<li><span class="code">AUTH_KEY</span> &#8212; Used for authenticating a user and setting cookies.</li>
<li><span class="code">SECURE_AUTH_KEY</span> &#8212; Used for authenticating a user and setting cookies under the https protocol.</li>
<li><span class="code">LOGGED_IN_KEY</span> &#8212; Used for marking a user&#8217;s cookie data as logged in.</li>
<li><span class="code">NONCE_KEY</span> &#8212; Used for creating Nonces, which are used as one-time values to ensure that humans are entering data in forms.</li>
<li><span class="code">AUTH_SALT</span> &#8212; Used to &#8220;salt&#8221; the authentication data. Salts are random data added to passwords, keys and other data to make them harder to guess.</li>
<li><span class="code">SECURE_AUTH_SALT</span> &#8212; Used to &#8220;salt&#8221; the secure authentication data.</li>
<li><span class="code">LOGGED_IN_SALT</span> &#8212; Used to &#8220;salt&#8221; the logged in cookie data.</li>
<li><span class="code">NONCE_SALT</span> &#8212; Used to &#8220;salt&#8221; the nonce data.</li>
</ul>
<h4>Database Constants</h4>
<p>These are used to declare your database connection information. If you ever need to change your database password or location, you can effect this by editing your <span class="code">wp-config.php</span> file and change these values:</p>
<ul>
<li><span class="code">DB_NAME</span> &#8212; The name of your database.</li>
<li><span class="code">DB_USER</span> &#8212; The user name for your database connection.</li>
<li><span class="code">DB_PASSWORD</span> &#8212; The password for your database connection.</li>
<li><span class="code">DB_HOST</span> &#8212; The host name, or computer name where your database server is located.</li>
<li><span class="code">DB_CHARSET</span> &#8212; The character set used when creating tables in your database. Unless you have a specific requirement for something else, this should have a value of <span>&#8216;utf8&#8242;</span>.</li>
<li><span class="code">DB_COLLATE</span> &#8212; The collation (sorting) type to use for indexed data in your tables. This should be left empty unless you have a specific requirement otherwise.</li>
</ul>
<h4>Other wp-config.php Constants</h4>
<p>These are the last few constants that are normally declared in <span class="code">wp-config.php</span>:</p>
<ul>
<li><span class="code">COOKIE_DOMAIN</span> &#8212; Specifies the domain set in cookies for those with unusual domain configurations. This can help to prevent cookies being sent with requests for static content. Example: <span class="code">define(&#8216;COOKIE_DOMAIN&#8217;, &#8216;www.staticdomain.com&#8217;);</span>.</li>
<li><span class="code">WP_DEBUG</span> &#8212; Sets WordPress&#8217;s &#8220;debug&#8221; mode on or off. Normally, this is set to <span class="code">false</span>. Changing it to <span class="code">define(&#8216;WP_DEBUG&#8217;, true);</span> will turn on debug mode. This can be useful if you need to track down errors.</li>
<li><span class="code">WP_HOME</span> &#8212; This overrides the configuration setting for the home url, but doesn&#8217;t change it permanently. This should include the <span class="code">http://</span> prefix, as in: <span class="code">define(&#8216;WP_HOME&#8217;, &#8216;http://domain.com/optionalsubdirectory&#8217;);</span>.</li>
<li><span class="code">WP_SITEURL</span> &#8212; Declares the site&#8217;s URL. This defines the address where your WordPress code files reside. It should include the <span class="code">http://</span> prefix. An example would be: <span class="code">define(&#8216;WP_SITEURL&#8217;, &#8216;http://mydomain.com&#8217;);</span>.</li>
<li><span class="code">WPLANG</span> &#8212; Used to localize your WordPress install. This should be left empty for a default language of American English. If you need to localize your WordPress installation, you need to change this and install a corresponding MO file for your language. For example, changing this to: <span class="code">define (&#8216;WPLANG&#8217;, &#8216;de_DE&#8217;);</span> will set your language to German.</li>
</ul>
<h4>Default Constants</h4>
<p>These values are declared in the <span class="code">wp-includes/default-constants.php</span> file. You to change these settings, add them to your <span class="code">wp-config.php</span> file so they are declared before the <span class="code">wp-includes/default-constants.php</span> file is loaded.</p>
<ul>
<li><span class="code">ADMIN_COOKIE_PATH</span> &#8212; Sets the cookie path for admin-based cookies. If not already defined, this will take the value: <span class="code">define(&#8216;ADMIN_COOKIE_PATH&#8217;, SITECOOKIEPATH . &#8216;wp-admin&#8217;);</span></li>
<li><span class="code">FORCE_SSL_ADMIN</span> &#8212; Enforces the use of SSL for Admin access. Normally, this is disabled. To force SSL for all Admin pages, you can: <span class="code">define(&#8216;FORCE_SSL_ADMIN&#8217;, true);</span></li>
<li><span class="code">FORCE_SSL_LOGIN</span> &#8212; Enforces the use of SSL for site logins. Normally, this is disabled. To force SSL for login requests, you can: <span class="code">define(&#8216;FORCE_SSL_LOGIN&#8217;, true);</span></li>
<li><span class="code">SITECOOKIEPATH</span> &#8212; Sets the cookie path for normal site cookies. If not set, this will take the value <span class="code">define(&#8216;SITECOOKIEPATH&#8217;, preg_replace(&#8216;|https?://[^/]+|i&#8217;, &#8221;, get_option(&#8216;siteurl&#8217;) . &#8216;/&#8217; ) );</span></li>
<li><span class="code">WP_CONTENT_DIR</span> &#8212; Sets the name of the content directory. Normally, this is <span class="code">&#8216;wp-content&#8217;</span>. To change this, you can: <span class="code">define(&#8216;WP_CONTENT_DIR&#8217;, &#8216;mycontentdirectory&#8217;);</span> This can also be obtained by using <span class="code">plugin_dir_path()</span></li>
<li><span class="code">WP_CONTENT_URL</span> &#8212; Sets the URL for the content directory references. if you change the <span class="code">WP_CONTENT_DIR</span>, you will also need to change this to match the directory name for http requests.</li>
<li><span class="code">WP_DEBUG_DISPLAY</span> &#8212; Controls display of errors. The default is to use the display_errors setting and not force errors to be displayed. To force errors to display, you can: <span class="code">define(&#8216;WP_DEBUG_DISPLAY&#8217;, true);</span></li>
<li><span class="code">WP_DEBUG_LOG</span> &#8212; Controls error logging to the file <span class="code">wp-content/debug.log</span>. The default is no logging. To change this, you can: <span class="code">define(&#8216;WP_DEBUG_LOG&#8217;, true);</span></li>
<li><span class="code">WP_DEFAULT_THEME</span> &#8212; Sets the default theme. The current version of WordPress assumes a default theme of <span class="code">&#8216;twentyeleven&#8217;</span>. If you want to change this, you can: <span class="code">define(&#8216;WP_DEFAULT_THEME&#8217;, &#8216;mydefaulttheme&#8217;);</span></li>
<li><span class="code">WP_PLUGIN_DIR</span> &#8212; Sets the directory for plugin files. The default is <span class="code">&#8216;plugins&#8217;</span>. To change this, you can: <span class="code">define(&#8216;WP_PLUGIN_DIR&#8217;, &#8216;/newplugindir&#8217;);</span></li>
<li><span class="code">WP_PLUGIN_URL</span> &#8212; Sets the URL for the plugin directory. If you change the <span class="code">WP_PLUGIN_DIR</span>, you will also need to change this to match the directory name for http requests. If you have compatibility issues with some plugins, you can set an additional value, as in: <span class="code">define(&#8216;PLUGINDIR&#8217;, &#8216;/wpdir/wp-content/plugins&#8217;);</span>.</li>
<li><span class="code">WPMU_PLUGIN_DIR</span> &#8212; Sets the directory to store the Must Use plugins. The default location is <span class="code">/mu-plugins</span>. To change this, you can: <span class="code">define(&#8216;WPMU_PLUGIN_DIR&#8217;, &#8216;/requiredplugins&#8217;);</span></li>
<li><span class="code">WPMU_PLUGIN_URL</span> &#8212; Sets the URL for the Must Use plugin directory. If you change the <span class="code">WPMU_PLUGIN_DIR</span>, you will also need to change this to match the directory name for http requests.</li>
</ul>
<h4>Capability Settings</h4>
<p>These can be used to control certain behaviors that users are allowed to perform. Some of these are confusing because you are turning &#8220;on&#8221; the ability to &#8220;disallow&#8221; a feature. So be careful on how you&#8217;re declaring these values. Most of these are used in the <span class="code">wp-includes/capabilities.php</span> file, but if you want to change the settings, you should add your settings to your <span class="code">wp-config.php</span> file.</p>
<ul>
<li><span class="code">ALLOW_UNFILTERED_UPLOADS</span> &#8212; Allows unfiltered uploads. You can: <span class="code">define(&#8216;ALLOW_UNFILTERED_UPLOADS&#8217;, true);</span> to enable users to upload files without filtering. Be careful: this is a potential security risk.</li>
<li><span class="code">DISALLOW_FILE_EDIT</span> &#8212; Allows users to edit theme and plugin files. If you do not want your users to be able to edit these files, you can change this: <span class="code">define(&#8216;DISALLOW_FILE_EDIT&#8217;, true);</span></li>
<li><span class="code">DISALLOW_FILE_MODS</span> &#8212; Allows users to update theme and plugin files via the WordPress Repository. If you do not want your users to be able to update their WordPress install, you can change this: <span class="code">define(&#8216;DISALLOW_FILE_MODS&#8217;, true);</span></li>
<li><span class="code">DISALLOW_UNFILTERED_HTML</span> &#8212; Disables the ability to allow unfiltered HTML. Using <span class="code">define(&#8216;DISALLOW_UNFILTERED_HTML&#8217;, false);</span> will turn off the ability to allow unfiltered HTML.</li>
<li><span class="code">WP_CACHE</span> &#8212; Enables the built-in WordPress caching capability. If you want to enable this caching, you can: <span class="code">define(&#8216;WP_CACHE&#8217;, true);</span></li>
<li><span class="code">WP_USE_THEMES</span> &#8212; Declared in <span class="code">/index.php</span>. Tells WordPress whether or not use load it&#8217;s template engine. If you want access to WordPress APIs but don&#8217;t want or need the overhead of the template engine, define this to false: <span class="code">define(&#8216;WP_USE_THEMES&#8217;, false);</span></li>
</ul>
<h4>Script Control</h4>
<p>These settings control how scripts (Javascript and CSS) are handled by the system.</p>
<ul>
<li><span class="code">COMPRESS_CSS</span> &#8212; Compresses CSS. To enable CSS compression, you can: <span class="code">define(&#8216;COMPRESS_CSS&#8217;, true);</span></li>
<li><span class="code">COMPRESS_SCRIPTS</span> &#8212; Compresses scripts. To enable compression, you can: <span class="code">define(&#8216;COMPRESS_SCRIPTS&#8217;, true);</span></li>
<li><span class="code">CONCATENATE_SCRIPTS</span> &#8212; Concatenates Javascript and CSS files. To enable, you can <span class="code">define(&#8216;CONCATENATE_SCRIPTS&#8217;, true);</span></li>
<li><span class="code">ENFORCE_GZIP</span> &#8212; Forces gzip for compressoin of data sent to browsers. The default setting is to use the mod_deflate Apache module. If your host does not have this installed, you can: <span class="code>define(&#8216;ENFORCE_GZIP&#8217;, true);</span> to enable compression with gzip.</li>
<li><span class="code">SCRIPT_DEBUG</span> &#8212; Include the development (or non-minified) versions of all Javascript and CSS files. It also disabled compression and concatenation. To enable, you can: <span class="code">define(&#8216;SCRIPT_DEBUG&#8217;, true);</span></li>
</ul>
<h4>Optimization Settings</h4>
<p>These values can be used to control and optimize your WordPress install.</p>
<ul>
<li><span class="code">AUTOSAVE_INTERVAL</span> &#8212; Sets the interval for saving revisions while editing posts.</li>
<li><span class="code">CORE_UPGRADE_SKIP_NEW_BUNDLED</span> &#8212; Enables skipping of theme and plugin updates when upgrading WordPress.</li>
<li><span class="code">DOING_AJAX</span> &#8212; Set to <span class="code">TRUE</span> when processing an AJAX request.</li>
<li><span class="code">EMPTY_TRASH_DAYS</span> &#8212; Sets the number of days before trashed items are removed.</li>
<li><span class="code">IMAGE_EDIT_OVERWRITE</span> &#8212; Allows overwriting images when editing them.</li>
<li><span class="code">MEDIA_TRASH</span> &#8212; Enables the trash function for Media files.</li>
<li><span class="code">WP_MEMORY_LIMIT</span> &#8212; Sets the memory limit used.</li>
<li><span class="code">WP_MAX_MEMORY_LIMIT</span> &#8212; Controls the maximum memory size used. Some WordPress processes require more memory. This setting controls the upper limit used by these high memory use procedures.</li>
<li><span class="code">SHORTINIT</span> &#8212; Turns on only the core WordPress functions. Often used when interfacing to other platforms.</li>
<li><span class="code">WP_POST_REVISIONS</span> &#8212; Sets the maximum number of revisions to save. If set to FALSE it will be unlimited, an integer set the maximum number of revisions to save.</li>
</ul>
<h4>MultiSite Settings</h4>
<p>These values control how WordPress MultiSite behaves.</p>
<ul>
<li><span class="code">NOBLOGREDIRECT</span> &#8212; Sets the URL to redirect visitors to when they request a non-existent MultiSite blog. The default is <span class="code">&#8216;%siteurl%&#8217;</span>, which is the default site. If you wish to use a different location, you can: <span class="code">define(&#8216;NOBLOGREDIRECT&#8217;, &#8216;mynewdomain.com&#8217;);</span></li>
<li><span class="code">WP_ALLOW_MULTISITE</span> &#8212; Turns on MultiSite. Just enabling this using <span class="code">define(&#8216;WP_ALLOW_MULTISITE&#8217;, true);</span> does not by itself make your WordPress install a MultiSite install. It just starts the process. When you add this to your <span class="code">wp-config.php</span> file, it turns on the Network menu in the Admin. This allows you to make certain choices and continue the setup process for your MultiSite install.</li>
<li><span class="code">WPMU_ACCEL_REDIRECT</span> &#8212; When using Apache X-Sendfile for quicker loading, this helps you turn it on natively in WordPress for MultiSites. To enable, you can: <span class="code">define(&#8216;WPMU_ACCEL_REDIRECT&#8217;, true);</span></li>
</ul>
<p><i>Updated: May 4, 2012</i></p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://davejesch.com/wordpress/wordpress-tech/conditionally-set-debug-mode/" rel="bookmark" class="crp_title">Conditionally Set Debug Mode</a></li><li><a href="http://davejesch.com/wordpress/wordpress-tech/variable-width-pages-for-your-theme/" rel="bookmark" class="crp_title">Variable Width Pages For Your Theme</a></li><li><a href="http://davejesch.com/wordpress/wordpress-tech/displaying-post-view-counts/" rel="bookmark" class="crp_title">Displaying Post View Counts</a></li><li><a href="http://davejesch.com/wordpress/tracking-form-submisstions-using-google-analytics/" rel="bookmark" class="crp_title">Tracking Form Submisstions Using Google Analytics</a></li><li><a href="http://davejesch.com/wordpress/wordpress-tech/local-wordpress-development/" rel="bookmark" class="crp_title">Local WordPress Development</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://davejesch.com/wordpress/wordpress-tech/wordpress-constants/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Displaying Post View Counts</title>
		<link>http://davejesch.com/wordpress/wordpress-tech/displaying-post-view-counts/</link>
		<comments>http://davejesch.com/wordpress/wordpress-tech/displaying-post-view-counts/#comments</comments>
		<pubDate>Sun, 04 Dec 2011 02:47:12 +0000</pubDate>
		<dc:creator>Dave Jesch</dc:creator>
				<category><![CDATA[WordPress Tech]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://davejesch.com/?p=202</guid>
		<description><![CDATA[To display the number of post views, you can add the following code to your functions.php file, or create a plugin add add it to your plugin source file. Then, in your single.php template file, add the following inside &#8220;the loop:&#8221; Finally, wherever you want to display the counts, add this code: For the most [...]]]></description>
			<content:encoded><![CDATA[<p>To display the number of post views, you can add the following code to your <span class="code">functions.php</span> file, or create a plugin add add it to your plugin source file.</p>
<pre class="brush: php; title: ; notranslate">
define('DJ_POST_VIEW_COUNT', 'dj_post_view_count_meta');
function getPostViews($nPostId)
{
  $nCount = intval(get_post_meta($nPostId, DJ_POST_VIEW_COUNT, true));
  if ($nCount == 0)
  {
    delete_post_meta($nPostId, DJ_POST_VIEW_COUNT);
    add_post_meta($nPostId, DJ_POST_VIEW_COUNT, '0');
  }
  return ($nCount . ' View' . (($nCount == 1 ? '' : 's'));
}
function incrementPostViews($nPostId)
{
  $nCount = intval(get_post_meta($nPostId, DJ_POST_VIEW_COUNT, true));
  if ($nCount == 0)
  {
    delete_post_meta($nPostId, DJ_POST_VIEW_COUNT);
    add_post_meta($nPostId, DJ_POST_VIEW_COUNT, '1');
  } else {
    update_post_meta($nPostId, DJ_POST_VIEW_COUNT, ++$nCount);
  }
}
</pre>
<p>Then, in your <span class="code">single.php</span> template file, add the following inside &#8220;the loop:&#8221;</p>
<pre class="brush: php; title: ; notranslate">// this adds to the post view count
incrementPostViews(get_the_ID());</pre>
<p>Finally, wherever you want to display the counts, add this code:</p>
<pre class="brush: php; title: ; notranslate">// this displays the number of views for the current post
echo getPostViews(get_the_ID());</pre>
<p>For the most part, I would say that code like this should be written into a WordPress plugin, rather than added to the <span class="code">functions.php</span> file. However, since counting and displaying the number of views of a post is usually tightly integrated into the display of a post &#8212; which is the job of the theme, in this case it arguable as to whether or not it belongs in the <span class="code">functions.php</span> file or a plugin. This is one of those situations where it just doesn&#8217;t matter all that much.</p>
<p>With just a little work, this could be turned into a plugin that would automatically add and display the post counts &#8212; without any changes to the theme files. Something like this could be added using the hooks provided in popular theme frameworks, such as Genesis or Thematic very easily. In that case, implementing this as a plugin would be the easier solution from a user perspective because there would be no changes to the theme files required at all.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://davejesch.com/wordpress/wordpress-tech/plugin-custom-post-type-ui/" rel="bookmark" class="crp_title">Plugin: Custom Post Type UI</a></li><li><a href="http://davejesch.com/wordpress/wordpress-tech/variable-width-pages-for-your-theme/" rel="bookmark" class="crp_title">Variable Width Pages For Your Theme</a></li><li><a href="http://davejesch.com/wordpress/wordpress-tech/conditionally-set-debug-mode/" rel="bookmark" class="crp_title">Conditionally Set Debug Mode</a></li><li><a href="http://davejesch.com/wordpress/wordpress-tech/custom-user-data/" rel="bookmark" class="crp_title">Custom User Data</a></li><li><a href="http://davejesch.com/wordpress/wordpress-tech/modifying-search-results/" rel="bookmark" class="crp_title">Modifying Search Results</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://davejesch.com/wordpress/wordpress-tech/displaying-post-view-counts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Variable Width Pages For Your Theme</title>
		<link>http://davejesch.com/wordpress/wordpress-tech/variable-width-pages-for-your-theme/</link>
		<comments>http://davejesch.com/wordpress/wordpress-tech/variable-width-pages-for-your-theme/#comments</comments>
		<pubDate>Wed, 16 Nov 2011 02:54:37 +0000</pubDate>
		<dc:creator>Dave Jesch</dc:creator>
				<category><![CDATA[WordPress Tech]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[theme]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://davejesch.com/?p=212</guid>
		<description><![CDATA[Starting with WordPress version 3, WordPress Theme Developers can now set a global variable called $content_width to inform WordPress of the desired width of the page. This values is used when displaying full-width images and for videos. But what if you have different widths for different pages? You need a way of indicating to the [...]]]></description>
			<content:encoded><![CDATA[<p>Starting with WordPress version 3, <a href="http://davejesch.com/services/wordpress-theme-developer/">WordPress Theme Developers</a> can now set a global variable called <span class="code">$content_width</span> to inform WordPress of the desired width of the page. This values is used when displaying full-width images and for videos.</p>
<p>But what if you have different widths for different pages? You need a way of indicating to the WordPress system of the page width that can change depending on the theme page being used. So here&#8217;s a small code sample that can detect different page templates and change the <span class="code">$content_width<span> accordingly.</p>
<pre class="brush: php; title: ; notranslate">
// set content width depending on page template
function dj_set_content_width()
{
  global $post;
  $sTemplate = 'default';
  if (isset($post) &amp;&amp; isset($post-&gt;ID))
    $sTemplate = get_post_meta($post-&gt;ID, '_wp_page_template', TRUE);
  switch ($sTemplate)
  {
  case 'default':
  default:
    $nWidth = 584;             // default width (taken from twentyeleven theme
    break;
  case 'showcase.php':
    $nWidth = 480;
    break;
  case 'sidebar-page.php':
    $nWidth = 500;
    break;
  }
  // use additional conditions to set page width
  if (is_attachment())
    $nWidth = 584;            // use this width for attachment pages
  global $content_width;
  $content_width = $nWidth;   // set width to calculated value
}

add_action('wp_head', 'dj_set_content_width', 1);
</pre>
<p>The hook is on the <span class="code">&#8216;wp_head&#8217;</span> event, as this is the point in time that WordPress needs to know the width of the page. It does this at a priority of 1, so that other functions operating on the same hook will have the modified value already set.</p>
<p>The function determines the page width by looking at the selected page template, according to the <span class="code">_wp_page_template</span> meta data value that WordPress uses to store which page template is used when displaying the page. The is the mechanism used by &#8220;standard&#8221; themes, such as Twentyeleven.</p>
<p>If you&#8217;re using a different theme framework, your page template may be stored in a different way. For example, the <a href="http://www.studiopress.com/" target="_blank" rel="nofollow">Genesis Framework</a> uses the meta value <span class="code">_genesis_layout</span>. If you&#8217;re using that framework, you will need to obtain the different value and modify the <span class="code">switch-case</span> appropriately, checking for values like <span class="code">&#8216;content-sidebar-sidebar&#8217;<span>.</p>
<p>As indicated on Line 22, you can also use additional theme test functions to enable different width on specific pages. Other test functions such as the <span class="code">is_author()</span>, <span class="code">is_front_page()</span>, <span class="code">is_404()</span>, etc. can be added to the list.</p>
<p>With a little careful thinking and planning, you can achieve a theme that is very flexible in its ability to display images and videos and accommodate theme settings. You&#8217;ll run into some issues if you&#8217;re using a theme or framework that uses non-standard settings, but those are not too difficult to work through. Just be careful to fall back to a default width setting in the case that your page does not have this meta data set already.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://davejesch.com/wordpress/wordpress-tech/displaying-post-view-counts/" rel="bookmark" class="crp_title">Displaying Post View Counts</a></li><li><a href="http://davejesch.com/wordpress/wordpress-tech/conditionally-set-debug-mode/" rel="bookmark" class="crp_title">Conditionally Set Debug Mode</a></li><li><a href="http://davejesch.com/wordpress/wordpress-tech/plugin-custom-post-type-ui/" rel="bookmark" class="crp_title">Plugin: Custom Post Type UI</a></li><li><a href="http://davejesch.com/wordpress/wordpress-tech/wordpress-constants/" rel="bookmark" class="crp_title">WordPress Constants</a></li><li><a href="http://davejesch.com/wordpress/wordpress-tech/modifying-search-results/" rel="bookmark" class="crp_title">Modifying Search Results</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://davejesch.com/wordpress/wordpress-tech/variable-width-pages-for-your-theme/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Add Search Form to Navigation Menu</title>
		<link>http://davejesch.com/wordpress/wordpress-tech/add-search-form-to-navigation-menu/</link>
		<comments>http://davejesch.com/wordpress/wordpress-tech/add-search-form-to-navigation-menu/#comments</comments>
		<pubDate>Sun, 17 Apr 2011 22:13:54 +0000</pubDate>
		<dc:creator>Dave Jesch</dc:creator>
				<category><![CDATA[WordPress Tech]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://davejesch.com/?p=203</guid>
		<description><![CDATA[Here&#8217;s a small piece of code that will add a search form to a theme&#8217;s navigation menu. How does it work? It works by adding a filter, &#8216;wp_nav_menu_items&#8217;. This filter allows modification of the navigation menus that are displayed and is run after the menus are constructed but before they are output. Lines 3-5 use [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a small piece of code that will add a search form to a theme&#8217;s navigation menu.</p>
<pre class="brush: php; title: ; notranslate">
function dj_nav_search_box($sItems, $args)
{
    ob_start();
    get_search_form();
    $searchform = ob_get_clean();

    $sItems .= '&lt;li&gt;' . $searchform . '&lt;/li&gt;';

    return ($sItems);
}
add_filter('wp_nav_menu_items','dj_nav_search_box', 10, 2);
</pre>
<h3>How does it work?</h3>
<p>It works by adding a filter, <span class="code">&#8216;wp_nav_menu_items&#8217;</span>. This filter allows modification of the navigation menus that are displayed and is run after the menus are constructed but before they are output.</p>
<p>Lines 3-5 use output buffering to capture the contents of the theme&#8217;s search form. On Line 7, the search form is added to the menu contents by adding it to the menu within <span class="code">&lt;li&gt;</span> tags.</p>
<p>The only thing that&#8217;s left to do is styling. I noticed on one of my themes that I needed to set the text color to white because the text of the search form was showing as black text on a black background is the navigation menu. So adding a CSS class of <span class="code">#navmenu .screen-reader-text { color: white; }</span> does the trick. Of course, your theme is probably different, so your class names would have to change.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://davejesch.com/wordpress/wordpress-tech/modifying-search-results/" rel="bookmark" class="crp_title">Modifying Search Results</a></li><li><a href="http://davejesch.com/wordpress/wordpress-tech/wordpress-api-quick-reference/" rel="bookmark" class="crp_title">WordPress API Quick Reference</a></li><li><a href="http://davejesch.com/wordpress/tracking-form-submisstions-using-google-analytics/" rel="bookmark" class="crp_title">Tracking Form Submisstions Using Google Analytics</a></li><li><a href="http://davejesch.com/wordpress/wordpress-tech/custom-user-data/" rel="bookmark" class="crp_title">Custom User Data</a></li><li><a href="http://davejesch.com/wordpress/wordpress-tech/conditionally-set-debug-mode/" rel="bookmark" class="crp_title">Conditionally Set Debug Mode</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://davejesch.com/wordpress/wordpress-tech/add-search-form-to-navigation-menu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Local WordPress Development</title>
		<link>http://davejesch.com/wordpress/wordpress-tech/local-wordpress-development/</link>
		<comments>http://davejesch.com/wordpress/wordpress-tech/local-wordpress-development/#comments</comments>
		<pubDate>Sat, 19 Mar 2011 01:13:54 +0000</pubDate>
		<dc:creator>Dave Jesch</dc:creator>
				<category><![CDATA[WordPress Tech]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://davejesch.com/?p=209</guid>
		<description><![CDATA[I find myself often telling other developers that the best way to do web development is to set up a local hosting environment. This allows you to create a duplicate of your web server&#8217;s environment on your own local computer. To do this requires a few moving parts, including a Web Server (Apache is the [...]]]></description>
			<content:encoded><![CDATA[<p>I find myself often telling other developers that the best way to do web development is to set up a local hosting environment. This allows you to create a duplicate of your web server&#8217;s environment on your own local computer.</p>
<p>To do this requires a few moving parts, including a Web Server (Apache is the most common web server on Linux platforms) with PHP support, and a database server (MySQL). Assuming you already have these parts installed and working, I will outline a few steps on how to configure a local development environment for WordPress (or any other PHP application) development.</p>
<p>Another alternative is to use a tool like <a href="http://www.apachefriends.org/en/xampp.html" rel="nofollow">XAMPP</a>, which is an all-in-one Apache, MySQL, PHP solution. It&#8217;s great if you don&#8217;t want to deal with all the configuration intricacies and also provides tools for many of the steps discussed here. But if you&#8217;re like me and like knowing how all the pieces work, setting up your own Apache/MySQL servers is a good exercise.</p>
<p>First, I set up a host name. I like to use a host name that is very close to the host name of the ultimate install domain. So if your target domain is <span class="code">mywebsite.com</span>, you can set up a local test domain as <span class="code">mywebsite.<b>loc</b></span>. I like to use &#8220;<span class="code">loc</span>&#8221; for the top level domain. The reason for this is if I need to transfer the database from your local environment to the live host server, the TLD being the same length makes this a little bit easier. (More on that later.) Adding an entry to your <span class="code">hosts</span> file will create the test domain on your local machine. It will look something like this:</p>
<pre class="brush: plain; title: ; notranslate">127.0.0.1 mywebsite.loc</pre>
<p>The next step is configuring Apache to recognize a virtual host for your newly created domain. On Windows, you can add something like the following to your <span class="code">httpd.conf</span> file. On Linux, you can add a new file in your <span class="code">sites-available</span> directory with the following:</p>
<pre class="brush: xml; title: ; notranslate">
# vv changes for local install
#  NameVirtualHost mywebsite.loc
&lt;VirtualHost localhost:80&gt;
  ServerName mywebsite.loc
#  ServerAlias mywebsite.loc
  DocumentRoot &quot;{{install directory}}&quot;
  &lt;Directory &quot;{{install directory}}&quot;&gt;
    AllowOverride All
    Options Indexes FollowSymLinks
    Order allow,deny
    Allow from all
  &lt;/Directory&gt;
&lt;/VirtualHost&gt;
# ^^ end of changes for local install
</pre>
<p>The <span class="code">{{install directory}}</span> is where your PHP and other files will be located. It will of course be in different directories on Windows and Linux, but the directory can be almost anywhere.</p>
<p>Once the changes are made to your Apache configuration, you need to restart Apache for the changes to take effect.</p>
<p>After restarting Apache, you can copy your WordPress files (or whatever other PHP application you&#8217;re working on) to your <span class="code">{{install directory}}</span>. Once the files are in place, you can use your MySQL tool to create a database for WordPress. This can be done from the command line with the following two commands:</p>
<pre class="brush: sql; title: ; notranslate">
CREATE DATABASE wordpress;
GRANT ALL ON wordpress.* TO username@localhost IDENTIFIED BY 'password';
</pre>
<p>Now you should be able to point your browser to <span class="code">http://mywebsite.loc</span> and go through the normal WordPress installation steps. After you&#8217;ve done your work, tested your code and you&#8217;re ready to move to the live site, you can export the database to a text file. If you then change any references to <span class="code">mywebsite.loc</span> to refer to <span class="code">mywebsite.com</span>. Now you can import the modified SQL file into your database on the live site without the need for any other changes.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://davejesch.com/wordpress/wordpress-tech/moving-a-wordpress-install-to-another-domain/" rel="bookmark" class="crp_title">Moving a WordPress Install to Another Domain</a></li><li><a href="http://davejesch.com/technology/optimizing-page-speed/" rel="bookmark" class="crp_title">Optimizing Page Speed</a></li><li><a href="http://davejesch.com/wordpress/wordpress-tech/conditionally-set-debug-mode/" rel="bookmark" class="crp_title">Conditionally Set Debug Mode</a></li><li><a href="http://davejesch.com/wordpress/wordpress-tech/wordpress-constants/" rel="bookmark" class="crp_title">WordPress Constants</a></li><li><a href="http://davejesch.com/wordpress/wordpress-tech/conditionally-enqueueing-stylesheets/" rel="bookmark" class="crp_title">Conditionally Enqueueing Stylesheets</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://davejesch.com/wordpress/wordpress-tech/local-wordpress-development/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Change &#8220;Enter Title Here&#8221; Prompt for Custom Post Types</title>
		<link>http://davejesch.com/wordpress/wordpress-tech/change-enter-title-here-prompt-for-custom-post-types/</link>
		<comments>http://davejesch.com/wordpress/wordpress-tech/change-enter-title-here-prompt-for-custom-post-types/#comments</comments>
		<pubDate>Thu, 20 Jan 2011 18:06:41 +0000</pubDate>
		<dc:creator>Dave Jesch</dc:creator>
				<category><![CDATA[WordPress Tech]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://davejesch.com/?p=198</guid>
		<description><![CDATA[Custom Post Types have numerous title configurations that you can set when you create them. However, the in-field title that is displayed before you enter the post&#8217;s title is not one of them. Have no fear, there is a filter that can be used to modify this. This is what the in-field title looks like [...]]]></description>
			<content:encoded><![CDATA[<p>Custom Post Types have numerous title configurations that you can set when you create them. However, the in-field title that is displayed before you enter the post&#8217;s title is not one of them. Have no fear, there is a filter that can be used to modify this. This is what the in-field title looks like without any modifications:</p>
<p><img src="http://davejesch.com/wp-content/uploads/2011/01/press-release-title.png" alt="Press Release Title" title="press-release-title" width="379" height="103" class="alignnone size-full wp-image-199" /></p>
<p>To change this, you can use the following code:</p>
<pre class="brush: php; title: ; notranslate">function dj_filter_title_text($title)
{
    $scr = get_current_screen();
    if ('press-release' == $scr-&gt;post_type)
        $title = 'Enter Title of Press Release';
    return ($title);

add_filter('enter_title_here', 'dj_filter_title_text');
</pre>
<p>This example assumes you&#8217;re building a Custom Post Type for press releases. Line 3 gets the screen object that is use to detect which post type is being used. Line 4 tests the screen for your Custom Post Type. In this case, we&#8217;re checking it against the &#8216;press-release&#8217; post type. We only want to change the title for the post type that we&#8217;re targeting, so this test is necessary.</p>
<p>The last line adds our filter function, dj_filter_title_text() to the functions that will be called for the &#8216;enter_title_here&#8217; filter.</p>
<p>That&#8217;s all there is to it.</p>
<p>This filter is available in WordPress version 3.1 and above.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://davejesch.com/wordpress/wordpress-tech/modifying-search-results/" rel="bookmark" class="crp_title">Modifying Search Results</a></li><li><a href="http://davejesch.com/wordpress/wordpress-tech/plugin-custom-post-type-ui/" rel="bookmark" class="crp_title">Plugin: Custom Post Type UI</a></li><li><a href="http://davejesch.com/wordpress/wordpress-tech/variable-width-pages-for-your-theme/" rel="bookmark" class="crp_title">Variable Width Pages For Your Theme</a></li><li><a href="http://davejesch.com/wordpress/wordpress-3-0-released/" rel="bookmark" class="crp_title">WordPress 3.0 Released</a></li><li><a href="http://davejesch.com/wordpress/wordpress-tech/displaying-post-view-counts/" rel="bookmark" class="crp_title">Displaying Post View Counts</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://davejesch.com/wordpress/wordpress-tech/change-enter-title-here-prompt-for-custom-post-types/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Custom User Data</title>
		<link>http://davejesch.com/wordpress/wordpress-tech/custom-user-data/</link>
		<comments>http://davejesch.com/wordpress/wordpress-tech/custom-user-data/#comments</comments>
		<pubDate>Thu, 18 Nov 2010 05:48:05 +0000</pubDate>
		<dc:creator>Dave Jesch</dc:creator>
				<category><![CDATA[WordPress Tech]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://davejesch.com/?p=216</guid>
		<description><![CDATA[There are often times when you need to collect custom user information on your WordPress site. Here&#8217;s a quick run-down on how to set this up: There are four WordPress actions used for this and they are separated into two groups. The first set of actions hook in to WordPress when it presents the user [...]]]></description>
			<content:encoded><![CDATA[<p>There are often times when you need to collect custom user information on your WordPress site. Here&#8217;s a quick run-down on how to set this up:</p>
<p>There are four WordPress actions used for this and they are separated into two groups.</p>
<p>The first set of actions hook in to WordPress when it presents the user fields for viewing and editing. The hooks are: <strong>&#8216;show_user_profile&#8217;</strong> and <strong>&#8216;edit_user_profile&#8217;</strong>. These can both be hooked up to the same callback function that outputs the HTML with the user fields.</p>
<p>The second set of action hooks are used when WordPress is saving the data fields displayed by the first callback. These hooks are: <strong>&#8216;personal_options_update&#8217;</strong> and <strong>&#8216;edit_user_profile_update&#8217;</strong>. Like the first set, these can both be hooked up to the same callback function.</p>
<p>Here is some sample code that provides both callback functions and hooks in to all four actions:</p>
<pre class="brush: php; title: ; notranslate">
define('DJ_TEXTDOMAIN', 'your_textdomain');

function dj_addCustomUserProfileData($user)
{
?&gt;
    &lt;h3&gt;&lt;?php _e('Additional Profile Information', DJ_TEXTDOMAIN); ?&gt;&lt;/h3&gt;
    &lt;table class=&quot;form-table&quot;&gt;
    &lt;tr&gt;
      &lt;th&gt;
        &lt;label for=&quot;user_address&quot;&gt;&lt;?php _e('Address', DJ_TEXTDOMAIN); ?&gt;&lt;/label&gt;
      &lt;/th&gt;
      &lt;td&gt;
        &lt;input type=&quot;text&quot; name=&quot;user_address&quot; id=&quot;user_address&quot;
          value=&quot;&lt;?php echo esc_attr(get_the_author_meta('address', $user-&gt;ID)); ?&gt;&quot;
          class=&quot;regular-text&quot; /&gt;&lt;br /&gt;
        &lt;span class=&quot;description&quot;&gt;&lt;?php _e('Please enter your address.', DJ_TEXTDOMAIN); ?&gt;&lt;/span&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/table&gt;
&lt;?php
}

function dj_saveCustomUserProfileData($user_id)
{
    if (!current_user_can('edit_user', $user_id))
        return (FALSE);
    // do validation, if needed
    if (isset($_POST['user_address']))
        update_usermeta($user_id, 'address', $_POST['user_address']);
}

add_action('show_user_profile', 'dj_addCustomUserProfileData');
add_action('edit_user_profile', 'dj_addCustomUserProfileData');
add_action('personal_options_update', 'dj_saveCustomUserProfileData');
add_action('edit_user_profile_update', 'dj_saveCustomUserProfileData');
</pre>
<p>You can add the above code any way you like, as either a plugin or added to your <span class="code">functions.php</span> file. The code will display the appropriate edit fields for the user data you want to collect.</p>
<p>The code here is simple, but it gives a good example of how to implement your own system to collect custom user data and associate it with a user.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://davejesch.com/wordpress/wordpress-tech/conditionally-enqueueing-stylesheets/" rel="bookmark" class="crp_title">Conditionally Enqueueing Stylesheets</a></li><li><a href="http://davejesch.com/wordpress/tracking-form-submisstions-using-google-analytics/" rel="bookmark" class="crp_title">Tracking Form Submisstions Using Google Analytics</a></li><li><a href="http://davejesch.com/technology/optimizing-page-speed/" rel="bookmark" class="crp_title">Optimizing Page Speed</a></li><li><a href="http://davejesch.com/wordpress/wordpress-tech/local-wordpress-development/" rel="bookmark" class="crp_title">Local WordPress Development</a></li><li><a href="http://davejesch.com/wordpress/wordpress-tech/displaying-post-view-counts/" rel="bookmark" class="crp_title">Displaying Post View Counts</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://davejesch.com/wordpress/wordpress-tech/custom-user-data/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

