-
AuthorPosts
-
January 21, 2014 at 9:21 pm #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.phpAlso, 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
January 22, 2014 at 2:05 am #213114Hi 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!
IsmaelJanuary 22, 2014 at 6:32 pm #213465Hi Ismael,
Here are the links:
http://nimka.com/barcelonetarestaurant/south-beach
http://nimka.com/barcelonetarestaurant/sunsetat 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.
January 22, 2014 at 9:14 pm #213528Hi,
Any updates?
Thanks, Nima
January 23, 2014 at 4:15 am #213674Hi!
Do you have any Cache/Minify plugin activated?
Cheers!
JosueJanuary 23, 2014 at 2:20 pm #213843Hi,
No I don’t. Should I?
Nima
January 23, 2014 at 4:22 pm #213925Hi, is there anyway we can wrap this up?
Thanks,
Nima
January 23, 2014 at 7:35 pm #214044Hi!
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,
JosueJanuary 23, 2014 at 8:47 pm #214075hi,
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.phpI 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!
January 23, 2014 at 8:55 pm #214077Hi!
Does your templates work as expected if you don’t use ALB?
Best regards,
JosueJanuary 23, 2014 at 9:10 pm #214083the 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’);
January 23, 2014 at 9:11 pm #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’);
January 27, 2014 at 10:33 am #215259Hey!
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,
PeterJanuary 27, 2014 at 6:50 pm #215448Thanks! Will give it a try!
Nima
January 27, 2014 at 11:34 pm #215566We looking forward to hearing from you Nima :)
Regards,
JosueMarch 11, 2015 at 1:13 am #409624This 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?
March 11, 2015 at 5:32 pm #409980Hi!
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 -
AuthorPosts
- The topic ‘multiple footer for different templates’ is closed to new replies.