Support » Fixing WordPress » How To Remove Excerpt from Category Posts and Home Page

  • Mohsin

    (@mohsin786)


    I want to remove the post excerpt from category post lists as well as from home page post lists. I just want to show the post title and featured image. That’s it.

    (P.S.: I want to remove it completely so CSS code will not work for me)

    How can I do that?

    Thanks in Advance

Viewing 10 replies - 1 through 10 (of 10 total)
  • catacaustic

    (@catacaustic)

    To remove it completely, you need to modify the themes templates to take away that content. Of course, you should do that in a child theme to make sure that the changes are kept after any future updates.

    As for which templates, that’s impossible to say at this point as we don’t know what theme you’re using, but you should be able to find out by looking at the template files, and if not you can ask in the support forum of your chosn theme.

    Mohsin

    (@mohsin786)

    I am using University Hub theme. I already created a query in theme support but i did not getting any response from them. That’s y i need to create a request here.

    Please share a code if you have

    Hi @mohsin786 ,

    Have you tried adding this to your child theme’s functions.php?

    
    function mytheme_custom_excerpt_length( $length ) {
        return 0;
    }
    add_filter( 'excerpt_length', 'mytheme_custom_excerpt_length', 999 );
    
    

    https://developer.wordpress.org/reference/hooks/excerpt_length/

    Mohsin

    (@mohsin786)

    Above code is not working

    Hi @mohsin786 ,

    Good to know. Please consult your theme’s documentation, support, and forum as @catacaustic recommended earlier, if you haven’t yet.

    Good luck!

    Mohsin

    (@mohsin786)

    ok thanks @mlchaves

    Mohsin

    (@mohsin786)

    Hello @mlchaves I tried your code in new theme and it works but it is showing “…” Three dots so how could I remove this?

    Waiting for your reply

    Hi @mohsin786 ,

    Please try adding this to your child theme’s functions.php.

    
    /**
     * Remove the excerpt more string
     */
     function my_theme_excerpt_more( $more ) {
         return '';
     }
     add_filter( 'excerpt_more', 'my_theme_excerpt_more' );
    

    Reference https://developer.wordpress.org/reference/hooks/excerpt_more/

    Thanks!

    Hi @mohsin786 ,

    Sorry, I just realised that your theme is probably using CSS for the three dots (ellipses).

    Right click on those three dots and inspect the element. You might see something like this (guessing since we don’t have your link).

    
    .your-theme-read-more::after {
        content: '\f105';
        top: 50%;
        right: -10px;
        padding-left: 5px;
        font-size: 14px;
        font-family: icomoon;
        position: absolute;
        -webkit-transform: translateY(-50%);
        -ms-transform: translateY(-50%);
        transform: translateY(-50%);
    }
    

    If you see something like the code above, change content to none.

    
    .your-theme-read-more::after {
        content: none; /* Use !important if needed. */
        top: 50%;
        right: -10px;
        padding-left: 5px;
        font-size: 14px;
        font-family: icomoon;
        position: absolute;
        -webkit-transform: translateY(-50%);
        -ms-transform: translateY(-50%);
        transform: translateY(-50%);
    }
    
    

    How to add custom CSS to WordPress.

    https://medium.com/p/adding-custom-css-to-your-wordpress-website-how-to-guide-a50b474af36d

    • This reply was modified 4 months ago by mark l chaves. Reason: CSS syntax
    Mohsin

    (@mohsin786)

    Thank you very much @mlchaves It works perfect

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