Reputation: 67
I'm a complete PHP newbie and I need a solutionto get the most out of this stupid problem with a custom Wordpress theme.
I found the part where excerpts to on index page are 'made' and all I need is to add "..."
to the end of this part.
<?php
echo wpautop(
$post->post_excerpt
? $post->post_excerpt
: athemes_limit_string(strip_tags($post->post_content), 200)
);
?>
I tried to add them after this line, but they showed up after the break, but I want them inline.
Upvotes: 1
Views: 194
Reputation: 1884
There are better ways of doing this, but to answer your question:
echo wpautop( $post->post_excerpt ? $post->post_excerpt : athemes_limit_string(strip_tags($post->post_content), 200).'...' );
Upvotes: 1
Reputation: 197624
In PHP you can add anything you want in the HTML by doing it outside of PHP, that here is after the ending ?>
marker:
[...] ?> ...
Compare: http://php.net/language.basic-syntax.phpmode
I'd say that is the most simple and flexible method when you're concerned about themeing. The second suggestion I would give is to add it as a string to the echo, works by using a comma (,
):
echo wpautop( $p ... nt), 200) ), '...';
^^^^^^^
Compare: http://php.net/echo , http://php.net/string
The function in Wordpress for this btw is the_excerpt()
and if you modify a theme, you should just hook in that. Looks like the custom theme you've got is doing things out of the lines. The the_excerpt
function btw. add that on it's own, you don't need to care.
Upvotes: 0