Find $post_id to add post_excerpt on Tickets email (email.php)

Home Forums Ticket Products Event Tickets Plus Find $post_id to add post_excerpt on Tickets email (email.php)

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1126127
    Sean Sullivan
    Participant

    Hello,

    My client is asking for more information to be displayed about the event on the actual ticket. This comes in particularly useful when using Event Tickets Plus on a custom post type, not an actual event. (In this case, registration for a kid’s swimming program).

    I’ve found some older posts that reference this code:

    $ticket_product_id = get_post_meta( $ticket['ticket_id'], '_tribe_wooticket_product', true );
    $ticket_product = get_post( $ticket_product_id );
    $ticket_description = $ticket_product->post_excerpt;

    Add important ticket information to emailed ticket?

    add ticket description to email.php

    But it doesn’t work when placed in my email.php (and echo’d out), and appears to reference an earlier version of your software anyway.

    Question 1: Can you confirm that this code won’t do what I want it to do?

    So, to display this extra information, I’m thinking the easiest way would be to display either the post’s excerpt β€” or even its full content, if needed β€” on the ticket email.

    To do so, I think I have to determine the $post_id of the post that uses the ticket, and then pull the post_excerpt from there. Using something like this:

    $text = apply_filters('the_excerpt', get_post_field('post_excerpt', $post_id));

    Question 2: How can I determine the $post_id that the ticket is attached to?

    Thank you!

    #1126160
    George
    Participant

    Hey @Sean,

    Thanks for reaching out. The posts you linked to are both from 2014, so they are indeed out of date and referring to code that either no longer exists, or is deprecated and in old plugin versions.

    Before diving in, can you confirm that you’ve read this page and understand the limitations of our support? ? https://theeventscalendar.com/knowledgebase/what-support-is-provided-for-license-holders/

    I am still happy to help here, and will! πŸ˜€ No worries. But I just want to set your expectations early on, because we cannot help with code customizations here.

    To help me help you, can you please clarify what you’re trying to show on the ticket emails? This may sound obvious, but: are you trying to show the excerpt of the event/post type the ticket belongs to? Or have you added excerpts to the tickets themselves and want to show those? I assume it’s the former, by farβ€”but just want to be absolutely certain before diving into the code and writing you a long reply.

    Cheers,
    George

    #1126166
    Sean Sullivan
    Participant

    Hi George,

    Thanks for the reply. I understand the support limitations β€” I just find it never hurts to ask, as you sometimes have code snippets or easy answers on hand. The worst you can say is no, right? πŸ™‚

    It’s this one:

    >> are you trying to show the excerpt of the event/post type the ticket belongs to?

    Really, I’m looking for the simplest way to get more information on the ticket itself. I had thought about creating an “extra information” custom metabox to go along with the post, but then I’d still have the same problem of pulling that info. I thought the post_excerpt would be the most straightforward way to go about it.

    Others on the forum have asked similar questions, so I’m sure it’s a bit of support that would be relevant to and worthwhile for the community.

    Thanks again.

    #1126518
    George
    Participant

    Hey @Sean,

    Thanks for elaborating a bit. I am not trying to be facetious here, just trying to isolate the source of this extra ticket information as you currently have it architected, so that I can write a working snippet:

    β€’ Do you have excerpts enabled and populate on the tickets post type itself?
    β€’ Or, are you using a custom meta field or something on tickets?

    Just trying to figure out the exact meaning when you say, “thought the post_excerpt would be the most straightforward way to go about it.” Are you using the post_excerpt on the parent event that the ticket belongs to? Or have you added excerpt capabilities to tickets themselves, and so are looking for the post_excerpt on the Ticket object itself?

    If you are doing the latter, then can you post the code you used to add excerpts to Tickets? You can do this by posting the full, un-edited code to Gists on http://gist.github.com, then share links to those gists here.

    Thank you for patience here; not trying to jerk your train, just trying to clarify the way things are working/expected to work.

    Sincerely,
    George

    #1133009
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Find $post_id to add post_excerpt on Tickets email (email.php)’ is closed to new replies.