Showing full post content
-
Hello,
I am unable to show just excerpt and read more, I always have full content displayed.
Is there a way to change this?
thank you.
-
To show the full content just set a huge number in the Post details panel > Excerpt length (in words): 999
Sorry I misunderstood, you don’t want to show the full content? So try set a tiny number in the Post details panel > Excerpt length (in words): e.g. 2 or 5
Yes, I want an excerpt, say 10 words.
I already tried to set it to 5 now I tried 2, but I got full content.
Can you advice where in code I can override this?
I would hate to break things, otherwise seems to work ok?
Thank you in advance.Do you use a free Theme? If yes, can you write use the name and a downloadlink where I can find it?
It’s depend on a setted filter in your used Theme. You can try and change your Theme, e.g. Twenty Sixteen or Twenty Fiveteen if the excerpt is shows right.
You can try to add this lines of code to the end of you Theme functions.php:
[your-WordPress-installation]/wp-content/themes/[your-used-theme]/functions.php
/** =============== * Adjust excerpt length */ function custom_excerpt_length( $length ) { return 5; } add_filter( 'excerpt_length', 'custom_excerpt_length', 9999 );-
This reply was modified 9 years, 5 months ago by
Daniel Floeter.
Sorry, I was away.
But I need to cut excerpt only in the widget?
Is that possible?
I expected that setting should do that?The widget do it, but this widget filter settings were overriden by the Theme’s functions.php.
For a test you can change your Theme and use a default WordPress Theme, e.g. Twenty Sixteen or Twenty Fiveteen. There you can set the excerpt length by the widget settings, because the Twenty Sixteen Theme’s function.php don’t set and overrides our filter.
So if you want to overrides the Theme filter again you can use the priority 9999 as mentioned above.
If you use this overriding only for our widget, you can do this in the widget code and remove it after use.I already tried to put excerpt function in the widget, but it is not working – or I am still missing something.
Changing theme is not an option, so I will need to figure it out somehow.Ok, set the excerpt filter makes also for us headache π
You can try to add the priority 9999 as parameter to the filter ‘excerpt_length’ in line 752:add_filter(‘excerpt_length’, array($this,’excerpt_length_filter’), 9999);
cat-posts.php, line 752
function setExcerpFilters($instance) { if (isset($instance['excerpt']) && $instance['excerpt']) { // Excerpt length filter if ( isset($instance["excerpt_length"]) && ((int) $instance["excerpt_length"]) > 0 ) { add_filter('excerpt_length', array($this,'excerpt_length_filter'), 9999); }-
This reply was modified 9 years, 5 months ago by
Daniel Floeter.
Yup, seems to work, thank you.
-
This reply was modified 9 years, 5 months ago by
dakiriki.
-
This reply was modified 9 years, 5 months ago by
The topic ‘Showing full post content’ is closed to new replies.