AJAX search posts and pages

The error seams to come from another source, not your query. You don’t use wp_options table. So maybe skipping $wpdb->show_errors(); $wpdb->print_error(); would make things even work. But probably there is an error somewhere else. To get an overview how to create AJAX search helper, you can check here: http://www.wpcodelab.com/archives/create-a-custom-ajax-search-for-wordpress

When to load auto-login code?

I ended up using the ‘plugins_loaded’ action or state from http://codex.wordpress.org/Plugin_API/Action_Reference: In my main plugin file I have: include_once( ‘lib/class-my-auth.php’ ); // your class file here add_action( ‘plugins_loaded’, ‘My_Auth::auto_login’ ); In lib/class-my-auth.php: <?php class My_Auth { private static $successfully_connected_Main_to_WP = false; public static function auto_login() { $username = …; // Integrate with main site to … Read more

Help With MySQL to WPDB Query Conversion

Instead of using $wpdb->query(), use $wpdb->get_results(). This method allows you to specify a return type so the query is returned as an associative array. For example … $results = $wpdb->get_results( “SELECT * FROM mb_download_manager WHERE filename=”” . $namemeta . “.zip””, ARRAY_A ); This will return you an indexed array of associative arrays … so you … Read more

Function: Add link to / inside div

Why not do this with jQuery? It would be a very simple, here’s a sample, provided you have a means to get the blog’s URL into the jQuery code: jQuery(document).ready(function(){ jQuery(‘.header-object img’).wrap(‘<a href=”#blog url here#”></a>’); }); This will wrap <a> tags around an image inside the .header-object class. To implement this into your code, it … Read more

$paged always 0 on plugin’s custom page

I resolved this myself. The problem being: add_rewrite_rule(‘^foobar?’,’index.php?is_foobar_page=1′,’top’); Which prevents any other query_vars from being created. To resolve this, a slightly more complicated rewrite rule combo is set up: add_rewrite_rule(‘^foobar?$’,’index.php?is_foobar_page=1′,’top’); add_rewrite_rule(‘foobar/page/([0-9]+)?$’,’index.php?is_foobar_page=1&paged=$matches[1]’,’top’); This takes into consideration the creation of the plugin’s subpage ‘foobar’ and also allows for pagination within this page. Hope this helps someone.