Twenty Eleven
Want news posts to show title instead of first 20 words of content (9 posts)

  1. faithhammer
    Posted 2 years ago #

    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">
      <?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; ?>
  2. esmi
    Forum Moderator
    Posted 2 years ago #

    Are you using a child theme?

  3. faithhammer
    Posted 2 years ago #

    From what I can determine, the website is using a custom/modified version of the Twenty Eleven theme. There are two templates that I can see thay may be child themes, one is child.php - "Without Feature Image Template Page Template, and child-featured-images.php "Feature Image Template Page Template."

    I do not see any reference in the code to a specific child theme, but I honestly don't know if I am looking in the right place.

  4. esmi
    Forum Moderator
    Posted 2 years ago #

    Site url?

  5. faithhammer
    Posted 2 years ago #

  6. esmi
    Forum Moderator
    Posted 2 years ago #

    You are not using the 2011 theme. You are using a custom theme. Have you tried contacting the person(s) who created this theme for assistance?

  7. faithhammer
    Posted 2 years ago #

    I see. Unfortunately the job was originally outsourced to an agency in Africa, and we have no more contact with them. After the initial setup we were "handed the keys" and that was that.

  8. esmi
    Forum Moderator
    Posted 2 years ago #

    I'm sorry but as you are using a custom theme, there is very little we can offer in the way of assistance as we have no idea exactly how this theme was put together. Looking at the code you posted above, it no longer bears any real resemblance to the original 2011 theme. All I can suggest is that, if you cannot manage this yourself, you may want to consider hiring someone.

  9. faithhammer
    Posted 2 years ago #

    Thank you for your time and attention to this, I really do appreciate it. If anything, this whole process is going to improve my knowledge of PHP as I continue to experiment.

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic