ThemeShaper Forums » Thematic

[closed]

Newbie php question about how to remove nav below posts on single page only.

(3 posts)
  • Started 10 years ago by shelzmike
  • Latest reply from bconradt
  • This topic is not resolved
  1. shelzmike
    Member

    Hello -

    I have a need to remove the navigation below the posts, but ONLY on the single post page. For instance, I have a category (Important Dates) that I have a link to that shows the lists of posts in that category and there are about 30. The problem is that I used the following code to remove the navigation below, which works great:

    function remove_under_post_nav() {
    	remove_action('thematic_navigation_below','thematic_nav_below', 2);
    }
    add_action('init', 'remove_under_post_nav');

    However, as one would know, this removes it for ALL posts and pages. I only want to remove it on the pages that displays the single post. I know it is simply adding some conditional code to the above, but I am a php newbie, so cannot figure it out. Thanks!

    Posted 10 years ago #
  2. I get by through trial and error, and with the generous help of others more versed in PHP, so please take the following code with a HUGE grain of salt. It is not tested, but I think it may get you closer.

    http://codex.wordpress.org/Conditional_Tags#A_Single_Post_Page

    function remove_under_post_nav() {
         if (is_single()) {
                  remove_action('thematic_navigation_below','thematic_nav_below', 2);
         } else {
               return TRUE;
         }
    }
    add_action('init', 'remove_under_post_nav');

    I'm especially unsure about the "return TRUE;" part as I pulled that from a function I have for something else.

    Posted 10 years ago #
  3. Had the same problem and found the solution here:
    http://forums.themeshaper.com/topic/why-isnt-this-filter-function-working-changing-previous-post-link-text

    Using wp hook instead of init does the trick.

    // Remove bottom navigation
    function remove_nav_below() {
    	if (is_single()) {
    		remove_action('thematic_navigation_below', 'thematic_nav_below', 2);
    	}
    }
    add_action('wp','remove_nav_below');
    Posted 9 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.