ThemeShaper Forums » Thematic

[closed]

Add custom text to post navigation links

(4 posts)
  • Started 3 years ago by tcarnell
  • Latest reply from Direct Sponsor
  • This topic is not resolved
  1. tcarnell
    Member

    Hi everyone,

    I'm displaying the usual Previous/Next post navigation above each of my posts.
    I want to add a bit of custom text to these links, so they appear as
    « Previous Post: POST TITLE Next Post: POST TITLE »

    It's the 'Previous Post: ' and 'Next Post: ' text that I want to add.

    Can anyone give me some idea of what I need to put in a custom function to perform this?

    Many thanks in advance,
    Tony.

    Posted 3 years ago #
  2. I also require this.

    It seems clear here: http://codex.wordpress.org/Next_and_Previous_Links

    Thematic doesn't seem to make use of the standard functions so I'm not too sure how to apply it.

    Where can I find: thematic_previous_post_link?

    Posted 3 years ago #
  3. I found the following solution in another thread (http://forums.themeshaper.com/topic/change-previous_post_link-appearance-by-filter-not-working).

    To customize the content of the links try tweaking some of the values in the below filter:

    function childtheme_override_previous_post_link() {
    	$args = array ('format' => '%link',
    		       'link'   => '<span class="meta-nav">MMM</span> %title',
    		       'in_same_cat' => FALSE,
    		       'excluded_categories' => '');
    	$args = apply_filters('childtheme_prev_post_link_args', $args );
    	previous_post_link($args['format'], $args['link'], $args['in_same_cat'], $args['excluded_categories']);
    } // end thematic_previous_post_link
    add_filter('thematic_previous_post_link','childtheme_override_previous_post_link');

    You can further customize the links by removing the navigation:

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

    ...and adding whatever you require:

    function add_custom_navigation_above() {
    	?>
    	<div id="nav-above" class="navigation">
    	 <div class="nav-previous"><?php thematic_previous_post_link() ?></div>
    	 <div class="nav-next"><?php thematic_next_post_link() ?></div>
    	</div>
       <?php
    }
    add_action('thematic_navigation_above','add_custom_navigation_above');

    This will do the trick ;-)

    Posted 3 years ago #
  4. This plugin may save you some time:
    http://wordpress.org/extend/plugins/ambrosite-nextprevious-post-link-plus/

    I've used it for implementing tooltips on the post links.

    Posted 3 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.