Home › Forums › Calendar Products › Events Calendar PRO › add html above calendar for a specific a category.Continued
- This topic has 4 replies, 2 voices, and was last updated 10 years, 1 month ago by Barry.
-
AuthorPosts
-
March 7, 2014 at 5:37 pm #116366SeanParticipant
Barry didn’t really address my question and closed the ticket so to continue…
this function adds html above a calendar for a specific category, it adds the html fine above anything entered in event settings >> display tab >> Advanced Template Settings >> Add HTML before event content.
add_filter( 'tribe_events_before_html', 'add_text_before_events' );
function add_text_before_events( $html ) {
if ( tribe_meta_event_category_name() == "CATEGORY NAME" ) $html = '<p> HTML </p>' . $html;
return $html;
}the desired result is to have it overwrite anything that is in event settings >> display tab >> Advanced Template Settings >> Add HTML before event content for the specified category.
i assumed if i removed “. $html” from the condition it would not include the html contained in event settings >> display tab >> Advanced Template Settings >> Add HTML before event content.
add_filter( 'tribe_events_before_html', 'add_text_before_events' );
function add_text_before_events( $html ) {
if ( tribe_meta_event_category_name() == "CATEGORY NAME" ) $html = '<p> HTML </p>';
return $html;
}this works BUT breaks the page as if there is closing div missing.
is this the correct way to overwrite what is contained in event settings >> display tab >> Advanced Template Settings >> Add HTML before event content for a specific category?
Thank You
Sean
March 7, 2014 at 6:22 pm #116371BarryMemberHi Sean:
Sorry if you feel I closed that prematurely – but if you want to wipe any custom before-HTML text as specified in the Events > Display admin screen the basic strategy would be:
add_filter( 'tribe_get_option', 'wipe_before_html_content', 10, 2 ); function wipe_before_html_content( $option_val, $option_name ) { if ( 'tribeEventsBeforeHTML' === $option_name ) return ''; return $option_val; }
Does that help?
March 7, 2014 at 6:33 pm #116395SeanParticipantits ok, that happens to all guys at some point…
this should help, looks like i need 2 functions. so where specifically in the new documentation would i find this information? i am all about self help… when i can find it 🙂
March 10, 2014 at 7:10 am #116778BarryMemberHi!
this should help, looks like i need 2 functions
Or indeed you could use a single filter function like in my above example (instead of returning an empty string, you could return whatever you want if your specific conditions are met).
so where specifically in the new documentation would i find this information? i am all about self help… when i can find it
Our current stack of learning resources is basically as follows:
And of course past answers on the forum augment this. We do realize there are some gaps and hope to continue building on and improving these resources.
I hope that helps!
March 24, 2014 at 3:04 pm #122548BarryMember<p>This thread’s not seen much activity for the last couple of weeks – and there’s not too much more we can offer here given its a customization – so I’ll go ahead and close it. Of course if you still need help with this or any other issue please don’t hesitate to create a new thread (or threads) and one of the team will be only too happy to help. Thanks!</p>
-
AuthorPosts
- The topic ‘add html above calendar for a specific a category.Continued’ is closed to new replies.