-
AuthorPosts
-
July 20, 2014 at 2:34 am #293500
I would like to add custom HTML code under the menu to show a banner on every page.
Would that be possible?July 20, 2014 at 9:19 am #293565Hey alvinhy!
You can use this code.
function add_stuff_before_breadcrumbs() { echo '<div class="stretch_full container_wrap alternate_color light_bg_color title_container"><div class="container">'; echo 'Some html content'; echo '</div></div>'; } add_action('ava_after_main_container', 'add_stuff_before_breadcrumbs');
Insert it into the the enfold/functions.php or child theme functions.php file and replace “Some html content” with your banner code.
Regards,
PeterJuly 20, 2014 at 2:47 pm #293617Thanks for the reply it works well!
July 21, 2014 at 3:48 am #293700Just another thing, is it possible to have it not show on the root domain?
July 21, 2014 at 6:03 pm #293942Hey!
You mean on the home/front page? Yes, this is possible:
function add_stuff_before_breadcrumbs() { if(is_home() || is_front_page()) return; echo '<div class="stretch_full container_wrap alternate_color light_bg_color title_container"><div class="container">'; echo 'Some html content'; echo '</div></div>'; } add_action('ava_after_main_container', 'add_stuff_before_breadcrumbs');
Cheers!
PeterJuly 21, 2014 at 7:01 pm #293970Hey Peter!
I meant to show on all pages except for Home page.
Is that possible?
July 23, 2014 at 10:03 am #294839Hey!
As far as I can see Peters code does not display anything on Homepage (is_home()) or frontpage (is_front_page()).
You can also try to replace
if(is_home() || is_front_page()) return; // with if(is_home()) return;
Regards,
GünterSeptember 7, 2014 at 2:35 am #314660This works great.
One last request is, am I able to enter some code for it so it does not show on certain pages?I know (is_home() || is_front_page()) = not to show in frontpage but if I want it to not show on a certain blog post or page?
Is that possible?
September 8, 2014 at 5:24 am #314841Hi!
Yes, that’s possible, refer to:
http://codex.wordpress.org/Function_Reference/is_pageMore conditionals:
http://codex.wordpress.org/Conditional_TagsRegards,
JosueJanuary 13, 2015 at 4:24 pm #378873Hey
Is it possible to add html after breadcrumb – as ex in the code below
Regardsfunction add_stuff_before_breadcrumbs() { if(is_home() || is_front_page()) return; echo '<div class="stretch_full container_wrap alternate_color light_bg_color title_container"><div class="container">'; echo 'Some html content'; echo '</div></div>'; } add_action('ava_after_main_container', 'add_stuff_before_breadcrumbs');
January 13, 2015 at 4:28 pm #378880January 13, 2015 at 4:33 pm #378888Hi Yigit,
I would like to have a banner or html content in top on every page – minus the front page.
Just below the breadcrumbRegards, Pete
- This reply was modified 9 years, 10 months ago by 2funky.
January 14, 2015 at 7:18 am #379284Hi!
Try this on functions.php:
add_filter('avf_title_args', 'avf_title_args_append', 1); function avf_title_args_append($args) { if(is_home() || is_front_page()) return; $banner = "<div class='container_wrap append-content'>"; $banner = "<div class='container'>"; $banner .= "BANNER HERE"; $banner .= "</div>"; $banner .= "</div>"; $args['html'] = "<div class='{class} title_container'><div class='container'><{heading} class='main-title entry-title'>{title}</{heading}>{additions}</div></div>{$banner}"; return $args; }
Best regards,
IsmaelJanuary 14, 2015 at 12:40 pm #379382Hi! Ismael,
Thanks for the quick reply, it works fine with the text – but how do I insert an image / banner? – If I insert where it says ‘Banner here’ does not work.
Regards, Pete
January 14, 2015 at 3:45 pm #379445Hi!
Please make sure to use single quote in your HTML when you insert your IMG tag instead of BANNER HERE text
Best regards,
YigitJanuary 14, 2015 at 4:38 pm #379513excellent, that did the work… ;)
Thanks, for great support, Pete -
AuthorPosts
- The topic ‘Where can I add html code so that I have a banner under the menu?’ is closed to new replies.