Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1293758

    I would need a customization of the archive pages for the category News and for the category Shops as custom archive.php or category.php files.
    The archive page for News (rendered in archive PHP) should look the blog post page which I have created using the blog post element of the Advanced Layout Builder (ALB). The reason why I cannot use the ALB to customize the blogs is that when I want do filter blog posts by category, e.g. by category “Tipps”, the theme displays the default style using archive.php), which looks different than the ALB build style.
    The difference between the default style and my custom News style is that the thumbnails in the default style are cropped (which hides the logo and banner at the bottom of each thumbnail) and there is no “Weiterlesen” (= continue reading link).
    I would like the style for News to be:

    • Large thumbnails (not cropped)
    • “Weiterlesen” link and
    • if possible that the excerpt is limited to a maximum of lines or words to have a cleaner look.

    I found some code samples on how to limit the excerpt in the Enfold support forum but none worked for me so far.

    Then for the category “Shops” (which has subcategories like “Fashion” etc.) the archive page styling should be very similar:

    • Thumbnail (large, not cropped)
    • sorted alphabetically (ascending) by the name of the shop (=blog post title)
    • hide meta info (number of comments and publication date) for Shops.

    The Shop category pages consist of a table (which is defined in the category as description) and the Shop blog posts of this category at the bottom. If you have a better idea on how to arrange the elements Table vs Shop blog posts please let me know (maybe they can be put on different tabs -> how would I do that without the ALB in PHP?).
    I tried the following CSS code to hide the meta info: .slide-meta { display: none !important; }which works but hides the meta info an all archive pages. I just want to hide the meta info on the Shop category pages.
    In the child theme folder there are two inactive category.php files for the Shops category and one already customized archive.php. Please let me know if you have questions regarding the files.

    Thank you very much for your help and support!

    • This topic was modified 3 years, 7 months ago by AlexR.
    #1294247

    Hey AlexR,

    Thank you for the inquiry.

    Have you tried doing a page redirect to transfer the user from the actual category page to a custom one? You can use either of the following plugins to automatically redirect a URL to another.

    // https://wordpress.org/plugins/eps-301-redirects/
    // https://wordpress.org/plugins/redirection/

    The more difficult solution is to modify the archive.php file manually.

    To enable the read more link for the category pages, you can add this filter in the functions.php file.

    function ava_change_blog_archive_style() {	
    	global $avia_config;
    	if(!is_single()){ $avia_config['blog_content'] = "excerpt_read_more"; }
    }
    add_action('get_header', 'ava_change_blog_archive_style');
    

    Best regards,
    Ismael

    #1294331

    Hi Ismael,
    I was not aware that it is necessary to have page redirects for each category to ALB pages with blog elements. Could you please confirm that this would be best practice and that I would need to setup a redirects for each category? Btw: I am using RankMath for page redirects but have currently switched off redirects for category pages.
    My current setup looks like this:

    • For “News”, I have a ALB page with an blog element.
    • For “Tipps” (which is a category of “News“) I use standard archive pages.

    I would prefer to use standard archive pages for “News” as well.
    How could I implement that? I searched for hours but was not able to find the (obvious) solution.

    I have added your code snippet to functions.php but unfortunately “Read More” links are still not shown for the “Tipps” category. What did I do wrong?

    #1294562

    Hi,

    Thank you for the update.

    Page redirect is not necessary but since you wanted the category page to look similar to a page created using the advance layout builder, then a page redirect should help, otherwise, you will have to manually modify the archive.php file and add the builder elements manually.

    In order to copy a builder element and add it in a template, you will have to extract the shortcode directly from the advance layout builder. To do that, you have to set the builder to debug mode and once set, a textarea or field will display under the builder. This textarea contains the builder shortcode, which can be copied and can be added manually in a template such as the archive.php file.

    To enable the debug mode, please check the following documentation.

    // https://kriesi.at/documentation/enfold/intro-to-layout-builder/#debug-mode

    You should also add this filter in the functions.php file to properly render the shortcodes in the template.

    function avf_custom_exec_sc_only_mod( $exec_sc_only, $obj_sc, $atts, $content, $shortcodename, $fake ) {
    	return true;
    }
    
    add_filter( 'avf_alb_exec_sc_only', 'avf_custom_exec_sc_only_mod', 10, 6 );
    

    Best regards,
    Ismael

    #1303104

    Hello Ismael
    I have the same question but I was unclear on exactly what to do from your explanation. I have category list showing on the ALB page with the blog element. Clicking on one of the categories displays those blog posts but they don’t match the ALB page with the blog element (no icons, etc.). Without using a redirect how would I get the category pages to look the same. I do have the debug mode on but am not sure what to add where. I use the child theme. Links in private section.
    Thanks

    #1303379

    Hi,


    @s29ers
    : Which blog layout are you currently using? You can find the Blog Layout option in the Enfold > Blog Layout panel. The main blog page and the archive pages should follow this layout.

    The instructions above are only necessary when the blog layout is set to the last option or when you are using the advance layout builder to build the main blog page.

    Best regards,
    Ismael

    #1303458

    Hi Ismael, Yes, that is set to the last option and the blog, is the blog element in an ALB page. How to fix, then? Thanks.

    #1303950

    Hi,

    You can use the avf_blog_style filter to adjust the blog layout of the archive pages. Please check the following link for more info.

    // https://kriesi.at/documentation/enfold/blog-post/#change-archive-categorytag-blog-style

    And these are your other blog layout options aside from the default.

    
    multi-big = 'Multi Author Blog (displays Gravatar of the article author beside the entry and feature images above)
    single-small = 'Single Author, small preview Pic (no author picture is displayed, feature image is small)
    single-big =  __( 'Single Author, big preview Pic (no author picture is displayed, feature image is big)
    blog-grid = __( 'Grid Layout', 'avia_framework' )																				
    bloglist-simple = __( 'List Layout - Simple (Title and meta information only)', 'avia_framework' )										
    bloglist-compact = __( 'List Layout - Compact (Title and icon only)', 'avia_framework' )												
    bloglist-excerpt = __( 'List Layout - Excerpt (Title, meta information and excerpt only)', 'avia_framework' )	
    

    Best regards,
    Ismael

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