-
AuthorPosts
-
July 12, 2016 at 10:01 pm #660128
How can I make all of the pages that display posts in grid format to look like the avia masonry grid? I want the style of all blog pages to be consistent with my main blog page here: https://brainxchange.events/enfold-staging/enterprisewear-blog/
I used this to change category to grid format but it doesn’t look near as well as my blog home (custom page)
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; }
July 12, 2016 at 10:32 pm #660136I see the Default Enfold Demo site has the “Blog Masonry” but I am using the “startup business demo.” Can I import certain features from other demos?
July 15, 2016 at 5:37 am #661134Hi!
Thank you for using Enfold.
I’m sorry but the masonry style can’t be applied to the archive or category pages. This will require modifications that are outside the scope of support. Please hire a freelance developer or contact codeable. http://kriesi.at/contact
Or you can modify the archive.php file, look for this code around line 62:
$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();
Add this 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; }
Cheers!
IsmaelMay 16, 2017 at 2:16 pm #793933Hi Ismael,
Thansk for the tip but there is an issue on the avia_masonry_query_func: your code are not covers the tag, the date and the custom tax archives.
Also give an error on the masonry elements in the posts or the pages.
Following code just simple and it covers all of that cases:
add_filter( 'avia_masonry_entries_query', 'my_avia_masonry_query_func', 10, 2); function my_avia_masonry_query_func( $query, $params ) { if(!is_archive()) return $query; global $wp_query; return $wp_query->query; }
Hope this helps anyone like me :)
May 16, 2017 at 2:21 pm #793936By the way, I also remove tag.php archive with following code, so I use archive.php for all archives:
function my_template_override($template) { global $wp_query; if($wp_query->is_tag) { return locate_template('archive.php'); } return $template; } add_filter('template_include', 'my_template_override');
Hope this helps,
thanks.May 16, 2017 at 3:35 pm #794015Hi hayatbiralem,
Thank you for sharing! :)
Best regards,
Victoria- This reply was modified 7 years, 5 months ago by Victoria.
February 19, 2018 at 9:37 pm #914548Hi guys,
I followed the steps which @hayatbiralem descriped before and it worked totally fine for me. Thanks for that!What I couldn’t achive by modifying functions.php was:
[1] disabling the overlay on the masonry
[2] showing the entry-title only by mouse-over and
[3] change the entry-title font-sizeWould be great if someone could help me out with that issue.
Thanks in advance
Best regards
Flo- This reply was modified 6 years, 8 months ago by Unternehmerich.
February 20, 2018 at 6:39 am #914714Hi,
Please create a new thread or ticket and put the login credentials in the private field. We’ll check it there.
Best regards,
IsmaelApril 23, 2018 at 9:18 pm #945566This reply has been marked as private.April 24, 2018 at 9:33 am #945772Hi,
@michelbrons: That could be another workaround but I don’t think that’s going to work properly on archive pages because of the static query.Best regards,
Ismael -
AuthorPosts
- You must be logged in to reply to this topic.