Viewing 17 posts - 1 through 17 (of 17 total)
  • Author
    Posts
  • #212957

    Hi,

    I have created different templates for my enfold theme website. I can call upon those template via the page attributes in the back office & everything works fine.

    At this stage, i am trying to have different footer appear on different pages.

    In my template file, when I modify get_footer(); to get_footer(‘new’); nothing happens.
    The new footer is called footer-new.php

    Also, if i remove get_footer(); the footer still shows up.

    What would you recommend I do to make this work and a different footer on some pages?

    Thanks,

    Nima

    #213114

    Hi nimkaworld!

    It works on my end. Are you sure you’re using the correct template? Please give us a link to the page with the custom template.

    Cheers!
    Ismael

    #213465

    Hi Ismael,

    Here are the links:

    http://nimka.com/barcelonetarestaurant/south-beach
    http://nimka.com/barcelonetarestaurant/sunset

    at this stage we have replaced the footer with custom widget. the only problem with this is that we can’t of a sidebar with a custom widget to look like a footer because the item on the sidebar get pushed down.

    So we had to eliminate the sidebar for now.

    #213528

    Hi,

    Any updates?

    Thanks, Nima

    #213674

    Hi!

    Do you have any Cache/Minify plugin activated?

    Cheers!
    Josue

    #213843

    Hi,

    No I don’t. Should I?

    Nima

    #213925

    Hi, is there anyway we can wrap this up?

    Thanks,

    Nima

    #214044

    Hi!

    Do you use Advanced Layout Builder on these pages?

    Remember that when using ALB the file that is called is template-builder.php.

    Best regards,
    Josue

    #214075

    hi,

    i am using the advanced layout builder.

    but i have created templates to call upon different headers for my pages.

    template-miami.php
    template-sunset.php

    I call on the template via page attributes in the back office.

    template-miami.php has a get_footer() command at the end. Can’t I just modify the get_footer command to call a different footer?

    if i change the get_footer in the template-guilder.php, it will change the footer for every page, correct?

    Thanks!

    #214077

    Hi!

    Does your templates work as expected if you don’t use ALB?

    Best regards,
    Josue

    #214083

    the template works- i am just not able to call upon a different footer with it. I am able to get a different header:

    get_header(‘miami’);

    but not

    get_footer(‘miamifooter’);

    #214085

    <?php
    /*
    Template Name: Miami
    */
    ?>

    <?php
    global $avia_config, $post;

    if ( post_password_required() )
    {
    get_template_part( ‘page’ ); exit();
    }

    /*
    * get_header is a basic wordpress function, used to retrieve the header.php file in your theme directory.
    */
    get_header(‘miami’);

    // set up post data
    setup_postdata( $post );

    //check if we want to display breadcumb and title
    if( get_post_meta(get_the_ID(), ‘header’, true) != ‘no’) echo avia_title();

    //filter the content for content builder elements
    $content = apply_filters(‘avia_builder_precompile’, get_post_meta(get_the_ID(), ‘_aviaLayoutBuilderCleanData’, true));

    //check first builder element. if its a section or a fullwidth slider we dont need to create the default openeing divs here

    $first_el = isset(ShortcodeHelper::$tree[0]) ? ShortcodeHelper::$tree[0] : false;
    $last_el = !empty(ShortcodeHelper::$tree) ? end(ShortcodeHelper::$tree) : false;
    if(!$first_el || !in_array($first_el[‘tag’], AviaBuilder::$full_el ) )
    {
    echo avia_new_section(array(‘close’=>false,’main_container’=>true));
    }

    $content = apply_filters(‘the_content’, $content);
    echo $content;

    //only close divs if the user didnt add fullwidth slider elements at the end. also skip sidebar if the last element is a slider
    if(!$last_el || !in_array($last_el[‘tag’], AviaBuilder::$full_el_no_section ) )
    {
    $cm = avia_section_close_markup();

    echo “</div>”;
    echo “</div>$cm”;

    //get the sidebar
    $avia_config[‘currently_viewing’] = ‘page’;
    get_sidebar();

    }
    else
    {
    echo “<div><div>”;
    }

    echo ‘ </div><!–end builder template–>’;
    echo ‘</div><!– close default .container_wrap element –>’;

    get_footer(‘miamifooter’);

    #215259

    Hey!

    if i change the get_footer in the template-guilder.php, it will change the footer for every page, correct?

    Yes, that’s correct. However you can use conditionals: http://codex.wordpress.org/Conditional_Tags to load different footers on different pages. I.e. Replace this code in template-builder.php

    
    get_footer();
    

    with

    
    
    if(is_page(array(42,54,6))){
    get_footer('miamifooter');
    }else if(is_page(array(4,5,67))){
    get_footer('othercustomtmp');
    }else{
    get_footer();
    }
    

    Then replace 42,54,6 and 4,5,67 with your custom page ids and make sure that the right templates are called. The example code above would use the “miamifooter” template on the pages 42,54 and 6. The “othercustomtmp” is used on 4,5,67 and all other pages will use the default template.

    Regards,
    Peter

    #215448

    Thanks! Will give it a try!

    Nima

    #215566

    We looking forward to hearing from you Nima :)

    Regards,

    Josue

    #409624

    This solution sounds interesesting. But we use WPML, so page id’s numbers is not ideal to have the correct footer called. is it possible to use classes or id’s(#) to do this?

    #409980

    Hi!

    No but you can use the icl_object_id function: http://wpml.org/documentation/support/creating-multilingual-wordpress-themes/language-dependent-ids/ to get the translated page id – use it like:

    
    $page_ids = array();
    $page_ids['miamifooter'] = array(42,54,6);
    $page_ids['othercustomtmp'] = array(4,5,67); 
    
    foreach($page_ids as $key => $page_id)
    {
    	foreach($page_id as $count => $id)
    	{
    		$xlat = icl_object_id($id, 'page', true);
    		if(!is_null($xlat)) $page_ids[$key][$count] = $xlat;
    	}
    }
    
    if(is_page($page_ids['miamifooter']))
    {
    	get_footer('miamifooter');
    }
    else if(is_page($page_ids['othercustomtmp']))
    {
    	get_footer('othercustomtmp');
    }
    else
    {
    	get_footer();
    }
    

    and replace the page ids in the arrays with your ids and the template names, etc.

    Best regards,
    Peter

Viewing 17 posts - 1 through 17 (of 17 total)
  • The topic ‘multiple footer for different templates’ is closed to new replies.