WordPress.org

Ready to get started?Download WordPress

Forums

Yet Another Related Posts Plugin (YARPP)
[resolved] [Plugin: Yet Another Related Posts Plugin] Call to a member function get_results() on a non-object i (3 posts)

  1. divyang.jp
    Member
    Posted 3 years ago #

    Hi Mitcho,
    I upgraded to WordPress version to 3.1.1 and upgraded YARPP to latest version automatically. I use custom template. I got fatal error "Call to a member function get_results() on a non-object in" my template file.

    Below is the code,

    <?php
    	$now = gmdate( "Y-m-d H:i:s", time() );
    	$request = "SELECT ID, post_title, post_excerpt FROM $wpdb->posts WHERE post_status = 'publish' AND post_password ='' AND post_type='post' AND post_date_gmt < '$now' ORDER BY post_date DESC LIMIT 0, 4";
    	$posts = $wpdb->get_results( $request );
    
    	$default_thumbnail = get_bloginfo('template_url') . '/images/default-image.jpg';

    http://wordpress.org/extend/plugins/yet-another-related-posts-plugin/

  2. mitcho (Michael Yoshitaka Erlewine)
    Member
    Plugin Author

    Posted 3 years ago #

    Perhaps you have to global $wpdb first?

  3. divyang.jp
    Member
    Posted 3 years ago #

    Hey Mitcho,
    That worked perfectly. Thanks buddy. You're awesome just like your plugin.

    -Divyang

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic