Home › Forums › Calendar Products › Events Calendar PRO › Output of do_action( 'tribe_events_single_event_meta_primary_section_end' )
- This topic has 5 replies, 2 voices, and was last updated 7 years, 10 months ago by
Ken Charity.
-
AuthorPosts
-
May 30, 2018 at 5:31 pm #1542475
Ken Charity
ParticipantIn my meta.php file I have this line.
do_action( 'tribe_events_single_event_meta_primary_section_end' );I am using a template tag to add in my custom fields, so this repeats the content of the custom fields a second time on the page.
Can you tell me how to edit this. Other than removing the line our of my template. What else does that action control?
May 31, 2018 at 2:59 pm #1543395Cliff
MemberHi, Ken.
tribe_events_single_event_meta_primary_section_end action fires from the /wp-content/plugins/the-events-calendar/src/views/modules/meta.php file and PRO uses it to output its Additional Fields (https://theeventscalendar.com/knowledgebase/pro-additional-fields/).
Did you customize this meta.php file and accidentally include this action twice in your template file?
Or do you have your own additional fields to output in addition?
May 31, 2018 at 3:21 pm #1543401Ken Charity
ParticipantI have modified my
single-event.phpto have a sidebar and in the sidebar themeta.phpfile is called. But I have adjusted thechild-theme/tribe-events/modules/meta/details.phpfile to include the additional fields in the location I want by calling the functiontribe_get_custom_field( 'My Field' );instead of the end where the template files place it.So now I have the additional field in the location where I want it. But it also appears at the end of the sidebar where it does by default. Your answer kind of helps me though.
You are saying that all that
do_action( 'tribe_events_single_event_meta_primary_section_end' )does is loop through the additional fields and then output the additional fields? If that is the case I can just remove it from themeta.phpfile and I should be good. If I need to add in more additional fields I will either need to add the line back in and format the output or addtribe_get_custom_field( 'Another My Field' );to thedetails.phpfile.June 2, 2018 at 4:37 pm #1544750Cliff
MemberI’d recommend not modifying the template to fully remove the action. Instead, here’s a snippet that makes it go away so anything else using the action hook still fires, including your own code you want to hook into there, and you might be able to fully avoid having to do a template override just for this purpose. Here’s a snippet that should work for you:
https://gist.github.com/cliffordp/ccd49235d1a8873cca53398fcb67a00c
Please reference https://theeventscalendar.com/knowledgebase/implementing-custom-code-snippets/ for how to implement custom code snippets.
Please let me know how this goes for you.
June 4, 2018 at 7:20 am #1545475Ken Charity
ParticipantThanks for the snippet, I think that should solve the issue without further modification of the meta.php file. I appreciate the forward thinking of still being able to use the action by hooking into it.
June 4, 2018 at 12:05 pm #1545712Cliff
MemberYou’re welcome. Glad this looks like a good solution for you.
-
AuthorPosts
- The topic ‘Output of do_action( 'tribe_events_single_event_meta_primary_section_end' )’ is closed to new replies.
