ThemeShaper Forums » Thematic


change 'previous_post_link' appearance by filter not working

(7 posts)
  • Started 9 years ago by mo
  • Latest reply from mo
  • This topic is resolved
  1. Hello Forum! I have a somehow strange problem… I just wanted to change the appearance of the next & previous post-links. I tried for some time now bit it simply is not working…

    I looked up the source code and tryed to build a filter. I'm not that good at filtering php stuff so here is my code:

    function childtheme_prev_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

    I don't even know if I did that right… The three MMM are just for testing purposes. I just wanted to change or remove the basic « symbol.

    Help would be very much appreciated!

    Posted 9 years ago #
  2. Ain't nobody got any idea how to do that?

    Posted 9 years ago #
  3. try this:

    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

    For the next link use childtheme_override_next_post_link

    Posted 9 years ago #
  4. Hi Jose, thanks for your approach!

    You just changed the ‹function childtheme_prev_post_link()› to ‹function childtheme_override_previous_post_link()› right?

    But that unfortunately this is still not working. I just get the same old « on the screen…
    Just cannot explain myself why this ain't working… could there be another filter in my functions that is already calling something that blocks this one?
    I searched the document for navigation stuff but I didn't used it until now,… so I really got no solution…

    Posted 9 years ago #
  5. I could post my complete ‹functions.php› if that helps…

    Posted 9 years ago #
  6. Hm strange i tried that one before posting it and worked for me, looking at thematic code, if you declare childtheme_override_previous_post_link(), it should use it instead of the original one.

    To test if something is blocking the code rename the functions file and create a clean one with just that to see if it works. If it works copy and paste stuff from the old functions one function at a time to find the problem.

    Also the method i mentioned i tested only on latest thematic version,, make sure you have that but be aware that updating to it can reset some widget or break your main menu a bit like explained here:

    Posted 9 years ago #
  7. Ouh!
    It was the new ‹Thematic› version I didn't update to… now it works like a charm! Thanks for that little hint…
    I have got another little problem with separators for category list… perhaps you got any tips there, too?

    I know it's off-topic but here is the CSS I used for the separators:

    .widget_categories li{
    display: inline;
    font-style: normal;

    .widget_categories li:after{
    content: " | ";

    .widget_categories li:last-of-type:after{
    content: none;

    This CSS solution works fine in Firefox but does (for some strange reason) not work in Safari. For the tags-widget I used php to create the separators but I'm not quite sure how this would work for the cats.
    Here's my code for the tag-separators:

    // configure Tag-Cloud
    function my_tag_cloud($defaults) {
    $args = array(
    'smallest' => 7, 'largest' => 7, 'unit' => 'pt', 'number' => 25,
    'format' => 'flat', 'separator' => " | ", 'orderby' => 'name', 'order' => 'ASC',
    'exclude' => '', 'include' => '', 'link' => 'view', 'taxonomy' => 'post_tag', 'echo' => true
    $args = wp_parse_args( $args, $defaults );
    $tags = get_terms( $args['taxonomy'], array_merge( $args, array( 'orderby' => 'count', 'order' => 'DESC' ) ) ); // Always query top tags

    if ( empty( $tags ) )

    foreach ( $tags as $key => $tag ) {
    if ( 'edit' == $args['link'] )
    $link = get_edit_tag_link( $tag->term_id, $args['taxonomy'] );
    $link = get_term_link( intval($tag->term_id), $args['taxonomy'] );
    if ( is_wp_error( $link ) )
    return false;

    $tags[ $key ]->link = $link;
    $tags[ $key ]->id = $tag->term_id;

    $return = wp_generate_tag_cloud( $tags, $args ); // Here's where those top tags get sorted according to $args

    $return = apply_filters( 'my_tag_cloud', $return, $args );

    if ( 'array' == $args['format'] || empty($args['echo']) )
    return $return;

    echo $return;

    Posted 9 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.