Edit Blog Category Page
-
Hi,
when I’m on the blog page and I’m switching to a certain category, the lay out of the individual blog message is lost.
Is there a way to keep it.E.g. This is a blog message: https://www.ingridverhelst.be/2019/09/25/vrouw-zonder-hoed/
[text has a specific lay-out]
This is the same but in the abbreviated category list view: https://www.ingridverhelst.be/category/schrijven-en-ik/
[the lay out is gone]Thanks in advance,
MarcThe page I need help with: [log in to see the link]
-
Hello @bodtje!
Try to Insert your formatted text into the “Excerpt” text field on the right side of your post (Edit post, then copy your text from the main area to the “Excerpt” text field on the right.).
https://prnt.sc/pcz7l1
https://prnt.sc/pcz90nRegards
Hi,
Thank you very much for your quick answer but I don’t have an Excerpt text field on the right side.
kind regards
Hi,@bodtje!
Yes, you must have it 🙂
If you do not see it, just enable the settings dialog by clicking the settings button located in the very top right corner.
https://prnt.sc/pd1lpc
https://prnt.sc/pd1m6pRegards
Yes indeed,
I found it and it works. Now just one little thing. The “Read more” (“Lees verder”) link is gone. How can I put it back in there?
Thank you so much for your patience and helpful hints.
😉
MarcHello, Marc!
1.Install and activate “My Custom Functions” plugin.
https://prnt.sc/pda4u32.From your WordPress dashboard, navigate to Settings->PHP inserter, and place the following custom PHP code in the code editor field:
function custom_excerpt($text) { // custom 'read more' link if (strpos($text, '[...]')) { $excerpt = strip_tags(str_replace('[...]', '... <a href="'.get_permalink().'">Read More...</a>', $text), "<a>"); } else { $excerpt = '<p>' . $text . '<a href="'.get_permalink().'">Read More...</a></p>'; } return $excerpt; } add_filter('the_excerpt', 'custom_excerpt');
3. Switch the toggle to the “ON” position.
4. Click the “Save changes” button.
5. Refresh your Blog Page…
Now you should have the “Read More” link.
https://prnt.sc/pdaasxRegards
Great!
Thank you so much.
is it possible to have the same lay out + “Lees verder” on the Blog summary page (https://www.ingridverhelst.be/blog/)? Because I don’t see the Excerpts text field (Samenvattingen) possibility in the Screen options…Once again thanks for your continuous support. You are so helpful.
😉
MarcHi,@bodtje
From what I see you have created a blog summary page using the “Gold Addons For Elementor” plugin.
While this is a great plugin, it has some limitations as well.
If you want to display formatted text, there is an option in the GA Blog widget to display “Full Content” instead of an excerpt.
https://prnt.sc/pdb9eh
In this case, your text remains formatted. (But unfortunately without the Read more … link)Regards
Thanks, worked fine for me, I just want to add, that you have to switch off “Read More”-links in the customizer, otherwise it is doubled on posts without a manual exerpt.
To have them styled as usual (in the agama style!), don’t forget to add the class to the html-element:
function custom_excerpt($text) { // custom 'read more' link if (strpos($text, '[...]')) { $excerpt = strip_tags(str_replace('[...]', '... <a class="more-link" href="'.get_permalink().'">Read More...</a>', $text), "<a>"); } else { $excerpt = '<p>' . $text . '<a class="more-link" href="'.get_permalink().'">Read More...</a></p>'; } return $excerpt; } add_filter('the_excerpt', 'custom_excerpt');
-
This reply was modified 1 year, 6 months ago by
dorsch.
Hi dorsch,
was there an error in your first post of the code? My website went into problems (but it’s fixed now) and send me a warning.
Can I safely use this last one now?
Cheers and thanks for the useful added tips.
😉
MarcCan someone please confirm that the above codes are correct.
HTML validators return errors and when I’m applying this to my site, it becomes inaccessible.Thanks.
Cheers,
MarcHi @bodtje!
On code added by @dorsch
Part of the code is missing. So you get the error.This is the correct code:
function custom_excerpt($text) { // custom 'read more' link if (strpos($text, '[...]')) { $excerpt = strip_tags(str_replace('[...]', '... <a class="more-link" href="'.get_permalink().'">Read More...</a>', $text), "<a>"); } else { $excerpt = '<p>' . $text . '<a class="more-link" href="'.get_permalink().'">Read More...</a></p>'; } return $excerpt; } add_filter('the_excerpt', 'custom_excerpt');
Please follow the next steps to fix the plugin error:
= Q. What to do if this plugin crashed the website? =
A. This plugin has a built-in function for checking the custom code for syntax errors, duplicate functions names, and etc. But the plugin is not perfect, so there are times when the entered custom code causes the error and white screen (WSOD). This is due to the fact that your custom code has a syntax error that this plugin could not detect. When this happens with you, please perform the following steps.1. Access your server via FTP or SFTP. If you aren’t sure how usually your web hosting provider will have instructions somewhere on their website.
2. Browse to the directorywp-content/plugins/my-custom-functions/
. Please contact your web hosting company to get help if you can’t find this folder.
3. Rename the fileSTART
toSTOP
. This will stop the execution of your custom code.
4. Log in to the Admin Area of your WordPress website.
5. Go to the plugin settings pageSettings
->PHP Inserter
.
6. Edit/fix your custom PHP code that you entered before the crash.
7. Return to the plugin folder and rename the fileSTOP
toSTART
and you’re done!PS. As the @dorsch correctly mentioned, you have to switch off “Read More”-links in the customizer, otherwise it is doubled on posts without a manual excerpt. (Customizing ▸ Blog ▸ General)
Regards
-
This reply was modified 1 year, 6 months ago by
themevision.
-
This reply was modified 1 year, 6 months ago by
- The topic ‘Edit Blog Category Page’ is closed to new replies.