• Resolved Christine357

    (@christine357)


    I’ve been customizing my own home page, displaying posts separately from the main blog page. I found code that is suppose to add a “Continue Reading” link to my excerpts but when I implement it, it doesn’t show. According to the site I got it from:

    http://zeaks.org/2012/display-excerpts-in-twenty-twelve-theme
    (scroll down to “Adding the Continue Reading Link”)

    It replaces the […] that shows up at end of excerpts. Thing is, my excerpts don’t even have that and I am thinking that is the reason this new code doesn’t work. So, I’m just wondering what I may be missing in my code that allows one or the other to be there. Here is the code of my custom template page:

    <?php
    /**
     * Template Name: Page of Posts
     *
     * for a child theme of Twenty_Twelve
     */
    
    get_header(); ?>
    
            <div id="primary" class="site-content">
                    <div id="content" role="main">
    
                    <?php
                            $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
                            $args= array(
                                    'category_name' => 'Uncategorized', // Change this category SLUG to suit your use; or see for query parameters http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
                                    'paged' => $paged,
    				'posts_per_page' => 3,
    				'post_type' => 'post',
    );
                            query_posts($args);
                            if( have_posts() ) : ?>
    
                			<?php while ( have_posts() ) : the_post(); ?>
                   				<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    						<header class="entry-header">
    							<h1 class="entry-title">
    								<a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a>
    							</h1>
    						</header><!-- .entry-header -->
    
    						<div class="entry-summary">
    						<!-- Adds the 140x140 thumbnail/featured image -->
            <div class="excerpt-thumb">
                <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentytwelve' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark">
                <?php the_post_thumbnail('excerpt-thumbnail', 'class=alignleft'); ?>
                </a>
            </div>
    							<?php the_excerpt(); ?>
    						</div><!-- .entry-summary -->
    
    						<footer class="entry-meta">
    							<?php twentytwelve_entry_meta(); ?>
    							<?php edit_post_link( __( 'Edit', 'twentytwelve' ), '<span class="edit-link">', '</span>' ); ?>
    						</footer><!-- .entry-meta -->
    	</article><!-- #post -->
                    				<?php comments_template( '', true ); ?>
                					<?php endwhile; // end of the loop. ?>
    
                					<?php twentytwelve_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', 'twentytwelve' ); ?></h1>
                    			</header>
                    			<div class="entry-content">
    <?php the_post_thumbnail(); ?>
                        				<p><?php _e( 'Apologies, but no results were found. Perhaps searching will help find a related post.', 'twentytwelve' ); ?></p>
                        				<?php get_search_form(); ?>
                    			</div><!-- .entry-content -->
                			</article><!-- #post-0 -->
    
                		<?php endif; wp_reset_query(); ?>
    
            </div><!-- #content -->
        </div><!-- #primary -->
Viewing 4 replies - 1 through 4 (of 4 total)
  • what is the exact code you have added into functions.php of the child theme?

    do you have a link to your site to illustrate the output?

    are your post’s contents long enough to be shortened by the excerpt?
    are you using hand-written excerpts?

    Thread Starter Christine357

    (@christine357)

    My excerpts are hand-written, yes, in that I make the excerpt in the optional box when I create the post. The excerpt shows up but no […] or anything. The code in my functions.php is:

    function change_excerpt_more()
    {
      function new_excerpt_more($more)
        {
        // Use .read-more to style the link
          return '<span class="continue-reading"> <a href="' . get_permalink() . '">Continue Reading &raquo;</a></span>';
        }
      add_filter('excerpt_more', 'new_excerpt_more');
    }
    add_action('after_setup_theme', 'change_excerpt_more');

    Nothing about it was changed.

    The output of the site is as it sounds: no […] or “Continue reading” or anything to link to the full post asides from the title of it.

    My excerpts are hand-written, yes, in that I make the excerpt in the optional box when I create the post.

    then WordPress will not show [...] or a link at the end.

    consider to program that hard-coded into the template.

    Thread Starter Christine357

    (@christine357)

    Well that is silly. But cool, I removed the hand-written excerpt and the “Continue reading” link appeared, thank you again!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Excerpt not showing […]’ is closed to new replies.