ThemeShaper Forums » Thematic

[closed]

Problem adding images to post nav links

(2 posts)
  • Started 10 years ago by 4rederick
  • Latest reply from 4rederick
  • This topic is resolved
  1. www.josephfrederick.com

    I am trying to place an image next to the post nav links, but am running into a bit of trouble. The images show up fine on single posts pages, but do not appear on the main blog page and the category pages. Anyone have any suggestions?

    This is what I have in functions.php ...

    function childtheme_override_previous_post_link() {
    $args = array ('format' => '%link',
    'link' => '<span class="meta-nav"><img src="http://josephfrederick.com/wp-content/themes/jf/images/nav-previous.png" alt="" /></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');

    function childtheme_override_next_post_link() {
    $args = array ('format' => '%link',
    'link' => '%title <span class="meta-nav"><img src="http://josephfrederick.com/wp-content/themes/jf/images/nav-next.png" alt="" /></span>',
    'in_same_cat' => FALSE,
    'excluded_categories' => '');
    $args = apply_filters('childtheme_next_post_link_args', $args );
    next_post_link($args['format'], $args['link'], $args['in_same_cat'], $args['excluded_categories']);
    } // end thematic_next_post_link
    add_filter('thematic_next_post_link','childtheme_override_next_post_link');

    Posted 10 years ago #
  2. I found a solution.

    I did not realize there are two functions defining the post nav links, one for single pages, and one for all else.

    So here are the two functions to add to functions.php in order to customize the nav links that appear below your posts. In the place of XXX, you can insert anything you wish: a link to an image or text. Then style it up to your liking in CSS. Experiment.

    //========START Customize Post Nav Below=======
    function childtheme_override_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">
    <?php if(function_exists('wp_pagenavi')) { ?>
    <?php wp_pagenavi(); ?>
    <?php } else { ?>
    <div class="nav-previous"><?php next_posts_link(__('<span class="meta-nav">XXX</span> Older posts', 'thematic')) ?></div>
    <div class="nav-next"><?php previous_posts_link(__('Newer posts <span class="meta-nav">XXX</span>', 'thematic')) ?></div>
    <?php } ?>
    </div>
    <?php
    }
    }

    //========END Customize Post Nav BelowW=======

    //========START Customize Post Nav Below for Singles=======
    function childtheme_override_previous_post_link() {
    $args = array ('format' => '%link',
    'link' => '<span class="meta-nav">XXX</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');

    function childtheme_override_next_post_link() {
    $args = array ('format' => '%link',
    'link' => '%title <span class="meta-nav">XXX</span>',
    'in_same_cat' => FALSE,
    'excluded_categories' => '');
    $args = apply_filters('childtheme_prev_post_link_args', $args );
    next_post_link($args['format'], $args['link'], $args['in_same_cat'], $args['excluded_categories']);
    } // end thematic_next_post_link
    add_filter('thematic_next_post_link','childtheme_override_next_post_link');
    //========END Customize Post Nav Below for Singles=======

    Posted 10 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.