ThemeShaper Forums » Thematic

[closed]

Swapping output in footer depending on Page

(4 posts)
  • Started 3 years ago by Andrew
  • Latest reply from Andrew
  • This topic is resolved
  1. Hi There,

    I'm trying to create a footer navigation on the inside pages of a site, and removing the footer subsidiaries which are active on the homepage. I want to keep the 3 footer subsidiaries on the homepage only, and on the inside pages I'd like to remove then and replace them with a footer navigation. My basic PHP skills and understanding of hooks and filters are most of my problem! ANy help would be greatly appreciated as well as any major no-no's I'm committing here in the following code. This is what I've got

    // function to remove subs
    function remove_thematic_subs() {
    	 remove_action('thematic_footer','thematic_subsidiaries', 10);
    	}
    
    //Creating SC footer nav
    function sc_footer_nav() {
    	?>
          <div id="footerNav">
          	<ul>
    		<?php wp_list_pages('title_li='); ?>
    		</ul>
          </div>
       <?php
    }
    
    // If Statement to determine which page to remove Subs from
    function footer_swap() {
     // We test if we are on the page front page
     if (is_front_page()) {
     // Yes, we are .. now we leave the subs instact
     return NULL;
     }
     else {
     // we are not .. we turn the subs off and add footer nav
     return add_action('init','remove_thematic_subs');
            add_action('thematic_footer', 'sc_footer_nav');
     }
    }
    // execute removing the subs
    add_action('init','footer_swap');
    Posted 3 years ago #
  2. Danieliser
    Member

    I think in your case maybe changeing from 'init' to 'wp' or 'template_redirect'. Reason being that ive never had good results trying to check is_page() or any other conditional before initialization finishes.

    Second why not us a menu widget and the 'Widget Logic' plugin to hide the home page widgets on other pages.

    Posted 3 years ago #
  3. Thanks Daniel! I wasn't aware of the Widget Logic plugin, which seems incredibly useful for many reasons! And it helps in other problems I was looking at down the road too. Also I replaced the 'init' with 'wp' and it worked. But it still won't create the new footer nav, and I'm not sure if this is because I'm using a single 3.0 style menu... So instead of trying to re-invent the wheel, I'll give a go with this Widget logic and solve a few problems at once. With Wordpress there seems to be a few ways to get from point A to B eh?

    // If Statement to determine which page to remove Subs from
    function footer_swap() {
     // We test if we are on the page front page
     if (is_front_page()) {
     // Yes, we are .. now we leave the subs instact
     return NULL;
     }
     else {
     // we are not .. we turn the subs off
     return remove_thematic_subs();
            add_action('thematic_footer', 'sc_footer_nav');
     }
    }
    // execute removing the subs
    add_action('wp','footer_swap');
    Posted 3 years ago #
  4. So After installing and rocking out with the Widget Logic plugin, I accomplish all I was attempting and more!
    I'll consider this one resolved.
    Thanks Daniel.

    Posted 3 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.