custom post type name for hooking into single.php

Home Forums Ticket Products Event Tickets Plus custom post type name for hooking into single.php

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #48435
    sitesubscribe
    Participant

    Hi. I have 2 questions:

    #1) I’m using Catalyst theme, and I’m trying to add some stuff to the event detail page (single.php) via a hook.

    What should I be using to hook onto when using a conditional?

    I’ve tried several things along the lines of is_single(‘tribe_events’) and can’t get anything to show up via the hook.

    I even tried: if (is_single(‘tribe_events’) || is_single(‘tribe_venue’) || is_single(‘tribe_organizer’))

    I’ve tried (with no result):
    get_post_type()
    is_singular()
    post_type_exists(‘tribe_events’)

    ***Please advise what the custom post type name is, and the proper conditional.***

    (I’ve done some editing to single.php in the theme/events folder and that works fine, just having trouble with hooks.)

    #2) Somewhere either in the video tutorials or the documentation I thought I saw references to widgets:
    Events Calendar widget & Next Event widget

    Those widgets seem useful, but those widgets aren’t available in my install of WooTickets. It seems perhaps they are only for The Events Calendar Pro.

    Is this intentional, or are those widgets just not available yet in current versin of WooTickets?

    To get those widgets I don’t need to add The Events Calendar Pro plugin if I already have WooTickets, right?

    Thanks,
    ~Jeff

    #48437
    Barry
    Member

    For the hook, you could try something like:

    if (tribe_is_event() and is_single()) { /* Do something */ }

    Regarding the widgets – no widgets ship with WooTickets itself – the ones you refer to are indeed generated by Events Calendar PRO.

    #48442
    sitesubscribe
    Participant

    Thanks for quick reply.
    I get a conditional match on is_single() by itself, but tribe_is_event() by itself is no match on event detail page single.php (thus the combination using ‘and’ won’t work either). Any other ideas?

    On the widgets, so if I wanted those widgets I would need to add The Events Calendar Pro in addition to WooTickets? That won’t cause a conflict?
    If not, what other functionality/features would I gain by adding The Events Calendar Pro in addition to WooTickets?

    #48446
    Barry
    Member

    Hi sitesubscribe,

    I’d need a better picture of what you are doing – it’s possible you are doing this too early in the request – perhaps you can share a snippet via Pastebin?

    On the widgets, so if I wanted those widgets I would need to add The Events Calendar Pro in addition to WooTickets? That won’t cause a conflict? If not, what other functionality/features would I gain by adding The Events Calendar Pro in addition to WooTickets?

    Events Calendar PRO does not create any conflicts with WooTickets that I am aware of – and you can see a summary of what it offers over on its product page πŸ™‚

    #48452
    sitesubscribe
    Participant

    http://pastebin.com/7r4xHXcj

    Adding that conditional code to a ‘before content’ hook inside Catalyst theme. My goal is to insert some things into the page, specifically the header. It works on other pages/posts & WooCommerce products using similar code, just not Events. I believe it is because the post type reference is not correct.

    Events detail page example is here (temp url will expire soon):
    http://irfnews.wordpressmash.com/event/irf-executive-seminar-series-roadside-work-zone-safety-costa-rica/

    #48459
    Barry
    Member

    The post type is tribe_events and this is often accessible using the following class constant (though very early on in the request you would need to use a string literal):

    TribeEvents::POSTTYPE

    I’m afraid I’m not familiar with the Catalyst theme so it is difficult to offer much more advice here beyond suggesting a different strategy (such as using Default Events templates and changing ecp-single-template.php).

    #48488
    sitesubscribe
    Participant

    Well, I’m getting closer.

    is_singular(‘tribe_events’)) is working now, where before I think I had a missing semi colon somewhere or something…dohh!

    Now Catalyst is stripping my shortcodes out of hooks on render, but only on event single.php. So I have a couple of options here I can play with (like not using shortcodes just for this page template, or maybe trying ecp-single-template.php like you suggested).

    Thanks for your help.
    ~Jeff

    #48492
    Barry
    Member

    No problemo, I hope you get there πŸ™‚

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘custom post type name for hooking into single.php’ is closed to new replies.