-
AuthorPosts
-
September 20, 2021 at 3:09 pm #1321646
Hi,
I would like to display the categorry-titles of each post below the titles and above the extract in de blog grid items.
How can I accomplish that? On blog page as well as on archive/category pages
I am using child theme
see links in private content
September 22, 2021 at 10:26 am #1321872Hey Alexander,
Thank you for the inquiry.
Try adding this filter in the functions.php file to render the category title above the excerpt and below the title.
add_filter("avf_post_slider_entry_excerpt", function($excerpt, $prepare_excerpt, $permalink, $entry) { if(is_archive()) { $excerpt = '<span class="slide-archive-title"></span>' . get_the_archive_title() . '</span>' . $excerpt; } return $excerpt; }, 10, 4);
Best regards,
IsmaelSeptember 22, 2021 at 1:25 pm #1321912Hi Ismael,
I added your code but nothing happens.
What else can we try?
Regards, Alexander
September 24, 2021 at 6:31 am #1322114Hi,
Thank you for the update.
Do you see any errors after adding the code? Please post the login details in the private field so that we can check the modifications. Make sure that the Appearance > Editor panel is accessible so that we can edit the files directly from the dashboard.
Best regards,
IsmaelSeptember 24, 2021 at 9:02 am #1322163Hi Ismael,
I provided a temporary login for you, see private content
September 24, 2021 at 11:31 am #1322181Hi,
Thank you for the info.
The filter is working as it should. It displays the category title between the excerpt and the post title. Please check the category page below. (see private field)
Best regards,
IsmaelSeptember 24, 2021 at 11:49 am #1322185Hi Ismael,
I am not using the category pages. I am trying to show it on pages with blog element. see example links in private.
Best regards, Alexander
September 24, 2021 at 12:32 pm #1322198Hi,
Thank you for the clarification.
We adjusted the filter in the functions.php file a bit and used the get_the_term_list function. You will now see a list of categories below the title. (see private field)
/*add category titles*/ add_filter("avf_post_slider_entry_excerpt", function($excerpt, $prepare_excerpt, $permalink, $entry) { $excerpt = get_the_term_list($entry->ID, "category", '', ', ') . "<br>" . $excerpt; return $excerpt; }, 10, 4);
Best regards,
IsmaelSeptember 24, 2021 at 3:56 pm #1322220Hi Ismael,
Thanks for that, it worked.
Is it possible to make my category pages look like the (manually constructed) example in private section.
With a header image, the categories displayed in a button row, and active category highlighted?Regards, Alexander
September 27, 2021 at 5:25 am #1322408Hi,
No problem. Unfortunately, you cannot use the advance layout builder (ALB) to adjust the layout of the archive pages. You will have to manually edit the archives.php template for that. Another solution is to create a custom category page using the ALB, then do a 301 redirect to display the custom page instead of the default archive page. The following plugin should help.
// https://wordpress.org/plugins/eps-301-redirects/
If you have any additional questions at this time we kindly ask that you open them up in a separate thread. The longer threads get in the forum, they become more difficult to support as they tend to drift off topic and they also make it troublesome for users trying to search for solutions. Keeping threads relevant to their original inquiry ensures that we can keep better track of what has been resolved and that users can more effectively find answers to similar issues they might be experiencing.
Thanks!
Best regards,
IsmaelSeptember 29, 2021 at 10:34 am #1322775Hi Ismael,
Thanks, works like a charm :-)
-
AuthorPosts
- The topic ‘show categories in blog grid’ is closed to new replies.