The title says it all - I want the excerpt of my post to be displayed on the front page to be the one in front of the <!--more--> tag instead of a fixed amount of characters. I've tried Google, Forum searches, etc. but I couldn't find anything to help me.
Thanks in advance!
Can anyone help with this? I'm sure it's easy, I just don't get how I can activate it in the twentyten theme!
what you are asking for is the default behaviour of twenty ten.
what exact theme are you using?
have you made any modification to it?
link to your site?
It's working on category pages, but not on the index page. This is the code where the code for the index page comes from:
<?php if ( is_front_page() || is_archive() || is_search() ) : // Only display excerpts for archives and search. ?>
<div class="entry-summary">
<?php if ( has_post_thumbnail() ) { ?>
<div class="post-image"><?php the_post_thumbnail( 'full' ); ?></div>
<?php } ?>
<?php the_excerpt(); ?>
<div class="clear"></div>
</div><!-- .entry-summary -->
<?php else : ?>
<div class="entry-content">
<?php the_content( __( '<span class="meta-nav">Continue reading</span>', 'twentyten' ) ); ?>
<?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?>
</div><!-- .entry-content -->
<?php endif; ?>
When I change the_excerpt() to the_content(), or when I remove is_front_page(), I ALWAYS get the entire entry on the front page and not my custom excerpt.
When I change the_excerpt() to the_content(), or when I remove is_front_page(), I ALWAYS get the entire entry on the front page and not my custom excerpt.
do you want to use the 'more tag' and have that control the length of your post on the front page, or do you want to show the handwritten custom excerpt?
you could try and replace is_front_page() with is_home(), or add || is_home() to the conditional statement;
http://codex.wordpress.org/Conditional_Tags
Thanks!
Unfortunately is_home() doesn't do any difference to my template. If I add it or replace is_front_page() with it I'm still not seeing my custom excerpt (the content before the <!--more--> tag in my post), neither when I use the_excerpt() nor when I use the_content()...
sometimes, plugins interfere with the normal working;
try to deactivate all plugins; if this solves the problem, re-activate one plugin at a time, to see which is causing the trouble.
I think I just figured out that the problem is somewhere in my modified index.php, because when I replace the modified index with the default twentyten one, it works fine. However, I can't find what's wrong with it..?!
[code moderated according to Forum Rules - please use the pastebin]
possibly, because you have queried a 'cat' parameter;
try to replace this query
query_posts('cat=-5');
with:
(example)
global $query_string; query_posts($query_string . '&cat=-5');
(i can't remember the cat id you were excluding)
Still no luck :(
When I remove the query_posts completely, I get the same page as the one I'm querying for my "intro div". I assume it's something to do with that, because when I remove all the code in the intro div, it works fine.
Do I have to tell query posts something more specific that it should query posts for the index?!
The code is here: http://pastebin.com/npPCZ60Z
I get the same page as the one I'm querying for my "intro div"
thanks for the hint - i missed that bit -
try to reset the data after the first loop, after line 32:
<?php endwhile; // end of the loop.
wp_reset_query(); ?>
Hmmpf, still not working :(
I'm very clueless...
It also doesn't work when I replace get_template_part('loop', 'index'); with it's equivalent from the loop.php. I'm out of ideas. Is there anything else I can try?
I've also tried completely replacing the part of the code which loads my page excerpt before the posts loop with a "manual" SQL query. The <!--more--> then works, but it doesn't display the "read more" links - neither with the_excerpt() nor withthe_content()
*headdesk*
You need to use the Loop and the_content() if you also want to use the more tag.
adastra
Member
Posted 12 months ago #
I'm still having the same problem. I've tried wp_reset_query();, rewind_posts(); and wp_reset_postdata();, but nothing helps. Still the same weird phenomenon.