• Resolved sbl03

    (@sbl03)


    This is what I have currently.. http://d.pr/i/QoLk

    I want to put the ‘read more’ link in the footer next to the tags, how would I get this done? I’m using the_excerpt() instead of the_content() if that makes a difference..

    Thanks in advance.

Viewing 6 replies - 1 through 6 (of 6 total)
  • what theme are you using?
    can you post link to your site?

    if you are using the_excerpt(), is the ‘read more’ link done with the usual filter function in functions.php?

    or is is hardcoded in the template?

    Thread Starter sbl03

    (@sbl03)

    I am creating my own theme based on the Bones Responsive template. It is in localhost, I do not have a test server set up. And yes, that is the exact function I used to create the link.

    An alternate solution would be to remove the read only link altogether, and insert my own in the footer, but I would want it to conditionally display when there is actually more to read.. going to look in the codex more.

    Thanks!

    to make a hard-coded ‘read-more’ link, work with:
    http://codex.wordpress.org/Function_Reference/the_permalink

    is the post footer code directly in the template, or a function?

    Thread Starter sbl03

    (@sbl03)

    The code is directly in the template:

    <header></header>
    <section class="post-content clearfix"></section>
    <footer></footer>

    Hard-coding the ‘read more’ link in the footer achieves what I’m looking for, but how do you make it conditionally show if there is actually still more to read? I tried checking if(get_the_content()==get_the_excerpt()).. didn’t work.

    if(strpos($post->post_content, '<!--more-->')) and if (function_exists('has_excerpt') && has_excerpt()) didn’t work reliably… the first didn’t work in a post with a lot of images, and the second didn’t work at all.

    you could check for whatever character your excerpt would append to shortened articles;

    example – checking for the default characters:

    <?php if(strpos(get_the_excerpt(),'[...]')) { ?>
    <a href="<?php the_permalink(); ?>" title="read more">read the rest ...</a>
    <?php } ?>
    Thread Starter sbl03

    (@sbl03)

    Great idea! This ensures that it uses whatever conditional WordPress used. I changed the function to change the ‘read more’ text into something obscure that would never come up in a post, wrapped it in a class, used that conditional to check for the text inside the loop, and styled it to never display.

    Inside functions.php:

    function new_excerpt_more($more) {
           global $post;
    	return '<div class="moretext">@more@</div>';
    }
    add_filter('excerpt_more', 'new_excerpt_more');

    Inside index.php:

    <?php if(strpos(get_the_excerpt(), '@more@')) { ?>
    <a class="readmore" href="<?php the_permalink() ?>">read more...</a>
    <?php } ?>

    Inside stylesheet:

    .moretext {
    	display: none;
    }

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Putting 'read more' in the footer’ is closed to new replies.