Support » Plugins and Hacks » [Plugin: The Events Calendar] Call to a member function get_var() on a non-object

  • Hey I’m getting this error on the events posts and the calendar page:

    Fatal error: Call to a member function get_var() on a non-object in D:\Hosting\4529152\html\bryant\wp-content\themes\classifiedtheme\footer.php on line 8

    here’s lines 7 and 8:

    if(!isset($GLOBALS[‘hide_footer_bar’])){
    $numposts = $wpdb->get_var(“SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = ‘publish'”);

    Thanks,
    Ken

Viewing 14 replies - 1 through 14 (of 14 total)
  • I have the same problem with $wpdb (query) in the event posts and the calendar page

    ok. how about this way
    add global $wpdb; before the query

    global $wpdb;
    if(!isset($GLOBALS['hide_footer_bar'])){
    $numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = 'publish'");

    I’ll ask around and see if we can duplicate it.

    Getting the same thing

    Fatal error: Call to a member function get_var() on a non-object in /home/dig/public_html/wp-content/themes/freshnews/includes/version.php on line 7

    I still get the same error when updating to the latest plug in. Guess these don’t work with Woo Themes.

    And yes, I am running PHP 5.1.30

    Hey mattyshack,

    Just a friendly reminder that the Dev Team will return from vacation in one week. I’m sure they will provide an answer when they return. In the meantime, does anyone else have any ideas?

    Thanks,

    – Noah

    I’m getting something similar


    Fatal error: Call to a member function get_var() on a non-object in /mnt/w1007/d27/s19/b02a4550/www/ykonline.ca/wp-content/themes/gazette/header.php on line 70

    I posted a solution to this over on the WooThemes forums. If you’re a member over there you should be able to find it on the search..

    I have a similar problem but I don’t believe my theme is from Woothemes.

    It’s Flexolio from Theme Forest.

    The widget seems to work but when I click on VIEW ALL EVENTS or MORE INFO, I get this:

    Fatal error: Call to a member function get_var() on a non-object in /home/otab/public_html/demo/wp-content/themes/flexolio/var.php on line 11

    @mikeyleung.ca
    I couldn’t find your solution in the Woo Forums, got the link?

    Although I do think I found a solution for me anyways. I looked at line 70 in my header (Where the error was) and just deleted that line, as it was for a feature I don’t use.

    mattyshack

    (@mattyshack)

    mikeyleung, Can’t find that post anywhere. Searched and searched and nothing.

    headwatersmedia

    (@headwatersmedia)

    The link to the mikeyleung fix on the Woo Themes Support Forum is here:
    <a href="http://http://forum.woothemes.com/topic.php?id=10642"> but I think a password is required (members only). Not sure. (I am a member.)

    Actually, here are portions of the exchanges…hope this is ok to post. I’ve removed identities…so buyer beware

    ****************

    [excerpted from woo themes support forum]

    This problem has to do with the WooThemes Gazette theme and not the plugin. I had the same problem some months ago and ended up having to modify the header.

    After upgrading to the new version of the theme, I of course lost my header modifications and have the exact same problem on line seventy of the header.php.

    “Fatal error: Call to a member function get_var() on a non-object in …/ifcnews/wp-content/themes/gazette/header.php on line 70”

    If I recall how I solved it last time I will post here.

    [cont’d]

    The problem is with line 139 … it should now read:

    <?php global $wpdb; $cat = get_option('woo_video_category'); $GLOBALS[vid_cat] = $wpdb->get_var("SELECT term_id FROM $wpdb->terms WHERE name='$cat'"); ?>

    instead of what goes with the theme:

    <?php $cat = get_option('woo_video_category'); $GLOBALS[vid_cat] = $wpdb->get_var("SELECT term_id FROM $wpdb->terms WHERE name='$cat'"); ?>

    It is this error in the theme header.php file which is causing the get_var Fatal error.

    mattyshack

    (@mattyshack)

    Yeah, I’ve tried that fix. but I have the Fresh News theme and my line that is causing the error is different. Its from line 41 in the header.php file

    <?php
    	// Set Global variables for use in exclude
    	$asides_cat = get_option('woo_asides_category');
    	$GLOBALS[asides_id] = $wpdb->get_var("SELECT term_id FROM $wpdb->terms WHERE name = '$asides_cat'");
    	$video_cat = get_option('woo_video_category');
    	$GLOBALS[video_id] = $wpdb->get_var("SELECT term_id FROM $wpdb->terms WHERE name = '$video_cat'");
    ?>
Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘[Plugin: The Events Calendar] Call to a member function get_var() on a non-object’ is closed to new replies.