Output of do_action( 'tribe_events_single_event_meta_primary_section_end' )

Home Forums Calendar Products Events Calendar PRO Output of do_action( 'tribe_events_single_event_meta_primary_section_end' )

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1542475
    Ken Charity
    Participant

    In 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?

    #1543395
    Cliff
    Member

    Hi, 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?

    #1543401
    Ken Charity
    Participant

    I have modified my single-event.php to have a sidebar and in the sidebar the meta.php file is called. But I have adjusted the child-theme/tribe-events/modules/meta/details.php file to include the additional fields in the location I want by calling the function tribe_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 the meta.php file 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 add tribe_get_custom_field( 'Another My Field' ); to the details.php file.

    #1544750
    Cliff
    Member

    I’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.

    #1545475
    Ken Charity
    Participant

    Thanks 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.

    #1545712
    Cliff
    Member

    You’re welcome. Glad this looks like a good solution for you.

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Output of do_action( 'tribe_events_single_event_meta_primary_section_end' )’ is closed to new replies.