Posts Topics Forums Images
Search videos from message boards Videos Search messages from microblogs Microblogs Search messages from imdb.com Imdb Search messages from yuku.com Yuku Search messages from lefora.com (free forums) Lefora
My account: Login | Sign Up
Loading... 

Thread: Separate "Read more" from "php the_content"

Started 1 month, 1 week ago by ghaib
Hi, I'm doing a theme where the text (eg. content) is wrapped in a div with a bg color. I'd like to separate the "Read more" button in a new div below, is that possible? To separate "Read more" from the standard php the_content line: <?php the_content('Read more »'); ?> Thanks!
Site: WordPress Support  WordPress Support - site profile
Forum: Themes and Templates  Themes and Templates - forum profile
Total authors: 7 authors
Total thread posts: 16 posts
Thread activity: no new posts during last week
Domain info for: wordpress.org

Other posts in this thread:

kiano.ro replied 1 month, 1 week ago
link?

ghaib replied 1 month, 1 week ago
I don't have a link at the moment, just doing some testing and research. Basically, is there a php string in WP to call the "read more button", which is separated from the get_content string? E.g. this: <?php the_content('Read more &raquo;'); ?> Becomes: <?php the_content(); ?> and this <?php ('Read more &raquo;'); ?>

kiano.ro replied 1 month, 1 week ago
yes, it's possible to do that. but i need to see your theme and your codes. until then i cannot tell you anything about the way you can do it.

pboosten replied 1 month, 1 week ago
nah, this is probably what you want. Peter

ghaib replied 1 month, 1 week ago
@kiano.ro: I posted the code, I'm basically looking to separate the two, there isn't more to it, it's not theme specific. Is there a code which resembles <?php ('Read more &raquo;'); ?> (without the "get_content" part)?

jrav001 replied 1 month, 1 week ago
In your new div, but within the same loop, put: <a href="<?php the_permalink(); ?>Read More</a>

ghaib replied 1 month, 1 week ago
@jrav001: Thanks for the tip, it works, however, it always displays the "Read more" button, even if read more isn't used in the post.

jrav001 replied 1 month, 1 week ago
You can add code to the string.... <?php the_content('<div>Read more &raquo;</div>'); ?>

t31os_ replied 1 month, 1 week ago
If you're trying to end the content DIV and start a new one, then you could use.. <?php the_content('</div><div>Read more &raquo;'); ?> The first closing DIV will close the current DIV (the one the content is in i assume), then open a new, which would be closed by the contents regular closing tag.. So rather then having.. <div> some content <div> more </div> </div> you'd end up ...

ghaib replied 1 month, 1 week ago
@t31os_ Yep, that's exactly what I mean. I solved it partially by doing this: <?php the_content(''); ?> And then this, in a separate div: <a href="<?php the_permalink(); ?>">Read more</a> However, a new problem emerges: the "Read more" button will always be present, linking to the post, whether <!--more--> is specified in the post or not.

 

Top contributing authors

Name
Posts
ghaib
6
user's latest post:
Separate "Read more"...
Published (2009-11-10 22:40:12)
bump
t31os_
3
user's latest post:
Separate "Read more"...
Published (2009-11-14 19:04:40)
To add to the above, the reasoning for using $post-&gt;post_content over get_the_content is simple. With get_the_content, the data has already had the shortcodes processed, therefore &lt;!--more--&gt; will not exist, the same does not ring true for $post-&gt;post_content . ghaib please mark your thread as resolved if the information supplied was sufficient.
kiano.ro
2
user's latest post:
Separate "Read more"...
Published (2009-11-07 18:56:51)
yes, it's possible to do that. but i need to see your theme and your codes. until then i cannot tell you anything about the way you can do it.
jrav001
2
user's latest post:
Separate "Read more"...
Published (2009-11-07 22:56:51)
You can add code to the string.... &lt;?php the_content('&lt;div&gt;Read more &amp;raquo;&lt;/div&gt;'); ?&gt;
pboosten
1
user's latest post:
Separate "Read more"...
Published (2009-11-07 18:56:51)
nah, this is probably what you want. Peter
parryjaswal
1
user's latest post:
Separate "Read more"...
Published (2009-11-25 11:35:57)
Thanks t31os_ worked for me :)
bonx
1
user's latest post:
Separate "Read more"...
Published (2009-12-03 13:09:53)
jrav001 nearly had it but use span with display:block; not div otherwise code will not validate ;)... PHP: &lt;?php the_content('&lt;span class=&quot;more&quot;&gt;Read More &amp;raquo; &lt;/span&gt;'); ?&gt; CSS: .more { display:block; margin-top:10px; text-align:right; }

Related threads on "WordPress Support":

Related threads on other sites:

Thread profile page for "Separate "Read more" from "php the_content"" on http://wordpress.org. This report page is a snippet summary view from a single thread "Separate "Read more" from "php the_content"", located on the Message Board at http://wordpress.org. This thread profile page shows the thread statistics for: Total Authors, Total Thread Posts, and Thread Activity