How to add a “Read More…” link to the Linquist theme…

Thursday, October 29th, 2009

The Linquist theme (http://redworks.sk/wp-themes/linquist/) is a pretty sweet, simple to use, theme.  However it’s crippled… If you want to add more text to an entry but not display it on the front page and have a “Read more…” link instead it is simply just not possible by default. I was contacted by a friend to see if it were possible to fix this since the author of the theme wanted him to pay to have this feature (which is pretty repulsive if you ask me, because it’s two lines of code to fix). Well here is the solution that I came up with:

1.) In the administration area of WP go to the theme editor (Appearance > editor) and open the index.php file.
2.) Find the following line of code:

<?php echo apply_filters(’the_content’, $content[1]); ?>

3.) Immediately below that line add this:

<?php if(!empty($content[2])){echo(’<a href=”‘);the_permalink();echo(’”>Read more…</a>’);} ?>

That’ll take care of the main page.

4.) Now open the single post page (single.php) and find this line of code:

<?php echo apply_filters(’the_content’, $content[1]); ?>

5.) And immediately below that add this:

<?php echo apply_filters(’the_content’, $content[2]); ?>

Now all you have to do in your posts is add a second <!-more-> tag (by clicking the button) between what you want your front page text to be and the rest of the article.

so it’ll be like this:

picture-21

UPDATE:

Thanks to Andrew, I think we tracked down the source of the T_STRING errors that a few people are getting.

I was receiving the “unexpected T_STRING” error and looking closer at the code I pasted from this post I realized the single ‘ and double quote ” characters looked strange. I typed in my own characters from the wp admin and all seems well now.

Thanks Andrew!

14 Comments

  1. Hey, that’s a pretty cool solution, it never occured to me that I can do it like that, stupid me! I’ll post a link to your solution on the theme’s page, so people find it easier.

  2. tom 11.04.09

    Thank you so much. You made my day.

  3. Hello,

    I am looking to do just exactly this and mine didn’t work. I love this template however I will want to use it for longer blog posts but if I can’t have the ‘read more’ option then there is no point for me to go with this template because it just looks messy.

    I followed the rules exactly and I got this error code when I went and refreshed the page

    Parse error: syntax error, unexpected T_STRING in /nfs/c02/h06/mnt/20204/domains/francaschulte.com/html/wp-content/themes/linquist/index.php on line 16

    What am I doing wrong?

  4. Check your email Franca. I’ll take a look at your setup if you want.

  5. Hi Steve,

    This is a great trick! I am trying it out and the first part works indeed. However on the single template it magically inserts the text without the p tags ( and ).

    Do you have any idea why, and how to fix this?

  6. I already was afraid that the tags wouldn’t make it. Of course I should have written it differently, here goes again:

    <p> and </p>

  7. Piet 02.07.10

    Partly solved the problem now:
    <?php echo apply_filters(’the_content’, $content = ‘<p>’ . $content[2]) . ‘</p>’; ?>

    but now it wraps the entire content after the 2nd more tag in 1 paragraph, so not entirely solved yet. I’ll let you know if any progress…

  8. Piet 02.07.10

    OK, I have to take back all my comments, I copied your code and I did not replace all the ‘ curls correctly… pretty lame, I know, sorry.

    Thanks for guiding the path :)

  9. tep 02.09.10

    I received the same message as Franca about the Parse error: syntax error, unexpected T_STRING in index.php after I made the changes.

    Can you please advise as to how to fix this and still enable the “read more” option?

    Thank you

  10. Tep, please email me with some credentials for your wp-admin. Franca never emailed me back with his, so I haven’t been able to trace the error. I’d love to take a look for you though.

  11. I was receiving the “unexpected T_STRING” error and looking closer at the code I pasted from this post I realized the single ‘ and double quote ” characters looked strange. I typed in my own characters from the wp admin and all seems well now.

  12. Thanks Andrew, I just updated the article to include what you said!

  13. I followed the instructions (including the part on the quotation marks) and it still won’t work.

  14. Hi Karmel, is it giving you an error? Or is it not doing anything at all? If you’d like, I’d be willing to log into your wordpress backend (you can make a special user account for me) and take a look for you. Drop me a line at stevejabs [at] gmail [dot] com. I’d be more than happy to help.


Leave a Response

* Name, Email, Comment are Required