Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #634150

    Hi

    I have this code installed on my functions.php file to enable widgets on to appear on my header.

    add_action( ‘ava_main_header’, ‘enfold_customization_header_widget_area’ );
    function enfold_customization_header_widget_area() {
    dynamic_sidebar( ‘header’ );
    }

    Question – How do I set this up so that different pages would display a specific header widget.

    So like:
    Page “A” would display header widget “A” and
    Page “B” would display header widget “B”

    Please let me know if this is possible.

    Best,
    G

    #634172

    Hey ung213LAX,

    Please add a header widget as mentioned in this link http://kriesi.at/documentation/enfold/adding-a-widget-area-to-the-header/

    Then use a text widget with div content for each page and hide them all. Use the display block!important rule in CSS to make the div visible only on selected pages with the help of the page id class name.

    html code in the text widget in header widget area would be similar to

    
    <div class="page-1"> page 1 content</div>
    <div class="page-2"> page 2 content</div>
    <div class="page-3"> page 3 content</div>
    

    And the css would be similar to

    /* Hide all widgets by default*/
    .page-1, .page-2, .page-3{
    	display:none;		
    }
    
    /* Show only on selected pages using page id*/
    .page-id-1 .page-1{
    	display:block!important;
    }
    
    .page-id-2 .page-2{
    	display:block!important;
    }
    
    .page-id-3 .page-3{
    	display:block!important;
    }
    

    Best regards,
    Vinay

    #641280

    Hi Vinay,

    This solution worked out great. Thanks for your help.

    Best,
    G

    #641311

    Hi,

    Glad the solution worked! Feel free to reach out to us again on the forum if you need assistance with anything else :)

    Best regards,
    Jordan

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Different Header Widget for Different Pages?’ is closed to new replies.