ThemeShaper Forums » Thematic

[closed]

How To Remove older and newer posts links

(9 posts)
  • Started 14 years ago by Method
  • Latest reply from helgatheviking
  • This topic is resolved
  1. Hi

    Ive installed a page navigation plugin (http://www.jenst.se/2008/03/29/wp-page-numbers) which is working nicely, but it hasnt removed the thematic page navigation of "<< Older posts" and "Newer posts >>".

    How do I remove this from search.php and index.php?

    Cheers

    Posted 14 years ago #
  2. To answer my own question I edited 'wp-content/themes/thematic/library/styles/default.css' from this:

    /* =Navigation -- */

    .nav-previous {
    float: left;
    width:50%;}

    .nav-next {
    float: right;
    width:50%;
    text-align:right;}

    To this:

    /* =Navigation -- */

    .nav-previous {
    display:none;}

    .nav-next {
    display:none;}

    Posted 14 years ago #
  3. ap0019er
    Member

    I don't think hiding them with css is the best solution. The php for that will still be executed, and the html will still contain those elements.

    A better solution would be to add the following code to the functions.php file in your child theme:

    function remove_post_navigation() {
    	remove_action('thematic_navigation_below', 'thematic_nav_below', 2);
            remove_action('thematic_navigation_above', 'thematic_nav_above', 2);
    }
    add_action('init', 'remove_post_navigation');

    You can of course use only one of the two "remove_action"s depending on which pagination you want to remove.

    Posted 14 years ago #
  4. Unfortunately your suggestion removes the entire page navigation, including the plugin's navigation.

    Posted 14 years ago #
  5. ap0019er
    Member

    To add the new plugin navigation, you just need to hook it in place of the old navigation. Add the following code to your child theme functions.php

    // Action to create the new below navigation
    function childtheme_nav_below() {
    		if (is_single()) { ?>
    
    			<div id="nav-below" class="navigation">
    				<div class="nav-previous"><?php thematic_previous_post_link() ?></div>
    				<div class="nav-next"><?php thematic_next_post_link() ?></div>
    			</div>
    
    <?php
    		} else { ?>
    
    			<div id="nav-below" class="navigation">
                    //this is the important bit
                    <?php if(function_exists('wp_page_numbers')) { ?>
                    <?php wp_page_numbers(); ?>
                    <?php } else { ?>
    				<div class="nav-previous"><?php next_posts_link(__('<span class="meta-nav">&laquo</span> Older posts', 'thematic')) ?></div>
    				<div class="nav-next"><?php previous_posts_link(__('Newer posts <span class="meta-nav">&raquo</span>', 'thematic')) ?></div>
    				<?php } ?>
    			</div>	
    
    <?php
    		}
    }
    add_action('thematic_navigation_below', 'childtheme_nav_below', 2);

    This function is exactly the same as the "thematic_navigation_below" function, except it doesn't look for the wp_pagenavi function (as thematic does), it looks for the wp-page-numbers function.

    The original "thematic_navigation_below" function can be found in "wp-content/themes/thematic/libary/extensions/content-extensions.php".

    Posted 14 years ago #
  6. As per ap0019er's initial response, how come the following code wouldn't work for me? (I've since used the suggested code and it works a charm, just so I understand.)

    function remove_nav_below() {
    }
    add_filter('thematic_navigation_below','remove_nav_below', 2);
    Posted 12 years ago #
  7. b/c thematic_navigation_below isn't a filter, it is an action. you can tell where filters are available b/c they are marked APPLY_FILTERS

    Posted 12 years ago #
  8. fwunder
    Member

    Won't this work just to blast 'em away?

    function childtheme_override_nav_below() { }

    Posted 12 years ago #
  9. i believe so. don't feel like testing it, but it should.

    Posted 12 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.