Limiting the Text Preview

Posted in: Newspaper
Post count: 263

In Theme Panel, if im not mistaken ‘Excerpt Length’ is the amount of text shown in the preview of the post. I have it set to 14 (http://screencast.com/t/EPLVL5YsWK2r) but it still seems to display over 14 words (http://screencast.com/t/bi2Hma5Qz4BE) – any suggestions?

Post count: 9544

I usually over-ride this in the functions.php file as best way.
http://codex.wordpress.org/Function_Reference/the_excerpt

Don’t forget WordPress has awesome documentation on a lot of this kind of thing.

To wit:
Control Excerpt Length using Filters

By default, excerpt length is set to 55 words. To change excerpt length to 20 words using excerpt_length filter, add the following code to functions.php file in your theme:

function custom_excerpt_length( $length ) {
	return 20;
}
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
Post count: 263

Currently the area in functions.php looks like:

/*  ----------------------------------------------------------------------------
    excerpt lenght
 */

add_filter('excerpt_length', 'my_excerpt_length');
function my_excerpt_length($length) {

    // on feed show full content if it's set in wordpress
    if (is_feed() and get_option('rss_use_excerpt') == 0) {
        return 999999;
    }
    $excerpt_length = td_util::get_option('tds_wp_default_excerpt');
    if (!empty($excerpt_length) and is_numeric($excerpt_length)) {
        return $excerpt_length;
    } else {
        return 20; //default
    }
}

I adjusted the ‘return’ but that still doesn’t work. Where do I add your adjustment?

Post count: 6600

Hi,

Thanks Christopher!

@sbo

Thanks for reporting this, I have tested this and seems it’s not working, we will look at this and added it on our issue list try to fix it as soon as possible, until we fix this you can set the excerpt on modules, I have tested it and work fine.

Sorry about this!
Thanks for the message!

Post count: 263

@Lucian, no problem. Hope to see a fix soon. If you can post it in here instead of the next update that would be awesome because I have been having update problems so Im sticking on 4.0.2.

Post count: 6600

Hi,

After a closer look I have noticed that the WordPress default option from theme panel is used only for feed excerpt and for plugins that use the WordPress excerpt length, that is why it dose not work on modules, as I mentioned before you can change the excerpt an any module using the theme panel for each module so this way you will be changing all the excerpts on your site.
We will change this and we will point out that the WordPress default option is for feed.

Sorry for the inconvenience and thanks for the message!

Post count: 263

Even if I change the Excerpt in the Theme Panel it still shows more than I want. Will there be a fix for this any time soon? @Lucian

Post count: 6600

Hi,

I have tested the excerpt on each module using the latest theme version (4.2.2) and works fine. Make sure you do this right following this guide: https://forum.tagdiv.com/how-to-change-the-excerpt-length/
You can add the excerpt that you want for each post using the excerpt filed from post editing panel: http://screencast.com/t/9vpdduYY

Thanks

Post count: 263

Hey, so how do I go about just hiding the full subtext in the following:

Block 6
Block 2
Module 7

I’m sure its the same code for all of them, but if not just wanted to let you know in advance. I also tried the excerpt and that doesnt limit it to zero like I want.

Post count: 263

Okay so I did the following:

.td-post-text-excerpt {
display: none;
}

Seems to work on the blocks but not modules.

I tried

.post p {
display: none;
}

Which worked but it also hid the main post content so that was a no go.

  • This reply was modified 11 years by sbo.
Post count: 6600

Hi,

Please use this custom css to hide the excerpt on block 2/6:

.td_block6 .td-post-text-excerpt, .td_block2 .td-post-text-excerpt{
display: none;
}

For module 7 you don’t have a class that you can use to hide the excerpt so you can edit the module 1 file and add this class: http://screencast.com/t/MuGmEcxOAzpg then use it to hide the excerpt like this: http://screencast.com/t/MuGmEcxOAzpg

.module_7_excerpt {
display: none;
}

Thanks

Post count: 263

The module 7 doesn’t seem to work.

Post count: 6600

Hi,

I have tested this before and should work fine. Make sure you do as I suggested, add the class and use the css. If you still can’t manage to do it please provide more details and also provide your site’s URL with an module 7 set so I can inspect this.

Thanks

Post count: 263

Got it! Thanks!

Viewing 14 posts - 1 through 14 (of 14 total)
You must be logged in to reply to this topic.