Support » Fixing WordPress » Removing “Read More” and adjusting Excerpt Length

  • palmdream

    (@palmdream)


    Hello,

    I’ve looked online and through the forums and have tried a few things to remove the “Read More” links and to adjust the excerpt length but so far none have worked,

    can anyone shed some light on how to do this?

    Specifically its for the “Sales” “New Developments” & “Holiday Lets” section on the home page.

    Thanks in advance,

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

Viewing 6 replies - 1 through 6 (of 6 total)
  • jnr4u2

    (@jnr4u2)

    Hi @palmdream, You can use this plugin for the excerpt issue. For the Read more issue, You can try adding the following code to your Admin Panel > Appearance > Customize > Additional CSS field:

    p.more-link {
      display: none !important;
    }

    Let me know the outcome 🙂

    Storm Rockwell

    (@stormrockwell)

    To truly remove the read more buttons add this to your child theme to overwrite the one in the main theme real-estate-lite-child/sections/service.php

    <?php
    $title = esc_html( get_theme_mod('service_title'));
    $subtitle = esc_html( get_theme_mod('service_sub_title'));
    $first = esc_html( get_theme_mod('first_service'));
    $second = esc_html( get_theme_mod('second_service'));
    $third = esc_html( get_theme_mod('third_service'));
    ?>
    <div class="section service grey">
            <div class="grid">
            <h2 class="section-title"> <?php echo esc_html( $title) ; ?></h2>
            <?php if(!empty($subtitle)) : ?>
            <h5 class="section-sub-title"> <?php echo esc_html( $subtitle) ; ?></h5>
            <?php endif; ?>
                    <?php 
           
                    // The Query
                    $args = array(
                            'post_type' => 'page',
                            'post__in' => array($first,$second,$third),
                            'orderby' => 'post__in',
                            );
                    $feature = new WP_Query( $args );
            // The Loop
                    if ( $feature->have_posts() ) {
                           
                                    while ( $feature->have_posts() ) {
                                            ?><div class="col-4-12"><?php
                                            $feature->the_post();
            if ( has_post_thumbnail() ) { ?>
                    <div class='post-thumb'>
                                    <a href="<?php the_permalink();?>" >
                                    <?php the_post_thumbnail('real_estate_lite_page_thumb'); ?>
                                    </a>
                    </div>
                    <?php } ?>
                    <?php the_title('<h2 class="entry-title">', '</h2>'); ?>
                    <?php  the_excerpt(); ?>
                                   
     
              <?php 
              echo "</div>";
              } } else { ?>
            <p><?php echo esc_attr( 'Sorry, no posts matched your criteria.' ); ?></p>
            <?php } 
                   
                    /* Restore original Post Data */
                    wp_reset_postdata();
                    ?>
                   
            </div>
            </div>

    An easier way but a bit less clean is to hide the links in the service section like so

    .service .read_more {
      display: none;
    }
    Storm Rockwell

    (@stormrockwell)

    To change the excerpt length add this to your child themes functions file and change the number 20 to the length you would like

    function wp11539068_excerpt_length( $length ) {
    	return 20;
    }
    add_filter( 'excerpt_length', 'wp11539068_excerpt_length', 999 );

    https://codex.wordpress.org/Plugin_API/Filter_Reference/excerpt_length

    palmdream

    (@palmdream)

    Hey,

    Both of your solutions have worked

    thanks so much!

    jnr4u2

    (@jnr4u2)

    Hiya @palmdream,

    Glad I could help 🙂

    CrouchingBruin

    (@crouchingbruin)

    @palmdream, can you please mark this as Resolved so the rest of us know it’s been fixed? Thanks.

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.