Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #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;
    }
    
    #660136

    I 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?

    #661134

    Hi!

    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!
    Ismael

    #793933

    Hi 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 :)

    #793936

    By 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.

    #794015

    Hi hayatbiralem,

    Thank you for sharing! :)

    Best regards,
    Victoria

    • This reply was modified 7 years, 6 months ago by Victoria.
    #914548

    Hi 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-size

    Would be great if someone could help me out with that issue.

    Thanks in advance
    Best regards
    Flo

    #914714

    Hi,

    Please create a new thread or ticket and put the login credentials in the private field. We’ll check it there.

    Best regards,
    Ismael

    #945566
    This reply has been marked as private.
    #945772

    Hi,


    @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

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