• Resolved lessthandan

    (@lessthandan)


    I edited my wordpress theme so on the front page, you only see the article summary and you have to click the title to view the entire post.

    <div class="postcontent">
            <?php the_excerpt('Read the rest of this entry &raquo;'); ?>
    
          </div>

    Basically I replaced “the_content” with “the_excerpt”.

    Now, although there is the option to simply click the title to view the post, I also want a “Read More” button as well. The problem with this is that the Read More feature applies only to posts that have the breaks manually inserted in them during editing. The code above shows a “Read the rest of this entry” feature, but it never shows up if you’re only using excerpts.

    I need a universal button that simply links to the post itself. You might say that the post links to itself at the bottom. However, it can only show this link on the front page where it only shows the summaries (and the archives, for that matter).

    I hope this makes sense. Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • maybe this will help

    function the_excerpt_more($text) {
    $url = get_permalink();
    $text = str_replace(“[…]”, “Read More“, $text);
    return $text;
    }
    add_filter(‘the_excerpt’, ‘the_excerpt_more’);

    put it in your function.php

    Thread Starter lessthandan

    (@lessthandan)

    Sorry, I guess I should probably add that I’m not an experienced coder, and it’s been a long time since I’ve used wordpress.

    uwiuw, I put that in my functions.php, and it didn’t appear to do anything. What exactly is it supposed to do? Maybe you can be more specific as to where to put it?

    My functions.php looks like this:

    <?php
    
    // Widget Settings
    
    if ( function_exists('register_sidebar') )
    	register_sidebar(array(
    		'name' => 'Sidebar_top',
    		'before_widget' => '',
    		'after_widget' => '',
    		'before_title' => '<h2>',
    		'after_title' => '</h2>',
    	));
    
    //GsL98DGtpo0W
    
    if ( function_exists('register_sidebar') )
    	register_sidebar(array(
    		'name' => 'Sidebar_left',
    		'before_widget' => '',
    		'after_widget' => '',
    		'before_title' => '<h2>',
    		'after_title' => '</h2>',
    	));
    
    if ( function_exists('register_sidebar') )
    	register_sidebar(array(
    		'name' => 'Sidebar_right',
    		'before_widget' => '',
    		'after_widget' => '',
    		'before_title' => '<h2>',
    		'after_title' => '</h2>',
    	));
    
    ?>

    sorry, it seem my code have been eaten. and make as if it a link. Put it anywhere in function.php

    This is the right one :

    function the_excerpt_more($text) {
    	$myurl = get_permalink();
    	$text = str_replace('[...]' , '<a href=" ' . $myurl . ' "> ' . ' Read More </a>', $text);
    	return $text;
    }
    add_filter('the_excerpt', 'the_excerpt_more');
    Thread Starter lessthandan

    (@lessthandan)

    Ok, I figured it out on my own. After messing around a tiny bit I realized that I could do this just below the “post_excerpt” thingy on the front page.

    <a title="Read <?php the_title(); ?>" href="<?php the_permalink() ?>" rel="bookmark">
              Full Story &raquo;
              </a>

    Thanks anyway, uwiuw.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Displaying excerpt/summary only, AND a “read more” button’ is closed to new replies.