Viewing 16 posts - 1 through 16 (of 16 total)
  • Author
    Posts
  • #293500

    I would like to add custom HTML code under the menu to show a banner on every page.
    Would that be possible?

    #293565

    Hey 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,
    Peter

    #293617

    Thanks for the reply it works well!

    #293700

    Just another thing, is it possible to have it not show on the root domain?

    #293942

    Hey!

    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!
    Peter

    #293970

    Hey Peter!

    I meant to show on all pages except for Home page.

    Is that possible?

    #294839

    Hey!

    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ünter

    #314660

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

    #314841

    Hi!

    Yes, that’s possible, refer to:
    http://codex.wordpress.org/Function_Reference/is_page

    More conditionals:
    http://codex.wordpress.org/Conditional_Tags

    Regards,
    Josue

    #378873

    Hey
    Is it possible to add html after breadcrumb – as ex in the code below
    Regards

    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'); 
    #378880

    Hi!


    @2funky
    Can you please elaborate on the changes you would like to make?

    Cheers!
    Yigit

    #378888

    Hi Yigit,
    I would like to have a banner or html content in top on every page – minus the front page.
    Just below the breadcrumb

    Regards, Pete

    • This reply was modified 9 years, 11 months ago by 2funky.
    #379284

    Hi!

    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,
    Ismael

    #379382

    Hi! 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

    #379445

    Hi!

    Please make sure to use single quote in your HTML when you insert your IMG tag instead of BANNER HERE text

    Best regards,
    Yigit

    #379513

    excellent, that did the work… ;)
    Thanks, for great support, Pete

Viewing 16 posts - 1 through 16 (of 16 total)
  • The topic ‘Where can I add html code so that I have a banner under the menu?’ is closed to new replies.