Want news posts to show title instead of first 20 words of content
-
I don’t use wordpress often, and my php is limited to what I have picked
up over time, so I come seeking aid.The Background:
My school’s site wishes for new posts in the “News” category to show the title of the post instead of showing excerpts from the content on our front page.What I’ve tried and results:
- Following guides, I tried using maunual excerpts. These changed nothing on the front page.
- I tried using the more tag to put the title in the post itself, followed by the nospoiler tag so it would not show in the full post. This worked in changing what was displayed on the front page, but it broke the link to the full post
- In my site’s index.php (section referenced below), I can see a line where the excerpt is called to appear with the echo contentr(’20’). I do not know why there is an “r” after content, as I could find no other documentation on that specific word. I changed this to “the_title();” and it did indeed pull up the title instead, but also broke the permalink.
I feel that this should be a simple fix and I am missing something very, very obvious, but for the life of me I don’t know what that could be. Any help would be greatly appreciated in this regard.
<div class="BoxThree"> <div class="InnerArea"> <span class="GreenH2">NEWS</span> <span class="LiBox"> <ul> <?php if ( have_posts() ) : ?> <?php //twentyeleven_content_nav( 'nav-above' ); ?> <?php query_posts('cat=4&showposts=3'.get_option('posts_per_page')); ?> <?php /* Start the Loop */ ?> <?php $count=0;?> <?php while ( have_posts() ) : the_post(); ?> <?php// get_template_part( 'content', get_post_format() ); ?> <li> <?php //the_excerpt(); echo contentr('20');?></li> <?php $count++; if($count == 3){ break; } ?> <?php endwhile; ?> <?php //twentyeleven_content_nav( 'nav-below'); ?> <?php else : ?> <article id="post-0" class="post no-results not-found"> <header class="entry-header"> <h1 class="entry-title"><?php _e( 'Nothing Found', 'twentyeleven' ); ?></h1> </header><!-- .entry-header --> <div class="entry-content"> <p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'twentyeleven' ); ?></p> <?php get_search_form(); ?> </div><!-- .entry-content --> </article><!-- #post-0 --> <?php endif; ?> </ul> </span></div> </div>
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘Want news posts to show title instead of first 20 words of content’ is closed to new replies.