-
AuthorPosts
-
February 1, 2024 at 6:24 am #1432665
Hello! I’d like to change the layout of my categories pages so they are grid style and look more similar to my homepage. (https://www.tonyreviewsthings.com).Is there a way to achieve this?
February 1, 2024 at 12:19 pm #1432720Hey TonyTha1AndOnly,
Thank you for the inquiry.
You can add this filter in the functions.php file to adjust the layout of the archive pages.
add_filter('avf_blog_style','avia_change_category_blog_layout', 10, 2); function avia_change_category_blog_layout($layout, $context){ if($context == 'archive') $layout = 'blog-grid'; return $layout; }
Best regards,
IsmaelFebruary 7, 2024 at 5:16 pm #1433510Hi,
is it also possible to change the layout of category archive pages to “masonry”?
Best regards,
VeraFebruary 8, 2024 at 10:01 am #1433628Hi,
is it also possible to change the layout of category archive pages to “masonry”?
@Vera: This option is not available by default but you can modify the archive.php file. Look for this code:$blog = new avia_post_slider($atts); $blog->query_entries();
Replace it with:
$blog = new avia_masonry($atts); $blog->extract_terms(); $blog->query_entries(); $output .= $blog->html();
Then add this code in the functions.php file:
add_filter( 'avia_masonry_entries_query', 'avia_masonry_query_func', 10, 2); function avia_masonry_query_func( $query, $params ) { global $wp_query; $term = $wp_query->get_queried_object(); $tax = $term->taxonomy; $cat = get_query_var('cat'); $catarray = array(); $category = get_category($cat); $catarray[] = $category->term_id; $query['tax_query'] = array( array( 'taxonomy' => $tax, 'field' => 'id', 'terms' => $catarray, 'operator' => 'IN')); return $query; }
Best regards,
IsmaelFebruary 8, 2024 at 11:40 am #1433662Hi Ismael,
thank you for the code but somehow it doesn’t work.
The portfolio page with masonry grid isn’t showing anymore and the archive page doesn’t show masonry.
If you want to take a look I put the login below (the site isn’t yet online).Best regards,
VeraFebruary 8, 2024 at 12:16 pm #1433669Hi,
Thank you for the info.
Please remove the filter in the functions.php file and replace the modification in the archive.php file with the following:
$atts =array ( 'link' => array ( 0 => 'category', ), 'term_rel' => 'IN', 'wc_prod_visible' => '', 'wc_prod_hidden' => 'hide', 'wc_prod_featured' => '', 'prod_order_by' => '', 'prod_order' => '', 'date_filter' => '', 'date_filter_start' => '', 'date_filter_end' => '', 'date_filter_format' => 'yy/mm/dd', 'period_filter_unit_1' => '1', 'period_filter_unit_2' => 'year', 'page_element_filter' => '', 'sort' => 'yes', 'query_orderby' => 'date', 'query_order' => 'DESC', 'caption_elements' => 'title excerpt', 'caption_styling' => '', 'caption_display' => 'always', 'img_copyright' => '', 'size' => 'fixed masonry', 'orientation' => '', 'image_size' => 'masonry', 'gap' => '1px', 'columns' => 'flexible', 'av-desktop-columns' => '', 'av-medium-columns' => '', 'av-small-columns' => '', 'av-mini-columns' => '', 'items' => '12', 'paginate' => 'none', 'color' => '', 'custom_bg' => '', 'img_copyright_font' => '', 'av-desktop-font-img_copyright_font' => '', 'av-medium-font-img_copyright_font' => '', 'av-small-font-img_copyright_font' => '', 'av-mini-font-img_copyright_font' => '', 'img_copyright_color' => '', 'img_copyright_bg' => '', 'animation' => 'active', 'animation_duration' => '', 'animation_custom_bg_color' => '', 'animation_custom_bg_color_multi_list' => '', 'animation_z_index_curtain' => '100', 'overlay_fx' => 'active', 'img_scrset' => '', 'lazy_loading' => 'disabled', 'av-desktop-hide' => '', 'av-medium-hide' => '', 'av-small-hide' => '', 'av-mini-hide' => '', 'alb_description' => '', 'id' => '', 'custom_class' => '', 'template_class' => '', 'element_template' => '', 'one_element_template' => '', 'show_locked_options_fakeArg' => '', 'av_uid' => 'av-3lh7ch', 'sc_version' => '1.0', 'ids' => false, 'action' => false, 'post_type' => array ( 'post' => 'post', 'page' => 'page', 'attachment' => 'attachment', 'revision' => 'revision', 'nav_menu_item' => 'nav_menu_item', 'custom_css' => 'custom_css', 'customize_changeset' => 'customize_changeset', 'oembed_cache' => 'oembed_cache', 'user_request' => 'user_request', 'wp_block' => 'wp_block', 'wp_template' => 'wp_template', 'wp_template_part' => 'wp_template_part', 'wp_global_styles' => 'wp_global_styles', 'wp_navigation' => 'wp_navigation', 'acf-taxonomy' => 'acf-taxonomy', 'acf-post-type' => 'acf-post-type', 'acf-field-group' => 'acf-field-group', 'acf-field' => 'acf-field', 'product' => 'product', 'product_variation' => 'product_variation', 'shop_order' => 'shop_order', 'shop_order_refund' => 'shop_order_refund', 'shop_coupon' => 'shop_coupon', 'shop_order_placehold' => 'shop_order_placehold', 'alb_elements' => 'alb_elements', 'alb_custom_layout' => 'alb_custom_layout', 'rm_content_editor' => 'rm_content_editor', 'portfolio' => 'portfolio', 'avia_framework_post' => 'avia_framework_post', ), 'offset' => 0, 'container_links' => 'active', 'link_dest' => '', 'lightbox_text' => '', 'container_class' => 'av-masonry-entries', 'auto_ratio' => 1.7, 'set_breadcrumb' => true, 'custom_markup' => '', 'taxonomy' => 'category', 'categories' => array ( ), ); $blog = new avia_masonry($atts); $blog->get_element_styles(); $blog->query_entries(); echo '<div class="entry-content-wrapper">' . $blog->html() . '</div>';
Also, you have to make sure that Grid Layout is selected in the Enfold > Blog Layout > Blog Layout settings.
Best regards,
IsmaelFebruary 8, 2024 at 3:09 pm #1433702Hi Ismael,
the masonry of the portfolio pages are back again.
The archive pages still don’t show a masonry grid.
In the new archive code I see twice a line that starts with “$atts =array ( …”.
Maybe this produces a conflict?<?php if( ! defined( 'ABSPATH' ) ) { die(); } global $avia_config, $more; /* * get_header is a basic wordpress function, used to retrieve the header.php file in your theme directory. */ get_header(); $showheader = true; if( avia_get_option( 'frontpage' ) && $blogpage_id = avia_get_option( 'blogpage' ) ) { if( get_post_meta( $blogpage_id, 'header', true ) == 'no' ) { $showheader = false; } } if( $showheader ) { echo avia_title( array( 'title' => avia_which_archive() ) ); } do_action( 'ava_after_main_title' ); ?> <div class='container_wrap container_wrap_first main_color <?php avia_layout_class( 'main' ); ?>'> <div class='container template-blog '> <main class='content <?php avia_layout_class( 'content' ); ?> units' <?php avia_markup_helper( array( 'context' => 'content', 'post_type' => 'post' ) );?>> <?php $tds = term_description(); if( $tds ) { echo "<div class='category-term-description'>{$tds}</div>"; } $avia_config['blog_style'] = apply_filters( 'avf_blog_style', avia_get_option( 'blog_style', 'multi-big' ), 'archive' ); if( $avia_config['blog_style'] == 'blog-grid' ) { global $posts; $post_ids = array(); foreach( $posts as $post ) { $post_ids[] = $post->ID; } if( ! empty( $post_ids ) ) { $atts = array( 'type' => 'grid', 'items' => get_option( 'posts_per_page' ), 'columns' => 3, 'class' => 'avia-builder-el-no-sibling', 'paginate' => 'yes', 'use_main_query_pagination' => 'yes', 'custom_query' => array( 'post__in' => $post_ids, 'post_type' => get_post_types() ) ); /** * @since 4.5.5 * @return array */ $atts = apply_filters( 'avf_post_slider_args', $atts, 'archive' ); $atts =array ( 'link' => array ( 0 => 'category', ), 'term_rel' => 'IN', 'wc_prod_visible' => '', 'wc_prod_hidden' => 'hide', 'wc_prod_featured' => '', 'prod_order_by' => '', 'prod_order' => '', 'date_filter' => '', 'date_filter_start' => '', 'date_filter_end' => '', 'date_filter_format' => 'yy/mm/dd', 'period_filter_unit_1' => '1', 'period_filter_unit_2' => 'year', 'page_element_filter' => '', 'sort' => 'yes', 'query_orderby' => 'date', 'query_order' => 'DESC', 'caption_elements' => 'title excerpt', 'caption_styling' => '', 'caption_display' => 'always', 'img_copyright' => '', 'size' => 'fixed masonry', 'orientation' => '', 'image_size' => 'masonry', 'gap' => '1px', 'columns' => 'flexible', 'av-desktop-columns' => '', 'av-medium-columns' => '', 'av-small-columns' => '', 'av-mini-columns' => '', 'items' => '12', 'paginate' => 'none', 'color' => '', 'custom_bg' => '', 'img_copyright_font' => '', 'av-desktop-font-img_copyright_font' => '', 'av-medium-font-img_copyright_font' => '', 'av-small-font-img_copyright_font' => '', 'av-mini-font-img_copyright_font' => '', 'img_copyright_color' => '', 'img_copyright_bg' => '', 'animation' => 'active', 'animation_duration' => '', 'animation_custom_bg_color' => '', 'animation_custom_bg_color_multi_list' => '', 'animation_z_index_curtain' => '100', 'overlay_fx' => 'active', 'img_scrset' => '', 'lazy_loading' => 'disabled', 'av-desktop-hide' => '', 'av-medium-hide' => '', 'av-small-hide' => '', 'av-mini-hide' => '', 'alb_description' => '', 'id' => '', 'custom_class' => '', 'template_class' => '', 'element_template' => '', 'one_element_template' => '', 'show_locked_options_fakeArg' => '', 'av_uid' => 'av-3lh7ch', 'sc_version' => '1.0', 'ids' => false, 'action' => false, 'post_type' => array ( 'post' => 'post', 'page' => 'page', 'attachment' => 'attachment', 'revision' => 'revision', 'nav_menu_item' => 'nav_menu_item', 'custom_css' => 'custom_css', 'customize_changeset' => 'customize_changeset', 'oembed_cache' => 'oembed_cache', 'user_request' => 'user_request', 'wp_block' => 'wp_block', 'wp_template' => 'wp_template', 'wp_template_part' => 'wp_template_part', 'wp_global_styles' => 'wp_global_styles', 'wp_navigation' => 'wp_navigation', 'acf-taxonomy' => 'acf-taxonomy', 'acf-post-type' => 'acf-post-type', 'acf-field-group' => 'acf-field-group', 'acf-field' => 'acf-field', 'product' => 'product', 'product_variation' => 'product_variation', 'shop_order' => 'shop_order', 'shop_order_refund' => 'shop_order_refund', 'shop_coupon' => 'shop_coupon', 'shop_order_placehold' => 'shop_order_placehold', 'alb_elements' => 'alb_elements', 'alb_custom_layout' => 'alb_custom_layout', 'rm_content_editor' => 'rm_content_editor', 'portfolio' => 'portfolio', 'avia_framework_post' => 'avia_framework_post', ), 'offset' => 0, 'container_links' => 'active', 'link_dest' => '', 'lightbox_text' => '', 'container_class' => 'av-masonry-entries', 'auto_ratio' => 1.7, 'set_breadcrumb' => true, 'custom_markup' => '', 'taxonomy' => 'category', 'categories' => array ( ), ); $blog = new avia_masonry($atts); $blog->get_element_styles(); $blog->query_entries(); echo '<div class="entry-content-wrapper">' . $blog->html() . '</div>'; } else { get_template_part( 'includes/loop', 'index' ); } } else { /* Run the loop to output the posts. * If you want to overload this in a child theme then include a file * called loop-index.php and that will be used instead. */ $more = 0; get_template_part( 'includes/loop', 'index' ); } ?> <!--end content--> </main> <?php //get the sidebar if( avia_get_option( 'archive_sidebar' ) == 'archive_sidebar_separate' ) { $avia_config['currently_viewing'] = 'archive'; } else { $avia_config['currently_viewing'] = 'blog'; } get_sidebar(); ?> </div><!--end container--> </div><!-- close default .container_wrap element --> <?php get_footer();
Best regards,
Vera- This reply was modified 9 months, 1 week ago by Vera.
February 9, 2024 at 6:14 am #1433752Hi,
This seems to be working correctly on our end. What happens when you set the taxonomy to “portfolio_entries”? Please look for this line:
'taxonomy' => 'category'
Replace it with:
'taxonomy' => 'portfolio_entries'
If you’re still having trouble, please open a different thread and post the login details in the private field.
Best regards,
Ismael -
AuthorPosts
- You must be logged in to reply to this topic.