<?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>WP Engineer</title>
	<atom:link href="http://wpengineer.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://wpengineer.com</link>
	<description>WordPress News, Hacks, Tipps, Tutorials, Plugins and Themes</description>
	<lastBuildDate>Tue, 31 Aug 2010 10:00:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>WordPress Child Themes – Remove Widget Areas</title>
		<link>http://wpengineer.com/2049/wordpress-child-themes-remove-widget-areas/</link>
		<comments>http://wpengineer.com/2049/wordpress-child-themes-remove-widget-areas/#comments</comments>
		<pubDate>Tue, 31 Aug 2010 10:00:08 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[WordPress Hacks]]></category>
		<category><![CDATA[Theme]]></category>
		<category><![CDATA[Widget]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=2049</guid>
		<description><![CDATA[In a WordPress Framework or Basic-Theme are one or several Widget Areas (Sidebars) defined. But how can you remove the widget areas if you don't need them and just confuse other backend users. The line unregister_sidebar('my-sidebar'); in functions.php of Child-Themes doesn't do anything. Why? WordPress loads first the function.php of Child-Themes and then of the [...]]]></description>
			<content:encoded><![CDATA[<p>In a WordPress Framework or Basic-Theme are one or several Widget Areas (Sidebars) defined. But how can you remove the widget areas if you don't need them and just confuse other backend users.<br />
<span id="more-2049"></span><br />
The line <code>unregister_sidebar('my-sidebar');</code> in functions.php of Child-Themes doesn't do anything. Why? WordPress loads first the <code>function.php</code> of Child-Themes and then of the Framework. The Sidebar, which we like to remove is not there yet. It will be registered while loading the Basic-Themes/Frameworks.</p>
<p>But you can solve the problem with a Hook in the registry of your Framework/Basic-Theme.</p>
<pre lang="php">
//Code of the Framework to register 2 Sidebars
function xtreme_register_dynamic_sidebars() {
  register_sidebar( array(
    &#039;name&#039; =&gt; &#039;Sidebar One&#039;,
    &#039;id&#039; =&gt; &#039;sidebar-one&#039;,
    &#039;description&#039; =&gt; &#039;Sidebar One&#039;,
    &#039;before_widget&#039; =&gt; &#039;&lt;li id=&quot;%1$s&quot; class=&quot;widget %2$s&quot;&gt;&#039;,
    &#039;after_widget&#039; =&gt; &#039;&lt;/li&gt;&#039;,
    &#039;before_title&#039; =&gt; &#039;&lt;h5 class=&quot;widget-title&quot;&gt;&#039;,
    &#039;after_title&#039; =&gt; &#039;&lt;/h5&gt;&#039;
    ));
  register_sidebar( array(
    &#039;name&#039; =&gt; &#039;Sidebar Two&#039;,
    &#039;id&#039; =&gt; &#039;sidebar-two&#039;,
    &#039;description&#039; =&gt; &#039;Sidebar Two&#039;,
    &#039;before_widget&#039; =&gt; &#039;  &lt;li id=&quot;%1$s&quot; class=&quot;widget %2$s&quot;&gt;&#039;,
    &#039;after_widget&#039; =&gt; &#039;&lt;/li&gt;&#039;,
    &#039;before_title&#039; =&gt; &#039;&lt;h5 class=&quot;widget-title&quot;&gt;&#039;,
    &#039;after_title&#039; =&gt; &#039;&lt;/h5&gt;&#039;
    ));
  do_action(&#039;childtheme_sidebars&#039;);
}
add_action( &#039;widgets_init&#039;, &#039;xtreme_register_dynamic_sidebars&#039; );
</pre>
<p>You see the Hook <code>do_action('childtheme_sidebars');</code><br />
let's use this Hook:</p>
<pre lang="php">
//functions.php im Child-Theme
function xtreme_unregister_sidebar() {
    unregister_sidebar(&#039;sidebar-two&#039;);
}
add_action( &#039;childtheme_sidebars&#039;, &#039;xtreme_unregister_sidebar&#039; );
</pre>
<p>And the Sidebar is removed. Easy huh? <img src='http://wpengineer.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
<hr />
<p><img style="float:left;" src="http://wpengineer.com/favicon.ico" alt="WP Engineer Favicon"/> Thanks for subscribing our feed! <a href="http://buysellads.com/buy/detail/3646/">Sponsor the WP Engineer Blog</a> and get your brand in front of several hundred users per day!<br />
&copy; <a href="http://wpengineer.com/">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpengineer.com/2049/wordpress-child-themes-remove-widget-areas/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Back On Track!</title>
		<link>http://wpengineer.com/2050/back-on-track/</link>
		<comments>http://wpengineer.com/2050/back-on-track/#comments</comments>
		<pubDate>Sat, 28 Aug 2010 19:14:24 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[WPengineer Misc]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=2050</guid>
		<description><![CDATA[Some of you might notice that we had heavy problems with our website and our provider last week because of too much traffic. Finally we pulled the plug and acquired our own server to serve our readers with a better performance of our website and without having any downtime. Please let us know if anything [...]]]></description>
			<content:encoded><![CDATA[<p>Some of you might notice that we had heavy problems with our website and our provider last week because of too much traffic. Finally we pulled the plug and acquired our own server to serve our readers with a better performance of our website and without having any downtime. Please let us know if anything is not working after the transfer to the new server. </p>
<p>Sorry to all our readers and advertising partner for any inconvenience and we hope we won't have any problems like this in the future. So we will have more time to write more in depth tutorials, hacks or tricks about WordPress! <img src='http://wpengineer.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Thanks a lot!</p>
<hr />
<p><img style="float:left;" src="http://wpengineer.com/favicon.ico" alt="WP Engineer Favicon"/> Thanks for subscribing our feed! <a href="http://buysellads.com/buy/detail/3646/">Sponsor the WP Engineer Blog</a> and get your brand in front of several hundred users per day!<br />
&copy; <a href="http://wpengineer.com/">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpengineer.com/2050/back-on-track/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Control WordPress Content via Userrights or Time</title>
		<link>http://wpengineer.com/2046/control-the-wordpress-content-via-userrights-or-time/</link>
		<comments>http://wpengineer.com/2046/control-the-wordpress-content-via-userrights-or-time/#comments</comments>
		<pubDate>Wed, 18 Aug 2010 13:26:44 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[WordPress Tutorials]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[Shortcode]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WP]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=2046</guid>
		<description><![CDATA[WordPress comes with its own user administration, therefore we can control on the basis of various roles and objects the content. In some cases, it is a typical request that you give access to a complete content only to registered users. The same is possible only for parts of the content. There are certainly different [...]]]></description>
			<content:encoded><![CDATA[<p>WordPress comes with its own user administration, therefore we can control on the basis of various roles and objects the content. In some cases, it is a typical request that you give access to a complete content only to registered users. The same is possible only for parts of the content. There are certainly different possibilities to do this - I'm going to mention some solutions here.<br />
<span id="more-2046"></span></p>
<h4>User Rights</h4>
<p>A simple solution is to query the rights of the user - the WordPress function <code>current_user_can()</code> makes it possible and it is simple to implement in your theme template. Therefore you can control that only logged in user are able to access the content.<br />
Simple example how to implement it in a template:</p>
<pre lang="php">
if ( current_user_can( &#039;manage_options&#039; ) )
	the_content( the_title( &#039;&#039;, &#039;&#039;, false ) . &#039; &#039; . __( &#039;read  more&raquo;&#039;, FB_BASIS_TEXTDOMAIN ) );
else
	_e( &#039;Only for logged in users&#039;, FB_BASIS_TEXTDOMAIN );
</pre>
<p>There are many solutions which are considering the different roles and objects. You can find a nice overview of objects per role  at <a href="http://codex.wordpress.org/Roles_and_Capabilities">Codex</a>.</p>
<h4>Proof of Login via Function</h4>
<p>Now the integration in the template is quite simple, but you normally have to adjust every template. Since WordPress uses hooks, you can also hook into and via Plugin or <code>functions.php</code> put a function in your template.</p>
<p>The following function is as an example and examines regardless of the user rights only if the user is logged in - if so, content may be seen. With the help of the hook the_content it controls it - so that the output in the theme, which comes via the template tag <code>the_content()</code> is only visible if you are logged in as a user.<br />
Also explicitly in your feed, the output is only visible when you are logged in - <code>!is_feed()</code>.</p>
<p>As an alternative for non logged users a section of the content is displayed - there are different approaches, here it was done explicitly with characters. It creates kind of a teaser for the reader.</p>
<pre lang="php">
function content_only4logged_in($content) {

	// all logged in User
	if ( is_user_logged_in() &amp;&amp;
			!is_null($content) &amp;&amp;
			!is_feed()
		 ) {

		return $content;
	} else {

		$content  = wp_html_excerpt( $content, 80 );
		$content .= &#039; &hellip;&#039;;
		$content .= __( &#039;&lt;br /&gt;Sorry, more of this content is only available for logged users.&#039;, FB_TEXTDOMAIN );
		return $content;
	}
}
add_action( &#039;the_content&#039;, &#039;content_only4logged_in&#039; );
</pre>
<h4>Restrict Content via ShortCode</h4>
<p>Another alternative is to make accessible only a certain section of the content only for logged in users. This could be done for example through the shortcode API of WordPress. In our example we use the shortcode <code>[member]</code> . Everything within this element is visible only to logged in users.<br />
Also, this code belongs in a Plugin or in the interface of the themes for new features.</p>
<pre lang="php">
function fb_check_logged_in( $atts, $content = null ) {
	if ( is_user_logged_in() &amp;&amp;
		!is_null($content) &amp;&amp;
		!is_feed()
		 ) {

		return $content;
	} else {

		return __( &#039;Sorry, this content is only available for logged users.&#039;, FB_TEXTDOMAIN );
	}
}
add_shortcode( &#039;member&#039;, &#039;fb_check_logged_in&#039; );
</pre>
<h4>Time-dependent output</h4>
<p>A possible alternative is to output a content for a specific period. This possibility can be safely extended to any size. So it's worth to use a <a href="http://wpengineer.com/use-metaboxes-in-your-theme-or-plugin/">Metabox</a> to enter a date on the articles to query the time frame in a <a href="http://wpengineer.com/tag/shortcode/">shortcode</a>.</p>
<pre lang="php">
function content_only4time($content) {

	$date = strtotime( &#039;01-10-2010&#039; ); // day-month-year
	$now  = strtotime( date(&#039;d-m-Y&#039;) );
	echo $now . &#039; - &#039; . $date;
	if ( $date &amp;&amp; ( $date &lt; $now ) ) {

		return $content;
	} else {

		return __( &#039;&lt;br /&gt;Sorry, the time is not ripe.&#039;, FB_TEXTDOMAIN );
	}
}
add_action( &#039;the_content&#039;, &#039;content_only4time&#039; );
</pre>
<p>In this case you can use the Plugin <a href="http://playground.ebiene.de/498/wordpress-plugin-wpsleep-time-control-for-parts-of-a-post/">wpSleep</a> , which controls via shortcode and parameters the time frame of the output.</p>
<h4>More</h4>
<p>The list of approaches and possibilities are endless. With the possibilities you may have your own ideas and can use the above mentioned examples. You are welcome to comment for further ideas and possibilities.<br />
<hr />
<p><img style="float:left;" src="http://wpengineer.com/favicon.ico" alt="WP Engineer Favicon"/> Thanks for subscribing our feed! <a href="http://buysellads.com/buy/detail/3646/">Sponsor the WP Engineer Blog</a> and get your brand in front of several hundred users per day!<br />
&copy; <a href="http://wpengineer.com/">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpengineer.com/2046/control-the-wordpress-content-via-userrights-or-time/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Understand WordPress Child Theme</title>
		<link>http://wpengineer.com/2045/understand-wordpress-child-theme/</link>
		<comments>http://wpengineer.com/2045/understand-wordpress-child-theme/#comments</comments>
		<pubDate>Thu, 05 Aug 2010 15:13:48 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[WordPress Tutorials]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[template tag]]></category>
		<category><![CDATA[Theme]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WP]]></category>
		<category><![CDATA[WP3.0]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=2045</guid>
		<description><![CDATA[With version 3.0 of WordPress, the much anticipated feature of Child Themes was integrated or some might say it was improved, since it was actually possible to use it. I like to show you an example based on the new default Theme TwentyTen how you use it. Another example can be found in my WP [...]]]></description>
			<content:encoded><![CDATA[<p>With version 3.0 of WordPress, the much anticipated feature of <a href="http://codex.wordpress.org/Child_Themes">Child Themes</a> was integrated or some might say it was improved, since it was actually possible to use it. I like to show you an example based on the new default Theme <a href="http://wordpress.org/extend/themes/twentyten">TwentyTen</a> how you use it. Another example can be found in my <a href="http://wpbasis.de">WP Basis-Theme</a> (<a href="http://code.google.com/p/wp-basis-theme/source/browse/#svn/trunk/basis-child-example%3Fstate%3Dclosed">SVN</a>); currently not HTML 5 version.</p>
<p>The function of the Child Themes can be applied basically in every theme and the new features facilitate access and creation of a Child Themes. Before there were also possibilities to change a Theme without changing the actual files of the theme. With the support of Child Themes this is now completely independent and we can use a theme that can be updated without a problem, and you can still realize your own ideas.</p>
<p>Other blogs already mentioned Child Themes but I've found so far only posts where they just talking about the activation and modification of the style sheet. Therefore, I would like to comment this subject only briefly, which is quite simple and then show the different possibilities in terms of template files.<br />
<span id="more-2045"></span></p>
<h4>Advantages of Child Theme</h4>
<p>More or less every administrator is trying to create an individual design for his WordPress system. This does not require to create a special theme from scratch. Very often, a free or commercial Theme is used and then adapted to your needs. Many Themes have different options but are not sufficient for customizing. If you want to adjust the individual design, such as the layout of a category, that requires some changes of the theme. No matter how extensive, an update of a Theme is no longer feasible without problems. Here the Child Themes come into consideration.</p>
<p>With a Child Theme, a Theme can be adjusted or you can use a Theme as a "Framework" and implement completely your own ideas. No matter how extensive, the real Theme remains intact and can undergo an update.</p>
<h4>Disadvantages of Child Theme</h4>
<p>Often "Framework" Themes are very comprehensive and with many features, sometimes it has a steep learning curve and customizing can cost a lot of effort and time. Even though with Child Themes.<br />
A major disadvantage is also the performance, because WordPress have to look into two areas according to the template and get the according files.<br />
Furthermore style sheets, if you build on them, are usually implemented via @-rule, which has <a href="http://www.stevesouders.com/blog/2009/04/09/dont-use-import/">disadvantages in performance</a>.</p>
<p>In all the negative points, it depends on skill and knowledge of the developer and how the Theme or Child Theme is created. Thus you can weaken the negative arguments I pointed out. Important: The new function should be carefully considered before using it. But with Child Themes you don't have to touch the basic Theme and yet you can make adjustments easily.</p>
<h3>Create Child Theme</h3>
<p>Enough said, let's start with the example based on the Theme TwentyTen and create an adjusted Theme - I will call it <em>TwentyTenJump</em> <img src='http://wpengineer.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>In the first step, a new folder is created in which we put all the template files, images, scripts and style sheets - what is principally needed for the Child Theme. In this example, the folder is <em>twentytenjump</em>. To create a Child Theme and make this apparent to WordPress, you simply need <code>style.css</code> within the new folder with several strings in a comment.</p>
<p>Within <code>style.css</code> it looks like this.</p>
<pre lang="css">
@charset &quot;UTF-8&quot;;

/**
 * Theme Name:     TwentyTenJump
 * Theme URI:      http://bueltge.de/?p=1192
 * Description:    Child theme for the Twenty Ten theme. Realized for a small tutorial to child themes in WordPress.
 * Author:         Frank Bültge
 * Author URI:     http://bueltge.de/
 * Template:       twentyten
 * Version:        0.1.0
 */

@import url(&#039;../twentyten/style.css&#039;);
</pre>
<p>Important are the key <em>Theme Name</em> and <em>Template</em>. The key <code>Template</code> points to the <strong>folder name</strong> of the Theme, which is considered as a basis - in that instance, the Theme Twentyten.</p>
<p>I now have the following structure within the installation of WordPress.</p>
<ul>
<li><code>wp-content</code>
<ul>
<li><code>themes</code>
<ul>
<li><code>twentyten</code></li>
<p> (Basic Theme, including all template files)</p>
<ul>
<li><code>style.css</code></li>
<li><code>index.php</code></li>
<li>...</li>
</ul>
<li><code>twentytenjump</code>
<ul>
<li><code>style.css</code> (must satisfy these name convention: <i>style.css</i>)</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<p>Thus, the first requirements are in place and you can select the new Theme in the backend of WordPress.<br />
<strong>Note:</strong> the reference to the Basic Theme is not very conspicuous, so that you might forget the dependency. So that's why you should always check before you delete a Theme. On the used Theme, there is no indication that a different Theme as a Child Theme is using this Theme.</p>
<h4>Working on the style sheet</h4>
<p>From now you can put any changes in your style sheet. Also, of course, you can remove the call to the style sheet <code>@import url('../twentyten/style.css');</code> from the Basic Theme and you can build your own style sheet completely.</p>
<p>You use the template files, the structure and PHP know-how of the Basic Theme, in which case is Twenty Ten. You deal exclusively with the design. For example, this could be the simplest case, a change in color of the background and alternatively a completely separate design will be created.</p>
<h4>Replace templates</h4>
<p>The functionality of the Child Theme includes more than just changing the appearance. You can replace existing template files of the Basic Themes. WordPress looks first in the Child Theme and then in the Basic Theme for possible templates. WordPress runs through the <a href="http://codex.wordpress.org/File:Template_Hierarchy.png">hierarchy of template files</a>.</p>
<p>At many points in your Theme you can intervene via Hook, which might be not very easy and complicated for some users. Thus not infrequently the output of title in <code>head</code> of a web site will be replaced with own functions or Plugins. You can either edit the title via Hook or control the output of a function. For example, the title should now be displayed with a function of a Plugin. In that case you have to adjust the <code>header.php</code> and so you must proceed as follows, so that the Basic Theme remains intact.</p>
<p>You only have to copy <code>header.php</code>, which is containing the <code>head</code> section of the Theme, into your own Child Theme and here it can be edited as you like. From now on WordPress pulls <code>header.php</code> and not the original file from the basic theme Twenty Ten.</p>
<p>Now you can integrate the mentioned function into the title, an example:</p>
<pre lang="php">
&lt;title&gt;&lt;?php
    /*
     * Print the &lt;title&gt; tag based on what is being viewed.
     * We filter the output of wp_title() a bit -- see
     * twentyten_filter_wp_title() in functions.php.
     */
    if ( function_exists(&#039;seo_title_tag&#039;) )
        seo_title_tag();
    else
        wp_title( &#039;|&#039;, true, &#039;right&#039; );

    ?&gt;&lt;/title&gt;
</pre>
<p>The Basic Theme remains untouched, it can still be kept up to date via updates and from now on WordPress uses the <code>header.php</code> always of the Child Theme.</p>
<p>Like this small example you can replace any template and adapt to your own requirements. Nevertheless, you should bear in mind that you replace the template completely - in the example, we would not notice an update of <code>header.php</code>. So it may be helpful to use Hooks in various areas and have their own functions, more about this later.</p>
<p><strong> Important: </ strong> an exception is <code>functions.php</code>, I will talk more about it later.</strong></p>
<h4>Expand Templates</h4>
<p>In order to meet your own requirements, it may be that you need new templates, template files didn't exist in the Basic Theme. For the purposes of the hierarchy you can extended forever. For example, Twenty Ten does not have <code>home.php</code> - you can simply place this file in your Child Theme and WordPress will use this file, if the state <code> is_home()</code> is true.</p>
<p>Using WordPress 3.0 there is another option outside of the template hierarchy to use your own templates - <a href="http://wpengineer.com/use-more-flexibility-in-wordpress-templates/"><code>get_template_part()</code></a>.</p>
<p>This function is used consistently within Twenty Ten - so you don't have to create own templates for the complete call, but only for the section of the Loop.<br />
For example, Twenty Ten uses for displaying the category archives the call <code>get_template_part( 'loop', 'category' );</code>. Thus it is possible to put a template in our Child Theme, which uses this loop. So it's only necessary to create a file <code>loop-category.php</code> and then save all necessary informations.</p>
<p>In the following example, I adjust the loop, if you are in one of the four categories. Other changes are possible, so you will have full control and flexibility.</p>
<pre lang="php">
if ( in_category( array(47, 37, 27, 45) ) ) {
	query_posts( &#039;cat=&#039;.$cat.&#039;&amp;posts_per_page=-1&amp;orderby=title&amp;order=ASC&#039; );
}	else {
	query_posts( &#039;cat=&#039;.$cat.&#039;&amp;posts_per_page=20&amp;paged=&#039;.$paged );
}
while ( have_posts() ) : the_post(); ?&gt;
</pre>
<p>Similarly, you might be able to customize the loop for <code>index.php</code> - Template file <code>loop-index.php</code> would be in the game.</p>
<h4>Include Functions</h4>
<p>Of course you can also bring in the Child Theme your own functions. If you put an own <code>functions.php</code> in your Child Theme, then it does not replace the <code>functions.php</code> of the Basic Theme!<br />
The functions of the Basic Theme will always be used. You have to disable them via the Hook. The possibility is also explained in a documentation in the functions.php file.</p>
<pre lang="php">
add_action( &#039;after_setup_theme&#039;, &#039;my_child_theme_setup&#039; );
function my_child_theme_setup() {
		// We are providing our own filter for excerpt_length (or using the unfiltered value)
		remove_filter( &#039;excerpt_length&#039;, &#039;twentyten_excerpt_length&#039; );
		...
}
</pre>
<p>Within the function <code>my_child_theme_setup()</code> you can disable the functions of the Basic Theme and bring in your own functions.</p>
<p>Other features belong into the <code>functions.php</code> of the Child Theme - the Basic Theme always remains untouched. In the following code example I disable the function of the Basic Theme Twenty Ten for the length of the excerpt, and load my own function <code>twentytenjump_excerpt_length()</code> and it includes a Widget.</p>
<pre lang="php">
&lt;?php
function twentytenjump_setup() {

	remove_filter( &#039;excerpt_length&#039;, &#039;twentyten_excerpt_length&#039; );
	add_filter( &#039;excerpt_length&#039;, &#039;twentytenjump_excerpt_length&#039; );

	add_action( &#039;widgets_init&#039;, &#039;register_limited_catagories_widget&#039; );
}
add_action( &#039;after_setup_theme&#039;, &#039;twentytenjump_setup&#039; );

function twentytenjump_excerpt_length( $length ) {
	return 10;
}

class limited_catagories_list_widget extends WP_Widget {

	function limited_catagories_list_widget(){
		$widget_ops = array( &#039;classname&#039; =&gt; __(&#039;Selective categories&#039;), &#039;description&#039; =&gt; __(&#039;Show a list of Categories, with the ability to exclude categories&#039;) );

		$control_ops = array( &#039;id_base&#039; =&gt; &#039;some-cats-widget&#039; );
		$this-&gt;WP_Widget( &#039;some-cats-widget&#039;, __(&#039;Selective Catagories&#039;), $widget_ops, $control_ops );
	}

	function form ( $instance){
		$defaults = array( &#039;title&#039; =&gt; __(&#039;Catagories&#039;), &#039;cats&#039; =&gt; &#039;&#039;, &#039;count&#039; =&gt; 0 );
		$instance = wp_parse_args( (array) $instance, $defaults );
		$count = isset($instance&#091&#039;count&#039;]) ? (bool) $instance&#091&#039;count&#039;] :false;
		?&gt;
		&lt;p&gt;
			&lt;label for=&quot;&lt;?php echo $this-&gt;get_field_id( &#039;title&#039; ); ?&gt;&quot;&gt;&lt;?php _e( &#039;Title:&#039; ); ?&gt;&lt;/label&gt;
			&lt;input id=&quot;&lt;?php echo $this-&gt;get_field_id( &#039;title&#039; ); ?&gt;&quot; name=&quot;&lt;?php echo $this-&gt;get_field_name( &#039;title&#039; ); ?&gt;&quot; value=&quot;&lt;?php echo $instance&#091&#039;title&#039;]; ?&gt;&quot; class=&quot;widefat&quot; /&gt;
		&lt;/p&gt;
		&lt;p&gt;
			&lt;input type=&quot;checkbox&quot; class=&quot;checkbox&quot; id=&quot;&lt;?php echo $this-&gt;get_field_id(&#039;count&#039;); ?&gt;&quot; name=&quot;&lt;?php echo $this-&gt;get_field_name(&#039;count&#039;); ?&gt;&quot;&lt;?php checked( $count ); ?&gt; /&gt;
			&lt;label for=&quot;&lt;?php echo $this-&gt;get_field_id(&#039;count&#039;); ?&gt;&quot;&gt;&lt;?php _e( &#039;Show post counts&#039; ); ?&gt;&lt;/label&gt;&lt;br /&gt;
		&lt;/p&gt;
		&lt;p&gt;
			&lt;label for=&quot;&lt;?php echo $this-&gt;get_field_id( &#039;cats&#039; ); ?&gt;&quot;&gt;&lt;?php _e( &#039;Categories to exclude (comma separated list of Category-IDs): &#039; ); ?&gt;&lt;/label&gt;
			&lt;input id=&quot;&lt;?php echo $this-&gt;get_field_id( &#039;cats&#039; ); ?&gt;&quot; name=&quot;&lt;?php echo $this-&gt;get_field_name( &#039;cats&#039; ); ?&gt;&quot; value=&quot;&lt;?php echo $instance&#091&#039;cats&#039;]; ?&gt;&quot; class=&quot;widefat&quot; /&gt;
		&lt;/p&gt;
		&lt;?php
	}

	function update($new_instance, $old_instance) {
			$instance = $old_instance;
			$instance&#091&#039;title&#039;] = strip_tags( $new_instance&#091&#039;title&#039;] );
			$instance&#091&#039;count&#039;] = !empty($new_instance&#091&#039;count&#039;]) ? 1 : 0;
			$instance&#091&#039;cats&#039;]  = strip_tags( $new_instance&#091&#039;cats&#039;] );
			return $instance;
	}

	function widget($args, $instance){
		extract( $args );
		$title = apply_filters(&#039;widget_title&#039;, $instance&#091&#039;title&#039;] );
		$c     = $instance&#091&#039;count&#039;] ? &#039;1&#039; : &#039;0&#039;;
		$cats  = $instance&#091&#039;cats&#039;];
		echo $before_widget;
		if ( $title )
			echo $before_title . $title . $after_title;
		echo &#039;&lt;ul&gt;&#039;;
		wp_list_categories(&quot;exclude=$cats&amp;title_li=&amp;show_count=$c&quot;);
		echo &#039;&lt;/ul&gt;&#039;;
		echo $after_widget;
	}

}

function register_limited_catagories_widget(){
	register_widget(&#039;limited_catagories_list_widget&#039;);
}
?&gt;
</pre>
<h3>Conclusion</h3>
<p>I think through the introduction of the new default theme Twenty Ten that some new cool features were added. But I think also that Twenty Ten is very inappropriate to understand the work of WordPress in the area of themes. Especially beginners and PHP newcomers are having a hard time. Yet it creates new opportunities and if you want to use Child Themes in a clean way, then you can not get around it without understanding Hooks in the WordPress API. WordPress takes the idea of the Hooks consistently further, always popular in Plugins, they do get popular in Themes now. Everything has advantages and disadvantages.</p>
<p>But if you use a well-maintained Theme or Framework, then you will appreciate the new possibilities and can always update with no problems. Crucial will be your own knowledge about WordPress - depending on the interest, knowledge and working methods how you create your own themes.<br />
<hr />
<p><img style="float:left;" src="http://wpengineer.com/favicon.ico" alt="WP Engineer Favicon"/> Thanks for subscribing our feed! <a href="http://buysellads.com/buy/detail/3646/">Sponsor the WP Engineer Blog</a> and get your brand in front of several hundred users per day!<br />
&copy; <a href="http://wpengineer.com/">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpengineer.com/2045/understand-wordpress-child-theme/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Custom Post Type and Permalink</title>
		<link>http://wpengineer.com/2044/custom-post-type-and-permalink/</link>
		<comments>http://wpengineer.com/2044/custom-post-type-and-permalink/#comments</comments>
		<pubDate>Wed, 28 Jul 2010 13:37:05 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[WordPress News]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WP]]></category>
		<category><![CDATA[WP3.0]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=2044</guid>
		<description><![CDATA[Since WordPress 3.0 you can use Custom Post Types and you can define your own types of content - it's more like pages than posts! Thereby you can use automatically the Permalink structure of your WordPress installation. That means, if you create a new post type, you can use Permalinks. But the Permalinks only work [...]]]></description>
			<content:encoded><![CDATA[<p>Since WordPress 3.0 you can use <a href="http://wpengineer.com/impressions-of-custom-post-type/">Custom Post Types</a> and you can define your own types of content - it's more like pages than posts! Thereby you can use automatically the Permalink structure of your WordPress installation. That means, if you create a new post type, you can use Permalinks.</p>
<p>But the Permalinks only work if you recreate the Rewrite Rules of WordPress - that's why many users initially have problems with it. If you create a new post type you probably get a 404 if you open this page because WordPress doesn't know the URL-structure in your Permalinks since you didn't create the Rewrite Rules again.</p>
<p>The easiest way is to safe the Permalink structure in your settings again. Alternatively you can include in your Plugin or Theme the function <code>flush_rewrite_rules()</code>. This enables to create the Rewrite Rules again. <strong>Important:</strong> Flush rules only on activation or deactivation. Don't do it on any other hook.<br />
<hr />
<p><img style="float:left;" src="http://wpengineer.com/favicon.ico" alt="WP Engineer Favicon"/> Thanks for subscribing our feed! <a href="http://buysellads.com/buy/detail/3646/">Sponsor the WP Engineer Blog</a> and get your brand in front of several hundred users per day!<br />
&copy; <a href="http://wpengineer.com/">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpengineer.com/2044/custom-post-type-and-permalink/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Individual Design for any Page</title>
		<link>http://wpengineer.com/2043/individual-design-for-any-page/</link>
		<comments>http://wpengineer.com/2043/individual-design-for-any-page/#comments</comments>
		<pubDate>Tue, 20 Jul 2010 13:55:52 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[WordPress Tutorials]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[template_tag]]></category>
		<category><![CDATA[Theme]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WP]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=2043</guid>
		<description><![CDATA[The blog has a Theme and for every page an extra style sheet. This current trend of individuality for each content is very common today. Even with WordPress, you can do so; there are several possibilities. One possibility is to create, based on the title, the individual stylesheet. By default, the class assignment of function [...]]]></description>
			<content:encoded><![CDATA[<p>The blog has a Theme and for every page an extra style sheet. This current trend of individuality for each content is very common today. Even with WordPress, you can do so; there are several possibilities. One possibility is to create, based on the title, the individual stylesheet.<br />
By default, the class assignment of function <a href="http://codex.wordpress.org/Template_Tags/body_class" title="more informations in the Codex of WordPress"><code>body_class()</code></a> has already a lot of possibilities. More individuality can be reached with the title or ID.<br />
It is certainly not worth for a traditional blog environment but for a site with little content it works pretty well. As I have implemented in this case.<br />
<span id="more-2043"></span><br />
If a page is loaded, then you can pass the title. If you use this one in the body tag as ID or class and then create for each <code>ID</code> or <code>class</code> a style, the right design will be loaded.</p>
<p>Alternatively, you can work with the ID of the page or article, function the_ID() passes it. Please note, IDs and classes may not start with a number and therefore you must add a string before, for example:</p>
<pre lang="php">
&lt;div id=&quot;page-&lt;?php the_ID(); ?&gt;&quot;&gt;
</pre>
<p>As a final alternative, I would like to mention that you can expand the function <code>body_class()</code> via Hook with own classes. So you can have the title of a page/post via hook in this function.</p>
<pre lang="php">
function fb_title_body_class($classes) {
	global $post;

	$classes&#091] = sanitize_title_with_dashes( get_the_title( $post-&gt;ID ) );

	return $classes;
}
add_filter( &#039;body_class&#039;, &#039;fb_title_body_class&#039; );
</pre>
<p>In the following I'm showing you the simplest case via title, so that you output only this class and and <code>body_class()</code> is not used.</p>
<h4>With the help of the Title</h4>
<p>Put the stylesheet in the header of your Theme:</p>
<pre lang="php">
&lt;link rel=&quot;stylesheet&quot; href=&quot;&lt;?php bloginfo(&#039;template_url&#039;); ?&gt;/custom.css&quot; type=&quot;text/css&quot; media=&quot;screen&quot; /&gt;
</pre>
<p>Alternatively, this is integrated via Hook <code>wp_head</code> if the specific page is loaded, so you load the explicit style sheet only if it is needed. Everything happens in the <code> functions.php</code> of your Theme.</p>
<p>in your body tag of <code>page.php</code> is the title of the page:</p>
<pre lang="php">
&lt;body class=&quot;&lt;?php echo sanitize_title_with_dashes( get_the_title() ); ?&gt;&quot;&gt;
</pre>
<p>Therefore the page "My Home" has the body tag:</p>
<pre lang="php">
&lt;body class=&quot;my-home&quot;&gt;
and so on...
</pre>
<p>in your <code>custom.css</code> you define all style for class home: for example</p>
<pre lang="css">
.my-home a { color: #090; text-decoration: none; }
.my-home a:visited { color: #999; text-decoration: none; }
.my-home a:hover { color: #f60; text-decoration: none; }
</pre>
<p>in the original Theme it looks like this:</p>
<pre lang="css">
a { color: #009; text-decoration: underline; }
a:visited { color: #999; text-decoration: underline; }
a:hover { color: #c00; text-decoration: underline; }
</pre>
<p>I think it's an approach with a lot potential and so I leave it to your creativity. So if you would like to have for each page a different style sheet, this is an easy solution.</p>
<p>Alternativ a small plugin to add the title of the post to the template tag <code>body_class()</code> as example.</p>
<pre lang="php">
&lt;?php
/**
 * Plugin Name: Title 2 body_class
 * Plugin URI: http://bueltge.de/wordpress-theme-in-abhaengigkeit-des-titel/397/
 * Text Domain: title2bodyclass
 * Domain Path: /languages
 * Description: Add the title of the post to the boy_class-function
 * Author: Frank B&uuml;ltge
 * Version: 0.1
 * Author URI: http://bueltge.de/
 * Donate URI: http://bueltge.de/wunschliste/
 * License: GPL
 * Last change: 26.07.2010 10:37:23
 */ 

/**
License:
==============================================================================
Copyright 2010 Frank Bueltge  (email : frank@bueltge.de)

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

Requirements:
==============================================================================
This plugin requires WordPress &gt;= 2.8 and tested with PHP Interpreter &gt;= 5.2.9
*/

if ( !class_exists(&#039;title2body_class&#039;) ) {

    global $wp_version;
    if ( !function_exists (&#039;add_action&#039;) || version_compare($wp_version, &quot;2.8alpha&quot;, &quot;&lt;&quot;) ) {
        if (function_exists (&#039;add_action&#039;))
            $exit_msg = &#039;The plugin requires WordPress 2.8 or newer. &lt;a href=&quot;http://codex.wordpress.org/Upgrading_WordPress&quot;&gt;Please update WordPress&lt;/a&gt; or delete the plugin.&#039;;
        else
            $exit_msg = &#039;&#039;;
        header(&#039;Status: 403 Forbidden&#039;);
        header(&#039;HTTP/1.1 403 Forbidden&#039;);
        exit($exit_msg);
    }

    class title2body_class{

        define( &#039;FB_T2BC_BASEDIR&#039;, dirname( plugin_basename(__FILE__) ) );
        define( &#039;FB_T2BC_TEXTDOMAIN&#039;, &#039;title2bodyclass&#039; );

        function __construct() {

            add_action( &#039;body_class&#039;, array( &amp;$this, &#039;title_body_class&#039; ) );
        }

        function title_body_class($classes) {
            global $post;

            $classes&#091] = sanitize_title_with_dashes( get_the_title( $post-&gt;ID ) );

            return $classes;
        }

        }
    }

    function title2body_class_start(){
        new title2body_class();
    }

    add_action(&#039;plugins_loaded&#039;, &#039;title2body_class_start&#039;);
}
?&gt;
</pre>
<hr />
<p><img style="float:left;" src="http://wpengineer.com/favicon.ico" alt="WP Engineer Favicon"/> Thanks for subscribing our feed! <a href="http://buysellads.com/buy/detail/3646/">Sponsor the WP Engineer Blog</a> and get your brand in front of several hundred users per day!<br />
&copy; <a href="http://wpengineer.com/">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpengineer.com/2043/individual-design-for-any-page/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Small Tips Using WordPress and jQuery</title>
		<link>http://wpengineer.com/2028/small-tips-using-wordpress-and-jquery/</link>
		<comments>http://wpengineer.com/2028/small-tips-using-wordpress-and-jquery/#comments</comments>
		<pubDate>Tue, 13 Jul 2010 10:23:31 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[WPengineer Misc]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Theme]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=2028</guid>
		<description><![CDATA[Inside of WordPress are several of JavaScript libraries available, you can use them easily and you don't need an extra Theme or Plugins. Also, this is the recommended approach to enable libraries , so they won't be loaded more than once. Some notes on these two topics can be found in the article Use JavaScript [...]]]></description>
			<content:encoded><![CDATA[<p>Inside of WordPress are several of JavaScript libraries available, you can use them easily and you don't need an extra Theme or Plugins. Also, this is the recommended approach to enable libraries , so they won't be loaded more than once. Some notes on these two topics can be found in the article <a href="http://wpengineer.com/use-javascript-libraries-in-and-of-wordpress/">Use JavaScript Libraries In And Of WordPress</a>.</p>
<p>But from time to time you need something specific, so I have some code snippets for you in this post now. And I particularly want to show some examples with jQuery. Many Themes and Plugins using jQuery and it is pretty easy to work with jQuery. In principle, these hooks and calls also apply to your own scripts and other libraries.<br />
<span id="more-2028"></span></p>
<h4>The Hooks</h4>
<p>WordPress provides Hooks to hook at certain points into the core. This is one of the strengths of WordPress and the following three Hooks are in particular interesting to include scripts in your Themes. The following examples illustrate some practical use.</p>
<ul>
<li><a href="http://adambrown.info/p/wp_hooks/hook/init"><code>init</code></a></li>
<li><a href="http://adambrown.info/p/wp_hooks/hook/template_redirect"><code>template_redirect</code></a></li>
<li><code>after_setup_theme</code> since WordPress 3.0</li>
</ul>
<h4>Replace jQuery of WordPress in your Theme with Google AJAX Library</h4>
<p>In the following code the jQuery-Library of Google CDN gets loaded; But you can still use jQuery without any problem. Other Plugins can access the library very easy via <code>wp_enqueue_script()</code>.</p>
<pre lang="php">
function fb_greyfoto_init() {
	if ( !is_admin() ) { // actually not necessary, because the Hook only get used in the Theme
		wp_deregister_script( &#039;jquery&#039; ); // unregistered key jQuery
		wp_register_script( &#039;jquery&#039;, &#039;http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js&#039;, false, &#039;1.4.2&#039;); // register key jQuery with URL of Google CDN
		wp_enqueue_script( &#039;jquery&#039; ); // include jQuery
	}
}
// nur for Themes since WordPress 3.0
add_action( &#039;after_setup_theme&#039;, &#039;fb_greyfoto_init&#039; ); // Theme active, include function
</pre>
<h4>jQuery Library in footer</h4>
<p>The default call of <code>wp_enqueue_script( 'jquery' )</code> in your Theme takes care, that it uses jQuery of WordPress and if all Plugins and Themes are setup correctly, the library will be load only once. But jQuery won't get loaded in your footer, instead in <em>head</em> of your site. That's why you have to adjust the code a little bit and add the parameter for "load in footer".<br />
Here are two examples before and after WordPress 3.0 because <code>after_setup_theme</code> is only available since WordPress 3.0.</p>
<pre lang="php">
function fb_greyfoto_init() {
	if ( !is_admin() ) {
		wp_deregister_script( &#039;jquery&#039; );
		wp_register_script( &#039;jquery&#039;, &#039;http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js&#039;, false, &#039;1.4.2&#039;, true ); // load in footer - true
		wp_enqueue_script( &#039;jquery&#039; );

		// load js of Theme, requires jQuery
		wp_enqueue_script( &#039;styleswitcher&#039;, get_bloginfo( &#039;template_directory&#039;) . &#039;/js/styleswitcher.jquery.php&#039;, array( &#039;jquery&#039;), &#039;1.3.2&#039;, true ); // load my script with key styleswitcher in footer and use jQuery
		wp_enqueue_script( &#039;greyfoto&#039;, get_template_directory_uri() . &#039;/js/photoblogfb.js&#039;, array( &#039;jquery&#039;, &#039;styleswitcher&#039;), &#039;1.1.3.1&#039;, true ); // use jQuery and styleswitcher and then load script greyfoto
	}
}

// also for WP &lt; version 3.0
global $wp_version;
if ( version_compare($wp_version, &quot;3.0alpha&quot;, &quot;&lt;&quot;) ) {
	add_action( &#039;init&#039;, &#039;fb_greyfoto_init&#039; );
} else {
	add_action( &#039;after_setup_theme&#039;, &#039;fb_greyfoto_init&#039; );
}
</pre>
<h4>Load script for specific page</h4>
<p>Sometimes you need some scripts just for a specific template, page or post - Therefore are <a href="http://bueltge.de/debug-objects-wordpress-plugin/966/">Conditional Tags</a>. This possibility improves the performance of your website. The following script will be loaded only for the template <code>custom-page.php</code>.</p>
<pre lang="php">
function fb_greyfoto_page_init() {
	if ( !is_page_template( &#039;custom-page.php&#039; ) )
		return;

	wp_enqueue_script( &#039;mypagescript&#039;, get_template_directory_uri() . &#039;/js/my_script_4_page.js&#039;, array(&#039;jquery&#039;), &#039;0.1&#039;, true );
}
add_action( &#039;template_redirect&#039;, &#039;fb_greyfoto_page_init&#039; );
</pre>
<h4>The usage of $</h4>
<p>Within scripts you have to consider several things.<br />
To work with $ , as many are used to with jQuery, you have to deliver jQuery to $ ; That's an easy task, the short version is <code>$(function() {} );</code> , which should be used within WordPress.</p>
<pre lang="javascript">
jQuery(function ($) {
	// Now you can use $ as a reference to jQuery without any problem
});
</pre>
<p>To check whether the HTML is loaded, use the following call. That makes sure that the DOM is loaded and you can browse the DOM via jQuery and now the real work of the script can start. I strongly recommend to use this variant. I don't want to explain all the benefits, but you can read about it in the article <a href="http://www.learningjquery.com/2006/09/introducing-document-ready">Introducing $(document).ready()</a>.</p>
<pre lang="javascript">
jQuery(document).ready(function ($) {
	$(&#039;#id&#039;).toggle({
		//parameter for example toggle
	});
});
</pre>
<hr />
<p><img style="float:left;" src="http://wpengineer.com/favicon.ico" alt="WP Engineer Favicon"/> Thanks for subscribing our feed! <a href="http://buysellads.com/buy/detail/3646/">Sponsor the WP Engineer Blog</a> and get your brand in front of several hundred users per day!<br />
&copy; <a href="http://wpengineer.com/">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpengineer.com/2028/small-tips-using-wordpress-and-jquery/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Meet You At WordCamp Germany 2010 In Berlin!</title>
		<link>http://wpengineer.com/2035/meet-you-at-wordcamp-germany-2010-in-berlin/</link>
		<comments>http://wpengineer.com/2035/meet-you-at-wordcamp-germany-2010-in-berlin/#comments</comments>
		<pubDate>Sat, 03 Jul 2010 09:51:29 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[WPengineer Misc]]></category>
		<category><![CDATA[Sponsors]]></category>
		<category><![CDATA[WordCamp]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=2035</guid>
		<description><![CDATA[Frank, Micha and I are participating right now at the WordCamp Germany 2010 this weekend. We are looking forward to meet old friends and new faces to exchange new ideas, opinions, experiences, knowledge and tips about WordPress. We hope we will meet some of our readers as well. It's always great to meet people in [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://wordcamp.de/"><img src="http://wpengineer.com/wp-content/uploads/wordcamp-germany-2010-e1278150181208.jpg" alt="" title="wordcamp-germany-2010" width="450" height="165" class="aligncenter size-full wp-image-2040" /></a><br />
Frank, Micha and I are participating right now at the <a href="http://wordcamp.de/">WordCamp Germany 2010</a> this weekend. We are looking forward to meet old friends and new faces to exchange new ideas, opinions, experiences, knowledge and tips about WordPress. We hope we will meet some of our readers as well. It's always great to meet people in person, especially if you know them only via internet for a long time. </p>
<p>Hope to see you there and if not, we probably will let you know what happened at the <a href="http://wordcamp.de/">WordCamp Germany 2010</a> next week.</p>
<p>We also like to take the opportunity to say thank you to our loyal sponsors and like to introduce them to our readers, if you don't know them already:</p>
<p><img src="http://wpengineer.com/wp-content/uploads/Pagelines-Themes.jpg" alt="Pagelines-Themes" title="Pagelines-Themes" width="449" height="335" class="aligncenter size-full wp-image-1929" /><br />
If you also want to have a great design for your website, just get a <a href="http://www.pagelines.com/">PageLines Theme</a>. They have superior themes for WordPress that make it simple for you to have an awesome, fully-featured website that is easy to set up and manage.</p>
<hr />
<p><a href="http://wpseo.org"><img src="http://wpengineer.com/wp-content/uploads/wpseo.jpg" alt="wpseo" title="wpseo" width="450" height="258" class="aligncenter size-full wp-image-1358" /></a><br />
<a href="http://wpseo.org"> wpSEO</a> is a great Plugin for better SEO on your WordPress installation. Check it out and you will love it as Google will love your blog from now on. <img src='http://wpengineer.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  Of course we are using it on WP Engineer too. WP 3.0 ready and with over 70 setting to optimize your blog. Join their <a href="http://www.wpseo.org/affiliate/">affiliate program</a> to participate on the success of wpSEO.</p>
<hr />
<p><a href="http://themeshift.com/"><img src="http://wpengineer.com/wp-content/uploads/themeshift.png" alt="" title="themeshift" width="450" height="300" class="aligncenter size-full wp-image-1981" /></a><br />
<a href="http://themeshift.com/">ThemeShift</a> provides one of the most beautiful, powerful and state of the art WordPress Themes available these days. <a href="http://themeshift.com/">Take a look at them</a>!</p>
<hr />
<p><img src="http://wpengineer.com/wp-content/uploads/wishlistmember.jpg" alt="wishlistmember" title="wishlistmember" width="450" height="258" class="aligncenter size-full wp-image-1356" /><br />
<a href="http://member.wishlistproducts.com/">WishList Member</a> is a powerful membership script that can turn any WordPress blog into a full blown membership site. Very interesting, you have to check it out. WishList Member belongs to our loyal sponsors, we are very glad to have them and to provide our readers a great membership plugin.</p>
<hr />
<p><a href="http://www.makebetterwebsites.com/"><img src="http://wpengineer.com/wp-content/uploads/make-better-websites1.jpg" alt="" title="make-better-websites" width="450" height="337" class="aligncenter size-full wp-image-2036" /></a><br />
<a href="http://www.makebetterwebsites.com/">MakeBetterWebsites</a> is a great gallery with a fine selection of high quality websites. All websites are handpicked and most of them I have first seen on this website instead of the usual suspects, seen on many other websites over and over again. Only high quality websites are seen on this website.</p>
<hr />
<p><img src="http://wpengineer.com/wp-content/uploads/wordpress-book.jpg" alt="wordpress-book" title="wordpress-book" width="450" height="471" class="aligncenter size-full wp-image-1927" /><br />
<a href="http://digwp.com/book/">Download this book</a> to become a Pro in WordPress! 400 Pages of Practical Information. A Lifetime Subscription, when you buy this <a href="http://digwp.com/book/">book</a>, you will instantly get the most current version. But also, you are getting a lifetime subscription to all updated (PDF) copies of the book. And lots of Code Samples!</p>
<hr />
<p><a href="http://www.vivathemes.com/"><img src="http://wpengineer.com/wp-content/uploads/viva-themes.jpg" alt="" title="viva-themes" width="450" height="430" class="aligncenter size-full wp-image-2038" /><br />
</a><a href="http://www.vivathemes.com/">Viva Themes</a> creates quality and professionally designed WordPress themes. They offer themes for your business, blog or personal sites. All of that comes with an excellent free support</p>
<hr />
<p><a href="http://tokokoo.com/"><img src="http://wpengineer.com/wp-content/uploads/tokokoo-e1278150036473.jpg" alt="" title="tokokoo" width="450" height="460" class="aligncenter size-full wp-image-2039" /></a><br />
<a href="http://tokokoo.com/">Tokokoo</a> claims that they are offering the simplest way to build your online store with WordPress. With their WordPress e-commerce themes, open your business instantly. Sell your products easily. All for FREE. So go ahead and try it out!</p>
<hr />
<p><a href="http://getshopped.org/"><img src="http://wpengineer.com/wp-content/uploads/wp-e-commerce-plugin.jpg" alt="" title="wp-e-commerce-plugin" width="450" height="367" class="aligncenter size-full wp-image-2037" /></a><br />
A very popular provider of e-commerce functionality for WordPress is WP e-commerce, which is a free bolt-on shopping cart that lets customers buy your products, services and digital downloads online. They’ve had over 750,000 downloads! They also offer some premium upgrades to have more features.</p>
<hr />
<h3>If you also interested to support our website, please go to <a href="http://buysellads.com/buy/detail/3646">BuySellAds.com</a> and promote your service or product on WP Engineer. Maybe not this month, but maybe next month we have a spot just for you available. <img src='http://wpengineer.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </h3>
<p><img src="http://wpengineer.com/wp-content/uploads/wordcamp-germany-2010-150x150.jpg" alt="" title="wordcamp-germany-2010" width="150" height="150" class="alignnone size-thumbnail wp-image-2040" /><br />
<hr />
<p><img style="float:left;" src="http://wpengineer.com/favicon.ico" alt="WP Engineer Favicon"/> Thanks for subscribing our feed! <a href="http://buysellads.com/buy/detail/3646/">Sponsor the WP Engineer Blog</a> and get your brand in front of several hundred users per day!<br />
&copy; <a href="http://wpengineer.com/">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpengineer.com/2035/meet-you-at-wordcamp-germany-2010-in-berlin/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>WordPress Import Not Include In WP Core</title>
		<link>http://wpengineer.com/2026/wordpress-import-not-include-in-wp-core/</link>
		<comments>http://wpengineer.com/2026/wordpress-import-not-include-in-wp-core/#comments</comments>
		<pubDate>Wed, 30 Jun 2010 09:30:34 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[WordPress News]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Plugins]]></category>
		<category><![CDATA[WP]]></category>
		<category><![CDATA[WP3.0]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=2026</guid>
		<description><![CDATA[WordPress came with several new or changed features - one feature which changed is the functionality to import content from other systems. WordPress offers under "Tools" to import data of other applications or a XML-file of another WordPress installation. But since WordPress 3.0 you need a Plugin because it is no longer in WordPress core. [...]]]></description>
			<content:encoded><![CDATA[<p>WordPress came with several new or changed features - one feature which changed is the functionality to import content from other systems.<br />
<span id="more-2026"></span><br />
WordPress offers under "Tools" to import data of other applications or a XML-file of another WordPress installation. But since WordPress 3.0 you need a Plugin because it is no longer in WordPress core. The installation of the Plugin is easy and has the usual steps to activate a Plugin.</p>
<p><a href="http://wpengineer.com/wp-content/uploads/wp-importer.png"><img src="http://wpengineer.com/wp-content/uploads/wp-importer-300x112.png" alt="" title="wp-importer" width="300" height="112" class="aligncenter size-medium wp-image-2027" /></a></p>
<p>This is the first time, that WordPress is going into the direction of using <a href="http://wpengineer.com/core-plugins/">Core-Plugins</a>. There are many formats available if you check out the <a href="http://wordpress.org/extend/plugins/profile/wordpressdotorg">profile of WordPress</a>, and maybe someone can create additional importers for other formats.<br />
<hr />
<p><img style="float:left;" src="http://wpengineer.com/favicon.ico" alt="WP Engineer Favicon"/> Thanks for subscribing our feed! <a href="http://buysellads.com/buy/detail/3646/">Sponsor the WP Engineer Blog</a> and get your brand in front of several hundred users per day!<br />
&copy; <a href="http://wpengineer.com/">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpengineer.com/2026/wordpress-import-not-include-in-wp-core/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How To List All Posts Of An Archive, A Category Or A Search Result</title>
		<link>http://wpengineer.com/2031/how-to-list-all-posts-of-an-archive-a-category-or-a-search-result/</link>
		<comments>http://wpengineer.com/2031/how-to-list-all-posts-of-an-archive-a-category-or-a-search-result/#comments</comments>
		<pubDate>Sat, 26 Jun 2010 07:52:28 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[WordPress Plugins]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=2031</guid>
		<description><![CDATA[Archive pages are usually paged according to your settings in options/reading. Sometimes you may want to offer a page with all posts for an archive (time, category, search result). You need: a separate address for the unpaged archive, a filter for the internal WordPress query and a link to your ‘all posts’ page. We put [...]]]></description>
			<content:encoded><![CDATA[<p>Archive pages are usually paged according to your settings in options/reading. Sometimes you may want to offer a page with all posts for an archive (time, category, search result).</p>
<p>You need:</p>
<ul>
<li>a separate address for the unpaged archive,</li>
<li>a filter for the internal WordPress query and</li>
<li>a link to your ‘all posts’ page.</li>
</ul>
<p>We put everything into a class to avoid name collisions and to keep the global namespace clean.<br />
We name the file <code>class.View_All_Posts.php</code>.</p>
<p>Let’s start with the class, the parameter and a checker, this is easy:</p>
<pre lang="php">
class View_All_Posts
{
    /**
     * GET parameter to trigger a complete, not paged archive.
     * @var string
     */
    protected $all_param = &#039;all&#039;;

    /**
     * Are we there already?
     *
     * @return bool
     */
    public function is_all_posts()
    {
        return isset ( $_GET&#091$this-&gt;all_param] );
    }
}</pre>
<p>For the address I use a very simple approach: a GET parameter named <code>all</code>. You may change the name here; just stay with ASCII chars from a—z. <samp lang="ru">все_сообщения</samp> will get you in trouble!</p>
<p>Next we need a constructor that manages our work:</p>
<pre lang="php">
    public function __construct()
    {
        /* Register the query argument. */
        add_filter(&#039;query_vars&#039;, array ( $this, &#039;add_query_arg&#039;) );

        /* Hook into the query. */
        add_action(&#039;pre_get_posts&#039;, array ( $this, &#039;view_all_posts&#039;) );
    }</pre>
<p>The constructor references two internal functions – <code>add_query_arg()</code> and view_all_posts(), which we build next:</p>
<pre lang="php">
    /**
     * Registers the query arg in WordPress.
     * Otherwise it will be unset.
     *
     * @param  array $vars Already registered query args.
     * @return array
     */
    public function add_query_arg( array $vars )
    {
        return array_merge( $vars, array ( $this-&gt;query_arg ) );
    }

    /**
     * Alters the query to remove the paging.
     * @return void
     */
    public function view_all_posts()
    {
        if ( ! $this-&gt;is_all_posts() )
        {
            return;
        }

        $GLOBALS&#091&#039;wp_query&#039;]-&gt;query_vars&#091&#039;nopaging&#039;] = TRUE;

        return;
    }</pre>
<p>The first function just registers our GET parameter in WordPress. The second alters the query to the database and removes the paging.</p>
<p>We are almost done. A template tag for the link would be nice, wouldn’t it?</p>
<pre lang="php">
    /**
     * Creates the markup for the link.
     *
     * Usage in archive.php, category.php or search.php:
     * $GLOBALS&#091&#039;view_all_posts&#039;]-&gt;get_allposts_link();
     *
     * @param  string $text Linktext
     * @param  bool   $print echo or return
     * @return string|void
     */
    public function get_allposts_link(
        $text   = &#039;View all posts&#039;
    ,   $before = &#039;&lt;p class=&quot;allpostslink&quot;&gt;&#039;
    ,   $after  = &#039;&lt;/p&gt;;&#039;
    ,   $print  = TRUE
    )
    {
        if ( $this-&gt;is_all_posts()
         or $GLOBALS&#091&#039;wp_query&#039;]-&gt;found_posts &lt;= get_option(&#039;posts_per_page&#039;)
        )
        {   // No link needed.
            return;
        }

        if ( isset ( $_SERVER&#091&#039;QUERY_STRING&#039;] )
            &amp;&amp; ! empty ( $_SERVER&#091&#039;QUERY_STRING&#039;] )
        )
        {
            /* We have already visible GET parameters: /?hello=world. */
            $new_url = $_SERVER&#091&#039;REQUEST_URI&#039;] . &#039;&amp;&#039;;
        }
        else
        {
            /* Note the difference: REQUEST_URL doesn&#039;t include
             * the query string while REQUEST_URI does. */
            $new_url = $_SERVER&#091&#039;REQUEST_URL&#039;] . &#039;?&#039;;
        }

        $link = &quot;$before&lt;a href=&#039;$new_url$this-&gt;all_param&#039;&gt;$text&lt;/a&gt;$after&quot;;

        if ( $print )
        {
            print $link;
            return;
        }
        return $link;
    }</pre>
<p>Note: <code>$GLOBALS['wp_query']->found_posts</code> holds the sum of all posts for a given query, not just for the current page. Useful if you want to print out the total number on a paged archive.</p>
<p>If you want to avoid duplicate content, hide the full archives from search engines in your header:</p>
<pre lang="php">    /**
     * Prevents indexing from search engines.
     *
     * Add this as an action to &#039;wp_head&#039;.
     *
     * @return void
     */
    public function meta_noindex()
    {
        if ( $this-&gt;is_all_posts() )
        {
             print &#039;&lt;meta name=&quot;robots&quot; content=&quot;noindex&quot;&gt;&#039;;
        }
    }</pre>
<p>Our class is complete. Now we put an object of the class into the global namespace …</p>
<pre lang="php">$GLOBALS&#091&#039;view_all_posts&#039;] = new View_All_Posts;</pre>
<p>… add an action to <code>wp_head</code> …</p>
<pre lang="php">
add_action(
    &#039;wp_head&#039;
,   array ( $GLOBALS&#091&#039;view_all_posts&#039;], &#039;meta_noindex&#039; )
);</pre>
<p>… and include the file into the functions.php of our theme:</p>
<pre lang="php">
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR
    . &#039;class.View_All_Posts.php&#039;;</pre>
<p>In our archive templates (archive.php, category.php, search.php) we print the link:</p>
<pre lang="php">
$GLOBALS&#091&#039;view_all_posts&#039;]-&gt;get_allposts_link();
</pre>
<p>Done.</p>
<p>…</p>
<p>Oh, wait … maybe you want to see the full code? And a download link?</p>
<p>Here’s the link: <a href="http://gist.github.com/gists/451940/download">Download class.View_All_Posts.php</a></p>
<p>The complete code:</p>
<pre lang="php">/**
 * Adds a view all posts page to any query.
 * @author Thomas Scholz http://toscho.de
 * @version 1.1
 */
class View_All_Posts
{
    /**
     * GET parameter to trigger a complete, not paged archive.
     * @var string
     */
    protected $all_param = &#039;all&#039;;

    public function __construct()
    {
        /* Register the query argument. */
        add_filter(&#039;query_vars&#039;, array ( $this, &#039;add_query_arg&#039;) );

        /* Hook into the query. */
        add_action(&#039;pre_get_posts&#039;, array ( $this, &#039;view_all_posts&#039;) );
    }

    /**
     * Registers the query arg in WordPress.
     * Otherwise it will be unset.
     *
     * @param  array $vars Already registered query args.
     * @return array
     */
    public function add_query_arg( array $vars )
    {
        return array_merge( $vars, array ( $this-&gt;query_arg ) );
    }

    /**
     * Alters the query to remove the paging.
     * @return void
     */
    public function view_all_posts()
    {
        if ( ! $this-&gt;is_all_posts() )
        {
            return;
        }

        $GLOBALS&#091&#039;wp_query&#039;]-&gt;query_vars&#091&#039;nopaging&#039;] = TRUE;

        return;
    }

    /**
     * Are we there already?
     *
     * @return bool
     */
    public function is_all_posts()
    {
        return isset ( $_GET&#091$this-&gt;all_param] );
    }

    /**
     * Creates the markup for the link.
     *
     * Usage in archive.php, category.php or search.php:
     * $GLOBALS&#091&#039;view_all_posts&#039;]-&gt;get_allposts_link();
     *
     * @param  string $text Linktext
     * @param  bool   $print echo or return
     * @return string|void
     */
    public function get_allposts_link(
        $text   = &#039;View all posts&#039;
    ,   $before = &#039;&lt;p class=&quot;allpostslink&quot;&gt;&#039;
    ,   $after  = &#039;&lt;/p&gt;&#039;
    ,   $print  = TRUE
    )
    {
        if ( $this-&gt;is_all_posts()
        or $GLOBALS&#091&#039;wp_query&#039;]-&gt;found_posts &lt;= get_option(&#039;posts_per_page&#039;)
        )
        {   // No link needed.
            return;
        }

        if ( isset ( $_SERVER&#091&#039;QUERY_STRING&#039;] )
            &amp;&amp; ! empty ( $_SERVER&#091&#039;QUERY_STRING&#039;] )
        )
        {
            /* We have already visible GET parameters: /?hello=world. */
            $new_url = $_SERVER&#091&#039;REQUEST_URI&#039;] . &#039;&amp;&#039;;
        }
        else
        {
            /* Note the difference: REQUEST_URL doesn&#039;t include
             * the query string while REQUEST_URI does. */
            $new_url = $_SERVER&#091&#039;REQUEST_URL&#039;] . &#039;?&#039;;
        }

         $link = &quot;$before&lt;a href=&#039;$new_url$this-&gt;all_param&#039;&gt;$text&lt;/a&gt;$after&quot;;

        if ( $print )
        {
            print $link;
            return;
        }
        return $link;
    }
}

$GLOBALS&#091&#039;view_all_posts&#039;] = new View_All_Posts;</pre>
<p>Mission completed. Any suggestions?</p>
<h4>Guest Post</h4>
<p><img src="http://wpengineer.com/wp-content/uploads/toscho.png" alt="Thomas Scholz" title="Thomas Scholz" width="32" height="32" class="alignleft size-full wp-image-2032" />This post is written by Thomas Scholz <a href="http://toscho.de" class="liexternal">toscho.de</a>, a good friend of us and a web designer from Halle, Germany.</p>
<p>Thank you very much from our part to Thomas.</p>
<hr />
<p><img style="float:left;" src="http://wpengineer.com/favicon.ico" alt="WP Engineer Favicon"/> Thanks for subscribing our feed! <a href="http://buysellads.com/buy/detail/3646/">Sponsor the WP Engineer Blog</a> and get your brand in front of several hundred users per day!<br />
&copy; <a href="http://wpengineer.com/">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpengineer.com/2031/how-to-list-all-posts-of-an-archive-a-category-or-a-search-result/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
