{"id":1133862,"date":"2016-06-30T03:01:12","date_gmt":"2016-06-30T10:01:12","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/how-to-get-the-ticket-title\/"},"modified":"2016-06-30T03:01:12","modified_gmt":"2016-06-30T10:01:12","slug":"how-to-get-the-ticket-title","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/how-to-get-the-ticket-title\/","title":{"rendered":"How to get the ticket title?"},"content":{"rendered":"<p>I&#8217;m trying to get the ticket title. My code is below. I&#8217;ve got it getting the venue title succesfully as per help from a previous forum post, so tried to do it the same way but no luck.<\/p>\n<p><code>\/* attach a word doc with each purchase. *\/<br \/>\nfunction attach_doc_to_email ( $attachments , $event_id, $object ) {<\/p>\n<p>\t\/\/ get the tickets<br \/>\n\t$main = Tribe__Tickets_Plus__Commerce__WooCommerce__Main::get_instance();<br \/>\n\t$tickets = $main-&gt;get_tickets( $event_id );<\/p>\n<p>\t\/\/ Get ticket title - not yet complete<br \/>\n\t$ticket_id = tribe_get_ticket_id( $event_id );<br \/>\n\t$ticket_info = get_post( $ticket_id );<br \/>\n\t$ticket_title = get_the_title( $ticket_id ); <\/p>\n<p>\t\/\/Get the venue name<br \/>\n\t$venue_id = tribe_get_venue_id( $event_id );<br \/>\n\t$venue_info = get_post( $venue_id );<br \/>\n\t$venue_title = get_the_title( $venue_id ); <\/p>\n<p>\tif (strpos($ticket_title, 'SSSTS') !== false) {<\/p>\n<p>\t\t$your_doc_path = get_template_directory() . '\/instructions\/chelmsford-sssts.docx';<\/p>\n<p>\t}else{<\/p>\n<p>\t\t$your_doc_path = get_template_directory() . '\/instructions\/chelmsford-health-safety-awareness.docx';<br \/>\n\t}<\/p>\n<p>\t$attachments[] = $your_doc_path;<br \/>\n\treturn $attachments;<br \/>\n}\t<\/code><\/p>\n<p>So basically the only bit of code that isn&#8217;t working is where I&#8217;ve attempted to get the ticket title. The ticket I&#8217;m testing with is called &#8220;2 Day SSSTS Chelmsford&#8221;. Any help getting the title is greatly appreaciated.<\/p>\n","protected":false},"template":"","class_list":["post-1133862","topic","type-topic","status-closed","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to get the ticket title? -<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/how-to-get-the-ticket-title\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to get the ticket title? -\" \/>\n<meta property=\"og:description\" content=\"I&#8217;m trying to get the ticket title. My code is below. I&#8217;ve got it getting the venue title succesfully as per help from a previous forum post, so tried to do it the same way but no luck. \/* attach a word doc with each purchase. *\/ function attach_doc_to_email ( $attachments , $event_id, $object ) [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/how-to-get-the-ticket-title\/\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/how-to-get-the-ticket-title\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/how-to-get-the-ticket-title\/\",\"name\":\"How to get the ticket title? -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2016-06-30T10:01:12+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/how-to-get-the-ticket-title\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/how-to-get-the-ticket-title\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/how-to-get-the-ticket-title\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/theeventscalendar.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Topics\",\"item\":\"https:\/\/theeventscalendar.com\/support\/topics\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Ticket Products\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/event-tickets\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Event Tickets Plus\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/event-tickets\/event-tickets-plus\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"How to get the ticket title?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\",\"url\":\"https:\/\/theeventscalendar.com\/support\/\",\"name\":\"\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to get the ticket title? -","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/how-to-get-the-ticket-title\/","og_locale":"en_US","og_type":"article","og_title":"How to get the ticket title? -","og_description":"I&#8217;m trying to get the ticket title. My code is below. I&#8217;ve got it getting the venue title succesfully as per help from a previous forum post, so tried to do it the same way but no luck. \/* attach a word doc with each purchase. *\/ function attach_doc_to_email ( $attachments , $event_id, $object ) [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/how-to-get-the-ticket-title\/","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/how-to-get-the-ticket-title\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/how-to-get-the-ticket-title\/","name":"How to get the ticket title? -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2016-06-30T10:01:12+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/how-to-get-the-ticket-title\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/how-to-get-the-ticket-title\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/how-to-get-the-ticket-title\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/theeventscalendar.com\/support\/"},{"@type":"ListItem","position":2,"name":"Topics","item":"https:\/\/theeventscalendar.com\/support\/topics\/"},{"@type":"ListItem","position":3,"name":"Ticket Products","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/event-tickets\/"},{"@type":"ListItem","position":4,"name":"Event Tickets Plus","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/event-tickets\/event-tickets-plus\/"},{"@type":"ListItem","position":5,"name":"How to get the ticket title?"}]},{"@type":"WebSite","@id":"https:\/\/theeventscalendar.com\/support\/#website","url":"https:\/\/theeventscalendar.com\/support\/","name":"","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1133862","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":1,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1133862\/revisions"}],"predecessor-version":[{"id":1137398,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1133862\/revisions\/1137398"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=1133862"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}