<?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 &#187; Search</title>
	<atom:link href="http://wpengineer.com/tag/search/feed/" rel="self" type="application/rss+xml" />
	<link>http://wpengineer.com</link>
	<description>WordPress News, Hacks, Tips, Tutorials, Plugins and Themes</description>
	<lastBuildDate>Mon, 21 May 2012 22:48:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Change the Search-URL of WordPress</title>
		<link>http://wpengineer.com/2258/change-the-search-url-of-wordpress/</link>
		<comments>http://wpengineer.com/2258/change-the-search-url-of-wordpress/#comments</comments>
		<pubDate>Tue, 06 Sep 2011 09:16:39 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[WordPress Hacks]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Search]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WP]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=2258</guid>
		<description><![CDATA[With WordPress it is easy to activate readable URLs. Only the search page is not affected by the setting yet, it comes with the syntax ?s as default. But there is a solution to change the URL as you wish. The following example shows that even if you have permalinks activated, that the URL for [...]]]></description>
			<content:encoded><![CDATA[<p>With WordPress it is easy to activate readable URLs. Only the search page is not affected by the setting yet, it comes with the syntax ?s as default. But there is a solution to change the URL as you wish.</p>
<p>The following example shows that even if you have permalinks activated, that the URL for the two searchterms <em>wordpress</em> and <em>consulting</em> looks like this: <code>bueltge.de/?s=wordpress+consulting&#038;submit=Search</code>. With a little function, which communicates with the redirect, you can adjust the URL. In my case the URL with the two searchterms look like this with the following function: <code>bueltge.de/search/wordpress+consulting</code>.<br />
<span id="more-2258"></span><br />
Within WP-function <code>wp_redirect</code> I set the output, that the term <em>search</em> will be added to the <em>home-url</em> of your installation and added by the searchterms. There are many possibilities to adjust the URL.</p>
<pre>
function fb_change_search_url_rewrite() {
	if ( is_search() &amp;&amp; ! empty( $_GET&#091;&#039;s&#039;&#093; ) ) {
		wp_redirect( home_url( &quot;/search/&quot; ) . urlencode( get_query_var( &#039;s&#039; ) ) );
		exit();
	}
}
add_action( &#039;template_redirect&#039;, &#039;fb_change_search_url_rewrite&#039; );
</pre>
<p>Yes, it is also possible via htacces rules, but the source is an example for custom solutions on an redirect.</p>
<pre>
# search redirect
# this will take anything in the query string, minus any extraneous values, and turn them into a clean working url
RewriteCond %{QUERY_STRING} \\?s=(&#091;^&amp;&#093;+) &#091;NC&#093;
RewriteRule ^$ /search/%1/? &#091;NC,R,L&#093;
</pre>
<p>I would recommend to put the function in a Plugin or in the <code>functions.php</code> of your theme. Any other or better ideas to accomplish this? Please let us know in the comment area.<br />
<hr /><a href="http://wpplugins.com/plugin/281/snippets" title="More informations about this plugin for WordPress"><img src="http://wpengineer.com/wp-content/themes/wpe-3/images/snippets-125-125.png" height="90" alt="WordPress Snippet Plugin" /></a> <a href="http://xtreme-theme.com"><img src="http://wpengineer.com/wp-content/uploads/feed-banner-2.jpg" alt="Xtreme One WordPress Framework"/></a><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/2258/change-the-search-url-of-wordpress/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
		<item>
		<title>Search Form in WP Nav Menu</title>
		<link>http://wpengineer.com/2244/search-form-in-wp-nav-menu/</link>
		<comments>http://wpengineer.com/2244/search-form-in-wp-nav-menu/#comments</comments>
		<pubDate>Fri, 29 Jul 2011 08:41:15 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[WordPress Tutorials]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Search]]></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=2244</guid>
		<description><![CDATA[The WP Nav Menu is very popular and WordPress users love to implement their content in the navigation that way. Many users also like to have a search field in their navigation. In this context I found some horrible written solutions to implement the search field in the navigation. That's why I thought I write [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://codex.wordpress.org/Function_Reference/wp_nav_menu" title="Doku im Codex">WP Nav Menu</a> is very popular and WordPress users love to implement their content in the navigation that way. Many users also like to have a search field in their navigation. In this context I found some horrible written solutions to implement the search field in the navigation. That's why I thought I write a simple yet efficient solution to have the search field in your navigation. <span id="more-2244"></span></p>
<p>For this solution I'm using the default search function - <code>get_search_form()</code>. If you use it on another spot as well, please pay attention to the stylesheet. Otherwise the following snippet is sufficient to implement the search field in your navigation.</p>
<p><img src="http://wpengineer.com/wp-content/uploads/search-wp-nav-menu.png" alt="" title="search-wp-nav-menu" width="600" height="223" class="aligncenter size-full wp-image-2245" /></p>
<p>This function and the call belongs into <code>functions.php</code> of the theme and the adjustment of the stylesheet in the according file of the theme, most of the time it is <code>style.css</code>.</p>
<pre>
function fb_add_search_box ( $items, $args ) {

	// only on primary menu
	if( &#039;primary&#039; === $args -&gt; theme_location )
		$items .= &#039;&lt;li class=&quot;menu-item menu-item-search&quot;&gt;&#039; . get_search_form( FALSE ) . &#039;&lt;/li&gt;&#039;;

	return $items;
}
add_filter( &#039;wp_nav_menu_items&#039;, &#039;fb_add_search_box&#039;, 10, 2 );
</pre>
<p>If you like to implement the search form only in a specific navigation; you just need to call the entry <code>theme_location</code> of the argument array. If it's the menu with the string n, then ... - an example:<br />
<code>if( 'primary' === $args -&gt; theme_location )</code></p>
<p><img src="http://wpengineer.com/wp-content/uploads/search-wp-nav-menu2.png" alt="" title="search-wp-nav-menu2" width="514" height="341" class="aligncenter size-full wp-image-2246" /></p>
<p>The key of the call is defined in your theme, therefore easy to find in the backend, as you can see in the screenshot above. Have fun with it!<br />
<hr /><a href="http://wpplugins.com/plugin/281/snippets" title="More informations about this plugin for WordPress"><img src="http://wpengineer.com/wp-content/themes/wpe-3/images/snippets-125-125.png" height="90" alt="WordPress Snippet Plugin" /></a> <a href="http://xtreme-theme.com"><img src="http://wpengineer.com/wp-content/uploads/feed-banner-2.jpg" alt="Xtreme One WordPress Framework"/></a><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/2244/search-form-in-wp-nav-menu/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Exclude Posts and Pages in WordPress Search</title>
		<link>http://wpengineer.com/2176/exclude-posts-and-pages-in-wordpress-search/</link>
		<comments>http://wpengineer.com/2176/exclude-posts-and-pages-in-wordpress-search/#comments</comments>
		<pubDate>Wed, 26 Jan 2011 10:57:51 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[WordPress Hacks]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Search]]></category>
		<category><![CDATA[WordPress Tutorials]]></category>
		<category><![CDATA[WP]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=2176</guid>
		<description><![CDATA[Sometimes you don't like to display every post and page on search results. Today I like to show you how to filter the search in your frontend. Therefore I add a filter to the query of WordPress and exclude the according posts or pages of the search. We exclude posts and pages by their ID, [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes you don't like to display every post and page on search results. Today I like to show you how to filter the search in your frontend. Therefore I add a filter to the query of WordPress and exclude the according posts or pages of the search.<br />
<span id="more-2176"></span><br />
We exclude posts and pages by their ID, which we will give to an array and so exclude several posts and pages.</p>
<p>In our first code example the IDs are set in the array. The filter is only working if it is the search <em>is_search</em> and if you are not ! in the backend <em>is_admin</em>.</p>
<pre>
// search filter
function fb_search_filter($query) {

    if ( !$query-&gt;is_admin &amp;&amp; $query-&gt;is_search) {
        $query-&gt;set(&#039;post__not_in&#039;, array(40, 9) ); // id of page or post
    }

    return $query;
}
add_filter( &#039;pre_get_posts&#039;, &#039;fb_search_filter&#039; );
</pre>
<p>If you like to exclude the subpage of a page, then you can add it to the ID.</p>
<pre>
// search filter
function fb_search_filter($query) {

    if ( !$query-&gt;is_admin &amp;&amp; $query-&gt;is_search) {
        $pages = array(2, 40, 9); // id of page or post
        // find children to id
        foreach( $pages as $page ) {
            $childrens = get_pages( array(&#039;child_of&#039; =&gt; $page, &#039;echo&#039; =&gt; 0) );
        }
        // add id to array
        for($i = 0; $i &lt; sizeof($childrens); ++$i) {
            $pages&#091;&#093; = $childrens&#091;$i&#093;-&gt;ID;
        }
        $query-&gt;set(&#039;post__not_in&#039;, $pages );
    }

    return $query;
}
add_filter( &#039;pre_get_posts&#039;, &#039;fb_search_filter&#039; );
</pre>
<p>There are many possibilities and I hope I was able to give you a starting point if you like to exclude posts and pages in your search.<br />
<hr /><a href="http://wpplugins.com/plugin/281/snippets" title="More informations about this plugin for WordPress"><img src="http://wpengineer.com/wp-content/themes/wpe-3/images/snippets-125-125.png" height="90" alt="WordPress Snippet Plugin" /></a> <a href="http://xtreme-theme.com"><img src="http://wpengineer.com/wp-content/uploads/feed-banner-2.jpg" alt="Xtreme One WordPress Framework"/></a><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/2176/exclude-posts-and-pages-in-wordpress-search/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Add Menus to the Admin Bar of WordPress</title>
		<link>http://wpengineer.com/2113/add-menus-to-the-admin-bar-of-wordpress/</link>
		<comments>http://wpengineer.com/2113/add-menus-to-the-admin-bar-of-wordpress/#comments</comments>
		<pubDate>Fri, 17 Dec 2010 10:30:17 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[WordPress Tutorials]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[Search]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WP]]></category>
		<category><![CDATA[wp3.1]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=2113</guid>
		<description><![CDATA[The new WordPress admin bar facilitates the access of backend and frontend to areas of the back end. Of course, this new control element of WordPress is expandable and can be adapted to the needs of the user. In some areas and for various needs, quick access to different areas is certainly interesting. The newly [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://wpengineer.com/wp-content/uploads/WordPress-Christmas-2010-17.jpg" alt="" title="WordPress-Christmas-2010-17" width="400" height="267" class="aligncenter size-full wp-image-2144" /><br />
The new WordPress admin bar facilitates the access of backend and frontend to areas of the back end. Of course, this new control element of WordPress is expandable and can be adapted to the needs of the user. In some areas and for various needs, quick access to different areas is certainly interesting.</p>
<p><a href="http://wpengineer.com/wp-content/uploads/custom-admin-bar.png"><img class="aligncenter size-medium wp-image-2126" title="custom-admin-bar" src="http://wpengineer.com/wp-content/uploads/custom-admin-bar-300x71.png" alt="" width="300" height="71" /></a></p>
<p>The newly created menus can be adapted as usual rights to the appropriate roles. A small example will demonstrate the integration.<br />
<span id="more-2113"></span><br />
Within the Admin Bar you can represent hierarchies, which are then coupled with a default Admin Bar with a mouse over effect. In the following example, a search on the WordPress Codex is integrated in the Admin bar. There are still things to do in terms of CSS, but I think this example points out some possibilities and can be used for your own ideas and requirements.</p>
<pre>function wp_codex_search_form() {
    global $wp_admin_bar, $wpdb;

    if ( !is_super_admin() || !is_admin_bar_showing() )
        return;

    $codex_search = &#039;
&lt;form style=&quot;margin: 5px 0 0;&quot; action=&quot;http://wordpress.org/search/do-search.php&quot; method=&quot;get&quot;&gt;
        &lt;input class=&quot;adminbar-input&quot; maxlength=&quot;100&quot; name=&quot;search&quot; size=&quot;13&quot; type=&quot;text&quot; value=&quot;&#039; . __( &#039;Search the Codex&#039;, &#039;textdomain&#039; ) . &#039;&quot; /&gt;
        &lt;button class=&quot;adminbar-button&quot;&gt;
            &lt;span&gt;Go&lt;/span&gt;
        &lt;/button&gt;
    &lt;/form&gt;

&#039;;

    /* Add the main siteadmin menu item */
    $wp_admin_bar-&gt;add_menu( array( &#039;id&#039; =&gt; &#039;codex_search&#039;, &#039;title&#039; =&gt; __( &#039;Search the Codex&#039;, &#039;textdomain&#039; ), &#039;href&#039; =&gt; FALSE ) );
    $wp_admin_bar-&gt;add_menu( array( &#039;parent&#039; =&gt; &#039;codex_search&#039;, &#039;title&#039; =&gt; $codex_search, &#039;href&#039; =&gt; FALSE ) );
}
add_action( &#039;admin_bar_menu&#039;, &#039;wp_codex_search_form&#039;, 1000 );</pre>
<p>The function <code>add_menu()</code> accepts certain parameters:</p>
<ul>
<li><code>title</code> - default false</li>
<li><code>href</code> - default false,</li>
<li><code>parent</code> - default false - pass the ID value for a submenu of that menu</li>
<li><code>id</code> - defaults to a sanitized title value.</li>
<li><code>meta</code> - default false - array of any of the following options: <code>array( 'html' =&gt; '', 'class' =&gt; '', 'onclick' =&gt; '', target =&gt; ''</code> );</li>
</ul>
<hr /><a href="http://wpplugins.com/plugin/281/snippets" title="More informations about this plugin for WordPress"><img src="http://wpengineer.com/wp-content/themes/wpe-3/images/snippets-125-125.png" height="90" alt="WordPress Snippet Plugin" /></a> <a href="http://xtreme-theme.com"><img src="http://wpengineer.com/wp-content/uploads/feed-banner-2.jpg" alt="Xtreme One WordPress Framework"/></a><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/2113/add-menus-to-the-admin-bar-of-wordpress/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Disable WordPress Search</title>
		<link>http://wpengineer.com/1042/disable-wordpress-search/</link>
		<comments>http://wpengineer.com/1042/disable-wordpress-search/#comments</comments>
		<pubDate>Fri, 17 Apr 2009 10:53:44 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[WordPress Hacks]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Search]]></category>
		<category><![CDATA[Theme]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Plugins]]></category>
		<category><![CDATA[WordPress Themes]]></category>
		<category><![CDATA[WordPress Tutorials]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=1042</guid>
		<description><![CDATA[Not always is the search in WordPress desired. The one or another application with WordPress doesn't need this feature. Even if it is an added value in my opinion. In some cases, it still shouldn't be displayed and so I have them deactivated with access to two hooks. For now, I can see no other [...]]]></description>
			<content:encoded><![CDATA[<p>Not always is the search in WordPress desired. The one or another application with WordPress doesn't need this feature. Even if it is an added value in my opinion. In some cases, it still shouldn't be displayed and so I have them deactivated with access to two hooks. For now, I can see no other place where you could access it in my applications and it works so smoothly.<br />
<span id="more-1042"></span><br />
The second call of the Hook <code>get_search_form</code> is just to take out the search from the frontend, so you should start the two hooks only if you are not <strong>in</strong> the admin: <code>if ( !is_admin() )</code> .</p>
<p>If you set the variable <code>$error</code> to <code>true</code>, then you will be fowarded to the error page of the theme, if not, then you will remain on the page from where the search was started. </p>
<pre lang="php">
function fb_filter_query( $query, $error = true ) {

	if ( is_search() ) {
		$query-&gt;is_search = false;
		$query-&gt;query_vars&#091;s&#093; = false;
		$query-&gt;query&#091;s&#093; = false;

		// to error
		if ( $error == true )
			$query-&gt;is_404 = true;
	}
}

add_action( &#039;parse_query&#039;, &#039;fb_filter_query&#039; );
add_filter( &#039;get_search_form&#039;, create_function( &#039;$a&#039;, &quot;return null;&quot; ) );
</pre>
<p>Additions, improvements or criticism - let us know! The comment field is as always open, and the solution is delighted when it will be refined.<br />
<hr /><a href="http://wpplugins.com/plugin/281/snippets" title="More informations about this plugin for WordPress"><img src="http://wpengineer.com/wp-content/themes/wpe-3/images/snippets-125-125.png" height="90" alt="WordPress Snippet Plugin" /></a> <a href="http://xtreme-theme.com"><img src="http://wpengineer.com/wp-content/uploads/feed-banner-2.jpg" alt="Xtreme One WordPress Framework"/></a><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/1042/disable-wordpress-search/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>PHP Cross Reference of WordPress Source</title>
		<link>http://wpengineer.com/898/php-cross-reference-of-wordpress-source/</link>
		<comments>http://wpengineer.com/898/php-cross-reference-of-wordpress-source/#comments</comments>
		<pubDate>Sat, 07 Mar 2009 09:44:31 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[WordPress News]]></category>
		<category><![CDATA[Search]]></category>
		<category><![CDATA[template tag]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WP]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=898</guid>
		<description><![CDATA[Yesterday, we have post over the faster search for the WordPress codex WPLookup and today we give you a nice search for the reference of different WordPress versions from Joost de Valk. Yoast write over his search tools: This site provides a PHP Cross Reference of the WordPress and BBPress source, using PHPXref. The Trunk [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://wpengineer.com/wp-content/uploads/wordpress-125.png" alt="wordpress" title="wordpress" width="125" height="125" class="alignright size-full wp-image-907" /><br />
Yesterday, we have post over the faster search for the WordPress codex <a href="http://wpengineer.com/wplockup-fast-search-in-wordpress-codex/">WPLookup</a> and today we give you a nice <a href="http://xref.yoast.com/simple-search.html">search</a> for the reference of different WordPress versions from <a href="http://yoast.com/">Joost de Valk</a>.<br />
<span id="more-898"></span><br />
Yoast write over his <a href="http://xref.yoast.com/">search tools</a>:</p>
<blockquote><p>This site provides a PHP Cross Reference of the WordPress and BBPress source, using PHPXref. The Trunk versions are updated from SVN every 30 minutes, and major new releases will be added here as soon as possible.</p>
<p>For future use, bookmark this search page, that'll load faster and has all the search options, or install one of the search plugins below!</p></blockquote>
<p class="aligncenter"><object class="center" width="400" height="225"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=2937497&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=1&amp;color=&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=2937497&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=1&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="225"></embed></object><br /><a href="http://vimeo.com/2937497">PHP Cross Reference of WordPress</a> from <a href="http://vimeo.com/yoast">Joost de Valk</a> on <a href="http://vimeo.com">Vimeo</a></p>
<p>.</p>
<hr /><a href="http://wpplugins.com/plugin/281/snippets" title="More informations about this plugin for WordPress"><img src="http://wpengineer.com/wp-content/themes/wpe-3/images/snippets-125-125.png" height="90" alt="WordPress Snippet Plugin" /></a> <a href="http://xtreme-theme.com"><img src="http://wpengineer.com/wp-content/uploads/feed-banner-2.jpg" alt="Xtreme One WordPress Framework"/></a><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/898/php-cross-reference-of-wordpress-source/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>OpenSearch &#8211; Search Field For Mozilla And Internet Explorer With WordPress</title>
		<link>http://wpengineer.com/239/opensearch-search-field-for-mozilla-and-internet-explorer-with-wordpress/</link>
		<comments>http://wpengineer.com/239/opensearch-search-field-for-mozilla-and-internet-explorer-with-wordpress/#comments</comments>
		<pubDate>Thu, 16 Oct 2008 13:37:06 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[WordPress Tutorials]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Search]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=239</guid>
		<description><![CDATA[Nowadays search field in your browser improved quite a bit, even IE supports OpenSearch format. But what is so great about OpenSearch and how easy it is to use with your WordPress installation has two aspects: WordPress comes already with OpenSearch and it's easy configurable with XML. You just have to put a link in [...]]]></description>
			<content:encoded><![CDATA[<p>Nowadays search field in your browser improved quite a bit, even IE supports OpenSearch format. But what is so great about OpenSearch and how easy it is to use with your WordPress installation has two aspects: WordPress comes already with <a href="http://www.opensearch.org/">OpenSearch</a> and it's easy configurable with XML.</p>
<p><img src="http://wpengineer.com/wp-content/uploads/ieos.png" alt="in IE 7" title="ieos" width="336" height="204" class="aligncenter size-full wp-image-240" /></p>
<p>You just have to put a link in your theme and a xml file on your server to let the browser know that your blog supports the search field. So go ahead and improve your Plugin with little work and no use of a Plugin.</p>
<p>The following code should explain it. Adjust the syntax and link to the favicon and xml-file.</p>
<p>After you uploaded both files (<em>favicon.ico</em> und <em>os.xml</em>) add a link into the <em>header.php</em> of your theme. You can use the code one by one if you put os.xml in your root. After that it's possible to integrate your blog in Firefox and Internet Explorer.</p>
<p><img src="http://wpengineer.com/wp-content/uploads/ffos.png" alt="" title="ffos" width="316" height="450" class="aligncenter size-full wp-image-241" /></p>
<p>The declaration of each XML tag is well documented on <a href="http://www.opensearch.org/Specifications/OpenSearch/1.1">the OpenSearch website</a>.</p>
<h3>for the head area in your template - header.php:</h3>
<pre lang="php">
&lt;link rel=&quot;search&quot; type=&quot;application/opensearchdescription+xml&quot; title=&quot;&lt;?php bloginfo(&#039;name&#039;); ?&gt;&quot; href=&quot;&lt;?php bloginfo(&#039;url&#039;); ?&gt;/os.xml&quot; /&gt;
</pre>
<h3>XML file:</h3>
<p>Copy code, adjust and save as <em>os.xml</em>, then upload on your server.</p>
<pre lang="xml">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;OpenSearchDescription xmlns=&quot;http://a9.com/-/spec/opensearch/1.1/&quot;&gt;
	&lt;ShortName&gt;bueltge.de &#091;by:ltge.de&#093;&lt;/ShortName&gt;
	&lt;Description&gt;Use bueltge.de to search on blog.&lt;/Description&gt;
	&lt;Url type=&quot;text/html&quot; method=&quot;get&quot; template=&quot;http://bueltge.de/?s={searchTerms}&quot;&gt;&lt;/Url&gt;
	&lt;Contact&gt;info@bueltge.de&lt;/Contact&gt;
	&lt;LongName&gt;bueltge.de &#091;by:ltge.de&#093; Weblog Search&lt;/LongName&gt;
	&lt;Image height=&quot;16&quot; width=&quot;16&quot; type=&quot;image/x-icon&quot;&gt;http://bueltge.de/favicon.ico&lt;/Image&gt;
	&lt;Tags&gt;Weblog WordPress Webdevelopment&lt;/Tags&gt;
	&lt;Url type=&quot;application/atom+xml&quot; template=&quot;http://bueltge.de/?q={searchTerms}&amp;pw={startPage?}&amp;format=atom&quot;/&gt;
	&lt;Url type=&quot;application/rss+xml&quot; template=&quot;http://bueltge.de/?q={searchTerms}&amp;pw={startPage?}&amp;format=rss&quot;/&gt;
	&lt;Url type=&quot;text/html&quot; template=&quot;http://bueltge.de/?q={searchTerms}&amp;pw={startPage?}&quot;/&gt;
	&lt;Query role=&quot;example&quot; searchTerms=&quot;blog&quot;/&gt;
	&lt;Developer&gt;Frank Bueltge&lt;/Developer&gt;
	&lt;Attribution&gt;
	    Search data Copyright 2007, bueltge.de &#091;by:ltge.de&#093;, All Rights Reserved
	&lt;/Attribution&gt;
	&lt;SyndicationRight&gt;open&lt;/SyndicationRight&gt;
	&lt;AdultContent&gt;false&lt;/AdultContent&gt;
	&lt;Language&gt;de-DE&lt;/Language&gt;
	&lt;OutputEncoding&gt;UTF-8&lt;/OutputEncoding&gt;
	&lt;InputEncoding&gt;UTF-8&lt;/InputEncoding&gt;
&lt;/OpenSearchDescription&gt;
</pre>
<hr /><a href="http://wpplugins.com/plugin/281/snippets" title="More informations about this plugin for WordPress"><img src="http://wpengineer.com/wp-content/themes/wpe-3/images/snippets-125-125.png" height="90" alt="WordPress Snippet Plugin" /></a> <a href="http://xtreme-theme.com"><img src="http://wpengineer.com/wp-content/uploads/feed-banner-2.jpg" alt="Xtreme One WordPress Framework"/></a><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/239/opensearch-search-field-for-mozilla-and-internet-explorer-with-wordpress/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>iGoogle Gadget for your Blog</title>
		<link>http://wpengineer.com/65/igoogle-gadget-for-your-blog/</link>
		<comments>http://wpengineer.com/65/igoogle-gadget-for-your-blog/#comments</comments>
		<pubDate>Thu, 25 Sep 2008 19:56:43 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[WPengineer Misc]]></category>
		<category><![CDATA[gadget]]></category>
		<category><![CDATA[igoogle]]></category>
		<category><![CDATA[Search]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=65</guid>
		<description><![CDATA[Since my wife uses her own computer and explores all the possibilities, I got a lot questions and found some interesting tools because of her. One of them is iGoogle. Experimenting with it makes every newbie happy and it is very easy to configure. I came to the idea to offer the blog as a [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://fusion.google.com/add?source=atgs&#038;moduleurl=http%3A//wpengineer.com/igoogle/wpengineer.xml"><img class="alignright" src="http://gmodules.com/ig/images/plus_google.gif" border="0" alt="Add to Google" /></a><br />
Since my wife uses her own computer and explores all the possibilities, I got a lot questions and found some interesting tools because of her. One of them is iGoogle. Experimenting with it makes every newbie happy and it is very easy to configure.</p>
<p>I came to the idea to offer the blog as a gadget for iGoogle. Everybody who likes to do the same can use this tutorial and doesn't have to work through the <a href="http://www.google.com/intl/apis/gadgets/publish.html">Documentation</a> of Google.<br />
<span id="more-65"></span></p>
<p>It's easy to create a iGoogle Gadget. But you should have knowledge in HTML and CSS. Since WordPress offers a standard search, I created the gadget so you can search in iGoogle on your blog.<br />
Now we have another source where user can search. You can create the gadgets on every page. In this case it's a search for a WordPress blog, but it works for every other search too, you just have to know the name of the search field.</p>
<h3>Preparing iGoogle gadget</h3>
<p>The Gadget is only a referral to a page, like a frame, which shows the website. Because of that, we have to create a page, which get referred via XML. In the XML file are all data included which Google needs.</p>
<p>For this purpose I created a folder, where the data for the gadget will be available - <a href="http://wpengineer.com/igoogle/">iGoogle</a>. You create a static page with search in your folder.</p>
<pre lang="php">
&lt;form id=&quot;search&quot; action=&quot;http://wpengineer.com/&quot; method=&quot;get&quot;&gt;
&lt;input id=&quot;s&quot; name=&quot;s&quot; type=&quot;text&quot; value=&quot;search ...&quot; /&gt;
&lt;input id=&quot;submit&quot; class=&quot;hide&quot; type=&quot;submit&quot; value=&quot;search&quot; /&gt;
&lt;/form&gt;
</pre>
<p>I equipped the search field with JavaScript, so the search field looks a little bit more attractive. The form gets the attribute <code>action</code> the address of the blog and the <code>input</code>-field must have the name <code>s</code> , since WordPress trigger the search because of this. Important is also the declaration of the attribute <code>target="_top"</code>, otherwise the search would happen in the gadget window.</p>
<p>My <code>index.php</code> looks like this. Basically is a simple HTML page sufficient, your fantasies have no limits. But pay attention that your gadget could come off very small, depends on the resolution.</p>
<pre lang="html4strict">
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head&gt;
	&lt;title&gt;WP Engineer &middot; iGoogle Gadget&lt;/title&gt;
	&lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html; charset=UTF-8&quot; /&gt;
	&lt;meta name=&quot;robots&quot; content=&quot;ALL&quot; /&gt;
	&lt;meta name=&quot;description&quot; content=&quot;Search at WP Engineer through iGoogle&quot; /&gt;
	&lt;meta name=&quot;author&quot; content=&quot;Frank Bueltge&quot; /&gt;
	&lt;meta name=&quot;reply-to&quot; content=&quot;frank@bueltge.de&quot; /&gt;
	&lt;link rel=&quot;shortcut icon&quot; href=&quot;http://wpengineer.com/blog/favicon.ico&quot; /&gt;
	&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;style.css&quot; media=&quot;screen&quot;/&gt;
	&lt;!--&#091;if lt IE 8&#093;&gt;&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;ie.css&quot; media=&quot;screen&quot;/&gt;&lt;!&#091;endif&#093;--&gt;
&lt;/head&gt;
&lt;body&gt;
	&lt;div id=&quot;header&quot;&gt;
		&lt;h1&gt;&lt;a href=&quot;http://wpengineer.com/&quot; title=&quot;WP Engineer&quot; target=&quot;_top&quot;&gt;WP Engineer&lt;/a&gt;&lt;/h1&gt;
		&lt;form id=&quot;search&quot; action=&quot;http://wpengineer.com/&quot; target=&quot;_top&quot; method=&quot;get&quot;&gt;
			&lt;p&gt;
				&lt;input name=&quot;s&quot; id=&quot;s&quot; value=&quot;search ...&quot; onfocus=&quot;if(this.value==&#039;search ...&#039;)this.value=&#039;&#039;&quot; onblur=&quot;if(this.value==&#039;&#039;)this.value=&#039;search...&#039;&quot; type=&quot;text&quot; /&gt;
				&lt;input type=&quot;submit&quot; id=&quot;submit&quot; value=&quot;search&quot; class=&quot;hide&quot; /&gt;
			&lt;/p&gt;
		&lt;/form&gt;
	&lt;/div&gt;
	&lt;div id=&quot;footer&quot;&gt;
		&lt;p&gt;&copy; &lt;a href=&quot;http://wpengineer.com/&quot; title=&quot;WP Engineer&quot; target=&quot;_top&quot;&gt;WP Engineer&lt;/a&gt; mit iGoogle&trade; Gadget &lt;?php echo date(&#039;Y&#039;); ?&gt;&lt;/p&gt;
	&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>Additional you create your CSS to design your search page as you want to. But don't forget the gadget could be very small!</p>
<h3>Gadget XML Structure</h3>
<p>You have to create a XML in your folder to give Google information.<br />
Here is a following example, which you can adjust for your needs. Just upload and done.</p>
<pre lang="xml">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;Module&gt;
&lt;ModulePrefs
title=&quot;WP Engineer Search&quot;
height=&quot;200&quot;
width=&quot;400&quot;
author=&quot;Frank Bueltge&quot;
author_email=&quot;frank@bueltge.de&quot;
description=&quot;WP Engineer Search&quot;
thumbnail=&quot;http://wpengineer.com/igoogle/images/logo.gif&quot;
screenshot=&quot;http://wpengineer.com/igoogle/images/screenshot.gif&quot;
author_location=&quot;EN&quot;
title_url=&quot;http://wpengineer.com/igoogle/&quot;
/&gt;
&lt;Content type=&quot;url&quot; href=&quot;http://wpengineer.com/blog/index.php&quot;&gt;&lt;/Content&gt;
&lt;/Module&gt;
</pre>
<p>This structure creates the data to activate the gadget, you can see it in the screenshot below.</p>
<p><a href="http://www.google.com/ig/adde?synd=open&amp;source=ggyp&amp;moduleurl=wpengineer.com/igoogle/wpengineer.xml"><img class="centered" src="http://wpengineer.com/wp-content/uploads/add_igoogle.jpg" alt="Add iGoogle Gadget" /></a></p>
<h3>Publish gadget</h3>
<p>There is a <a href="http://www.google.com/ig/submit">Service</a> available to share it with other user. You just have to let it know your address. Just put the address to your XML into the  <a href="http://www.google.com/ig/submit">Service</a>.</p>
<p>Your gadget is done and you can let all your friends know. How that works is explained in Google right after your registration. You also could easily create simple gadgets for websites. You will find the links after your login or you just use the <a href="http://code.google.com/apis/gadgets/docs/publish.html">documentation of API</a>.<br />
<hr /><a href="http://wpplugins.com/plugin/281/snippets" title="More informations about this plugin for WordPress"><img src="http://wpengineer.com/wp-content/themes/wpe-3/images/snippets-125-125.png" height="90" alt="WordPress Snippet Plugin" /></a> <a href="http://xtreme-theme.com"><img src="http://wpengineer.com/wp-content/uploads/feed-banner-2.jpg" alt="Xtreme One WordPress Framework"/></a><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/65/igoogle-gadget-for-your-blog/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Expand Search Results In WordPress</title>
		<link>http://wpengineer.com/32/expand-search-results-in-wordpress/</link>
		<comments>http://wpengineer.com/32/expand-search-results-in-wordpress/#comments</comments>
		<pubDate>Thu, 18 Sep 2008 17:35:05 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[WordPress Hacks]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Search]]></category>
		<category><![CDATA[Theme]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WP]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=32</guid>
		<description><![CDATA[The search function in WordPress is expandable by many WordPress Plugins. For every desire something. But in this post I like to introduce a little code snippet, which doesn&#8217;t give you any of these functionality but shows the user how many posts where found including their search query. With this little but nice help, it [...]]]></description>
			<content:encoded><![CDATA[<p>The search function in WordPress is expandable by many WordPress Plugins. For every desire something. But in this post I like to introduce a little code snippet, which doesn&#8217;t give you any of these functionality but shows the user how many posts where found including their search query. </p>
<p>With this little but nice help, it is an additional value for the user, as I think.</p>
<p>How such a result looks like, displays the following screen shot. The code only shows the number of results and can be adjust as you like to of course.<br />
<span id="more-32"></span></p>
<p><img src="http://wpengineer.com/wp-content/uploads/wp-searchresult1.png" alt="Searchresult example" width="500" height="140" class="alignnone size-full wp-image-114 centered" /></p>
<p>To show the number of found posts, I just use a query of WordPress, quasi an extra loop. I define this loop new, and set that all (<code>-1</code>) entries should be used. If the parameter <code>showposts</code> won&#8217;t delivered with <code>-1</code>, WordPress will use the value, which settings are used for the output in the frontend.<br />
The function <code>wp_specialchars</code> is not only used to filter, so there cannot be a XSS-leak but still include the search keyword in the output. The code is simple and straightforwarded &#8211; experiment with it. I&#8217;m happy if you have improvements or a better use for this. </p>
<pre lang="php">
&lt;h2&gt;Search Result&lt;br /&gt;&lt;small&gt;
&lt;?php /* Search Count */
	$allsearch = &amp;new WP_Query(&quot;s=$s&amp;showposts=-1&quot;);
	$key = wp_specialchars($s, 1);
	$count = $allsearch-&gt;post_count;
	_e(&#039;Begriff: &#039;);
	echo $key;
	_e(&#039; &mdash; &#039;);
	echo $count . &#039; &#039;;
	_e(&#039;Artikel&#039;); wp_reset_query(); ?&gt;&lt;/small&gt;&lt;/h2&gt;
</pre>
<p>The code should be put in <code>search.php</code> of the active theme. If this file isn&#8217;t existing, then the search function normally is in <code>index.php</code>. But to construct a better search for the user, I would recommend to use an own template.</p>
<h3>In loop with <code>$wp_query->found_posts</code></h3>
<p>The above example should clarify the function, but it shouldn&#8217;t be used to use several loops in the template. Below you see a simple example for the template <code>search.php</code>, to show the number of search results with only one loop in your template.</p>
<pre lang="php">
&lt;?php get_header();?&gt;

	&lt;h2&gt;Search Results&lt;br /&gt;&lt;small&gt;&lt;?php echo $wp_query-&gt;found_posts; ?&gt; Article&lt;/small&gt;&lt;/h2&gt;

	&lt;?php if (have_posts()) { while (have_posts()) : the_post(); ?&gt;
		&lt;div class=&quot;post&quot; id=&quot;post-&lt;?php the_ID(); ?&gt;&quot;&gt;

			&lt;h3&gt;&lt;a href=&quot;&lt;?php the_permalink() ?&gt;&quot; rel=&quot;bookmark&quot; title=&quot;Permanent Link to &lt;?php the_title(); ?&gt;&quot;&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/h3&gt;
			&lt;?php the_excerpt(); ?&gt;

		&lt;/div&gt;

	&lt;?php endwhile; } else { ?&gt;

	&lt;p&gt;&lt;?php _e(&#039;Nothing found, what meets your criteria.&#039;, &#039;basis&#039;); ?&gt;&lt;/p&gt;

	&lt;?php } ?&gt;

&lt;?php get_footer(); ?&gt;
</pre>
<hr /><a href="http://wpplugins.com/plugin/281/snippets" title="More informations about this plugin for WordPress"><img src="http://wpengineer.com/wp-content/themes/wpe-3/images/snippets-125-125.png" height="90" alt="WordPress Snippet Plugin" /></a> <a href="http://xtreme-theme.com"><img src="http://wpengineer.com/wp-content/uploads/feed-banner-2.jpg" alt="Xtreme One WordPress Framework"/></a><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/32/expand-search-results-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

