Home › Forums › Calendar Products › Events Calendar PRO › PRO 3.0 Upgrade – Customization issue with is_single() for tribe_venue post type
- This topic has 16 replies, 6 voices, and was last updated 10 years, 8 months ago by Rob.
-
AuthorPosts
-
July 8, 2013 at 10:09 pm #53951aguawebdesignParticipant
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.
July 9, 2013 at 4:57 pm #54192JonahParticipantHi aguawebdesign,
Please use the following conditional code for any of the various views:
https://gist.github.com/jo-snips/2415009– Jonah
July 12, 2013 at 3:44 pm #54886aguawebdesignParticipantI 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.”
July 12, 2013 at 7:10 pm #54961LeahMemberHey 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.
July 15, 2013 at 7:31 am #55178JonahParticipantHi aguawebdesign,
What file in your theme are you using the code in?
– Jonah
August 6, 2013 at 12:19 pm #59133CinchParticipantHi 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
}August 6, 2013 at 2:27 pm #59149CinchParticipantJust checked using that conditional within a template file and can confirm that it doesn’t work. Returns true for every page.
August 6, 2013 at 2:43 pm #59150CinchParticipantUpdate to last post. Adding && is_single() via Jonah’s gist does indeed work correctly.
August 6, 2013 at 3:49 pm #59175LeahMemberThanks for the updates Bryan, I’m glad you got that working. aguawebdesign, are you all set as well?
August 20, 2013 at 7:29 pm #62140aguawebdesignParticipantI’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.
August 20, 2013 at 7:40 pm #62142aguawebdesignParticipantActually, 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/August 22, 2013 at 10:41 am #62481ChrisParticipantHi 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
August 28, 2013 at 1:44 pm #63469RobMemberDid you see Chris’ last note here, AguaWebDesign? Any thoughts?
September 10, 2013 at 4:26 pm #65393aguawebdesignParticipantChris’ 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.
September 10, 2013 at 5:14 pm #65403ChrisParticipantCan you post a copy of your code that you’re using on Pastebin or something and then put a link to it here?
-
AuthorPosts
- The topic ‘PRO 3.0 Upgrade – Customization issue with is_single() for tribe_venue post type’ is closed to new replies.