• Resolved jo3ytjuh

    (@jo3ytjuh)


    Hi there,

    I want to make the whole text clickable, not only the title.
    Is that possible ?
    Or can i add the “Read More” button to it ?

    Its important for me cause the public on my site is slightly older, and doesnt understand they only can click on the title. The best option will be the read more, better will be both options, else make the text clickable.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Eric Amundson

    (@sewmyheadon)

    Howdy @jo3ytjuh,

    There are a few ways you could potentially go about this:

    1. Add a Read More button. Currently, if you’re showing excerpts on an archive page and you have a post that is longer than the excerpt, you may see something like Read More or Continue Reading, depending on your theme and plugins.

    Posts in Page has an argument you can use to change the Read More link to read something specific like so:

    * [ic_add_posts more_tag='Read more'] – Set the link text for read more links shown after an excerpt.

    That’s just going to add the link but you could use CSS to style it to look like a button.

    2. Another slightly-more-complicated version of this would be to copy the posts_loop_template.php file from your theme directory and put it in your theme. Then, you could open it up and customize it.

    Here’s what that file looks like by default:

    <?php
    /**
     * @package     Posts_in_Page
     * @author      Eric Amundson <[email protected]>
     * @copyright   Copyright (c) 2018, IvyCat, Inc.
     * @link        https://ivycat.com
     * @since       1.0.0
     * @license     GPL-2.0+
     */
    ?>
    
    <!-- NOTE: If you need to make changes to this file, copy it to your current theme's main
    	directory so your changes won't be overwritten when the plugin is upgraded. -->
    
    <!-- Post Wrap Start-->
    <div class="post hentry ivycat-post">
    
        <!-- 	This outputs the post TITLE -->
        <h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
    
        <!-- 	This outputs the post EXCERPT.  To display full content including images and html,
    		replace the_excerpt(); with the_content();  below. -->
        <div class="entry-summary">
    		<?php the_excerpt(); ?>
        </div>
    
        <!--	This outputs the post META information -->
        <div class="entry-utility">
    		<?php if ( count( get_the_category() ) ) : ?>
                <span class="cat-links">
    				<?php printf( __( '<span class="%1$s">Posted in</span> %2$s', 'posts-in-page' ), 'entry-utility-prep entry-utility-prep-cat-links', get_the_category_list( ', ' ) ); ?>
    			</span>
                <span class="meta-sep">|</span>
    		<?php endif; ?>
    		<?php
    		$tags_list = get_the_tag_list( '', ', ' );
    		if ( $tags_list ): ?>
                <span class="tag-links">
    				<?php printf( __( '<span class="%1$s">Tagged</span> %2$s', 'posts-in-page' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list ); ?>
    			</span>
                <span class="meta-sep">|</span>
    		<?php endif; ?>
            <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'posts-in-page' ), __( '1 Comment', 'posts-in-page' ), __( '% Comments', 'posts-in-page' ) ); ?></span>
    		<?php edit_post_link( __( 'Edit', 'posts-in-page' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
        </div>
    </div>
    <!-- // Post Wrap End -->
    

    You could add a line underneath the entry-summary section like so:

    <a class="button button-primary button-large" href="<?php the_permalink(); ?>">Read More</a>

    That will create a Read More link for each post and will use your theme’s button classes to add an actual button to the theme.

    3. Finally, if your site is html 5 (I believe it is), you can wrap the post in a link to make the whole shebang clickable – something like this:

    <div class="post hentry ivycat-post">
        <a href="<?php the_permalink(); ?>">
    
            <!-- 	This outputs the post TITLE -->
            <h2 class="entry-title"><?php the_title(); ?></h2>
    
            <!-- 	This outputs the post EXCERPT.  To display full content including images and html,
    			replace the_excerpt(); with the_content();  below. -->
            <div class="entry-summary">
    			<?php the_excerpt(); ?>
            </div>
    
        </a>

    Does that help?

    Thread Starter jo3ytjuh

    (@jo3ytjuh)

    Hi there Eric,

    There is no Read More on my excerpts at all..
    So i cant change it with this options cause its not there.. !

    And About step 3. where do i put that ?!
    Option 3 would be lovely !

    • This reply was modified 6 years, 1 month ago by jo3ytjuh.
    • This reply was modified 6 years, 1 month ago by jo3ytjuh.
    Plugin Author Eric Amundson

    (@sewmyheadon)

    Hi @jo3ytjuh,

    There is no Read More on my excerpts at all..

    If #1 doesn’t work for you, #2 should.

    #2 – I gave you the code to add to your posts_loop_template.php file:

    You could add a line underneath the entry-summary section like so:

    <a class="button button-primary button-large" href="<?php the_permalink(); ?>">Read More</a>

    That will create a Read More link for each post and will use your theme’s button classes to add an actual button to the theme.

    And About step 3. where do i put that ?!

    In my last response, I showed a code example with exactly where you could put it:

    3. Finally, if your site is html 5 (I believe it is), you can wrap the post in a link to make the whole shebang clickable – something like this:

    <div class="post hentry ivycat-post">
        <a href="<?php the_permalink(); ?>">
    
            <!-- 	This outputs the post TITLE -->
            <h2 class="entry-title"><?php the_title(); ?></h2>
    
            <!-- 	This outputs the post EXCERPT.  To display full content including images and html,
    			replace the_excerpt(); with the_content();  below. -->
            <div class="entry-summary">
    			<?php the_excerpt(); ?>
            </div>
    
        </a>

    Does that make sense?

    Thread Starter jo3ytjuh

    (@jo3ytjuh)

    Oke ! Thanks i will try it again ;P

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Excerpts or text clickable’ is closed to new replies.