Hi @didelu,
That is easy. Please do the following here to change the page excerpt length.
https://developer.ww.wp.xz.cn/reference/functions/the_excerpt/#comment-325
Let me know!
Thread Starter
didelu
(@didelu)
Thanks, that worked perfectly!
For some reason adding ‘read more’ text that was on the same info page did not work. Can you help me to add that too?
Did you check with another theme? If the ‘read more’ tag does not work, please consider using the next page tag:
https://en.support.wordpress.com/nextpage/
Thread Starter
didelu
(@didelu)
I tried using next page tag, but it also splits my post to two pages which is not optimal. I would not want to change my theme because I have made quite a bit of changes and I don’t want to lose them.
For some reason Onepress theme seems to hide “read more” tag, because when i filter the “the_excerpt()” with a plug in the tag appears. Problem is, these plug ins also change my font size.
Hi @didelu,
I think there is an easy way. You need to open this file in your theme:
template-parts/content-list.php
Or copy it to the child theme.
Then you can add the read more link there.
Let me know!
Thread Starter
didelu
(@didelu)
Hi and thank you for your answer!
I opened content-list.php file via FTP and added following text before </article> (last part of the file).
/**
* Filter the excerpt “read more” string.
*
* @param string $more “Read more” excerpt string.
* @return string (Maybe) modified “read more” excerpt string.
*/
function wpdocs_excerpt_more( $more ) {
return ‘[…..]’;
}
add_filter( ‘excerpt_more’, ‘wpdocs_excerpt_more’ );
I did not notice any changes in the page. Maybe I am doing something wrong?
Hi @didelu,
Yes. That is wrong. And it seems you don’t understand about WP coding.
In the codex, they said this code is added in the main functions.php, not to add in other files.
As my recommend, you should add this to content-list.php, after number line 70:
<a href="<?php the_permalink() ?>"> Read More </a>
-
This reply was modified 7 years, 6 months ago by
FameThemes.
Thread Starter
didelu
(@didelu)
It’s true I don’t understand about WP coding (or any other coding).
I tried to add that code first to main functions.php, but it did not have an effect there either. Unfortunately that a href did not work either in content-list.php.
I think I will leave it be as it is now.
Thanks for the help anyway.