• Resolved son0fhobs

    (@son0fhobs)


    When I go to an event, it’s registering as a “page” post type, and the global object $post is empty. ( At the bottom of this entry I show some debug code and what it displays )
    Although the event displays fine, getting custom metadata and related info doesn’t work given it’s not registering as an event. Before I updated the plugin from 3.9.x, it was registering as an “event” post type and the post object was filled.

    Info:
    The Events Calendar PRO v 3.12.2
    The Events Calendar v 3.12.3
    WP version 4.2

    Here’s the page: http://ethoschicago.staging.wpengine.com/event/sunday-service/2015-10-25/
    Add ?debug for debug info: http://ethoschicago.staging.wpengine.com/event/sunday-service/2015-10-25/?debug

    Here’s the code that’s displaying that info:

    echo var_dump(get_post_type($post->ID)); // - page
    echo var_dump(tribe_is_event($post->ID)); // - false
    echo var_dump($post->ID); // - 0
    echo var_dump(get_post_type()); // page
    echo var_dump(get_post_type( $post->ID )); // page
    echo var_dump($post); // Post object, empty

    Any ideas?
    Thanks a bunch!
    David

    https://ww.wp.xz.cn/plugins/the-events-calendar/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Brook

    (@brook-tribe)

    Howdy David,

    I am sorry the $post var is no longer looking working for the location of your code. Depending on where the code is there might be a different variable setup, which you could find by setting a breakpoint with a debugger such as x-debug. However there is also a possibility the query will not have run yet, or a new query will have override it. In this case it will be easiest for your to do a new query for the event details you need. You can get the post ID from the slug, and do your meta query from there.

    https://codex.ww.wp.xz.cn/Class_Reference/WP_Query

    I hope that info helps. Cheers!
    – Brook

    Thread Starter son0fhobs

    (@son0fhobs)

    That’s a brilliant solution! Thanks so much for your help!

    Plugin Contributor Brian

    (@brianjessee)

    Glad Brook Could Help!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Custom post type not registering’ is closed to new replies.