PRO 3.0 Upgrade – Customization issue with is_single() for tribe_venue post type

Home Forums Calendar Products Events Calendar PRO PRO 3.0 Upgrade – Customization issue with is_single() for tribe_venue post type

Viewing 15 posts - 1 through 15 (of 17 total)
  • Author
    Posts
  • #53951
    aguawebdesign
    Participant

    I have the following code in my functions.php file, which is no longer working since the upgrade:

    if ( is_single() && ‘tribe_venue’ == get_post_type() ) {
    // do something here
    }

    I tried using is_page() instead of is_single() but that is not working either. How can I target the single-venue.php page? I am using Genesis, and am trying to use a hook to insert some code before the content and sidebar divs, which cannot be done using the single-venue.php template override.

    #54192
    Jonah
    Participant

    Hi aguawebdesign,

    Please use the following conditional code for any of the various views:
    https://gist.github.com/jo-snips/2415009

    – Jonah

    #54886
    aguawebdesign
    Participant

    I updated it to
    if( tribe_is_venue() ) {
    // do something here
    } else {
    echo “foo”;
    }

    But it still is not working. The single venue page is outputting “foo.”

    #54961
    Leah
    Member

    Hey aguawebdesign, I just wanted to let you know that we don’t do support on the weekends, but Barry will be back in touch as soon as possible.

    #55178
    Jonah
    Participant

    Hi aguawebdesign,

    What file in your theme are you using the code in?

    – Jonah

    #59133
    Cinch
    Participant

    Hi aguawebdesign,

    Here’s a similar conditional that I am able to use within functions.php:

    if ( get_post_type() == ‘tribe_events’ || ‘tribe_venue’ || ‘tribe_organizer’ ) {

    // Do stuff
    }

    #59149
    Cinch
    Participant

    Just checked using that conditional within a template file and can confirm that it doesn’t work. Returns true for every page.

    #59150
    Cinch
    Participant

    Update to last post. Adding && is_single() via Jonah’s gist does indeed work correctly.

    #59175
    Leah
    Member

    Thanks for the updates Bryan, I’m glad you got that working. aguawebdesign, are you all set as well?

    #62140
    aguawebdesign
    Participant

    I’ve been on vacation and just now coming back to this.
    I am trying to use the conditional within functions.php. I need to add a title above the post content so using the template file won’t work. I am using Genesis hooks to position the title.
    I tried using Bryan’s suggestion but it’s still not working. Before the upgrade to 3.0 it was working fine. I am trying to use:
    if ( get_post_type() == ‘tribe_events’ ) {

    When I try and output the post type name it says “page.” I am using a custom template for this page, located in: theme directory/tribe-events/pro/single-venue.php. The template is showing up so that part is working. I just am not able to use conditionals on the template via functions.php.

    #62142
    aguawebdesign
    Participant

    Actually, even the following doesn’t work:
    if ( is_single() } {
    // do something
    }

    This shows up on all other single pages except the venue page.
    Here is a link to the page I am referring to in case that helps: http://evolutionswim.com/venue/renaissance-clubsport/

    #62481
    Chris
    Participant

    Hi there AguaWebDesign,
    You mentioned earlier you are using a custom template for that page.
    Since it is now considered a Page thats your issue. Pages are actually just a special post type called “page” (which you saw before). Note that is_single() will not run on either the “page” or “attachment” core WordPress post types. is_single() will work on any other type of post.

    If you are using this template on just one page, what you could do maybe is get the post_id (since even pages have id’s) and then do your conditional like this:

    if (get_the_ID() == ’62’){
    //something
    }

    -Chris

    #63469
    Rob
    Member

    Did you see Chris’ last note here, AguaWebDesign? Any thoughts?

    #65393
    aguawebdesign
    Participant

    Chris’ suggestion works, but none of the code I had inside the conditional statement is working. Prior to the upgrade, this all worked fine, so I guess I am not clear on what changed.
    The code inside my conditional calls up the post thumbnail and uses
    tribe_get_city( get_the_ID() )
    to call up the city name. Neither the thumbnail or the city name are showing up.
    Second – the method of using the post ID in the conditional statement is not ideal, because it would have to be manually added each time the client adds a new venue. I prefer a universal conditional that catches all single venues as they are added through the dashboard.

    To be clear, I am using the method described in the Plugin documentation to create a custom layout for the single venue post type. Before the upgrade, this method still treated it as a venue post type. Now it is a page? How can I apply a custom layout to the post type, while still having it be recognized as a post type? Maybe I am misunderstanding something. If there is a better method than the one I am using please let me know.

    #65403
    Chris
    Participant

    Can you post a copy of your code that you’re using on Pastebin or something and then put a link to it here?

Viewing 15 posts - 1 through 15 (of 17 total)
  • The topic ‘PRO 3.0 Upgrade – Customization issue with is_single() for tribe_venue post type’ is closed to new replies.