Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #1343782

    Hi!

    After an update of the Enfold theme, our blog archive page is broken because of a PHP error.

    In our child theme the code of the archive.php is changes to:

    if(!empty($post_ids))
                            {
                                $atts   = array(
                                    'type' => 'grid',
                                    'items' => get_option('posts_per_page'),
                                    'columns' => 2,
                                    'class' => 'avia-builder-el-no-sibling',
                                    'paginate' => 'yes',
                                    'gap' => 'large',
                                    'overlay_fx' => 'bluronhover',
                                    'caption_elements' => 'title',
                                    'caption_styling' => 'overlay',
                                    'use_main_query_pagination' => 'yes',
                                    'custom_query' => array( 'post__in'=>$post_ids, 'post_type'=>get_post_types() )
                                );
    
      		               		$blog = new avia_masonry($atts);
    				           $blog->extract_terms();
    				           $blog->query_entries();

    This now brings up a PHP error with the latest Enfold version:

    Fatal error: Uncaught Error: Call to a member function get_default_sc_args() on null in /www/htdocs/xxx/xxx/wp-content/themes/enfold/config-templatebuilder/avia-template-builder/php/base-classes/class-sub-item-query-base.php:84 Stack trace: #0 /www/htdocs/xxx/xxx/wp-content/themes/enfold/config-templatebuilder/avia-shortcode-helpers/class-avia-masonry.php(50): aviaBuilder\base\aviaSubItemQueryBase->__construct(Array, NULL, Array) #1 /www/htdocs/xxx/xxx/wp-content/themes/enfold-child/archive.php(66): avia_masonry->__construct(Array) #2 /www/htdocs/xxx/xxx/wp-includes/template-loader.php(106): include('/www/htdocs/xxx...') #3 /www/htdocs/xxx/xxx/wp-blog-header.php(19): require_once('/www/htdocs/xxx...') #4 /www/htdocs/xxx/xxx/index.php(17): require('/www/htdocs/xxx...') #5 {main} thrown in /www/htdocs/xxx/xxx/wp-content/themes/enfold/config-templatebuilder/avia-template-builder/php/base-classes/class-sub-item-query-base.php on line 84

    The call to
    $blog = new avia_masonry($atts);
    is the problem here. How can we achieve a post grid look in the archive page with the latest Enfold version?

    Thanks,
    Marc

    #1343948

    Hey Autaak,

    Thank you for the inquiry.

    In the $atts array above, try to remove the type and and the use_main_query_pagination items. The error probably occurs because those items are not valid avia_masonry attributes.

    Best regards,
    Ismael

    #1343970

    Hi Ismael,

    thanks for your response. Unfortunately removing these entries from $atts did not have any effect. The site still throws the PHP error.

    What else can break the avia_masonry in newer Enfold versions?

    Thanks,
    Marc

    #1344080

    Hi Marc,

    Can you post the whole code of your archive.php file in https://pastebin.com/ and give the link to us? so we can try to test your code on our end.
    You can post the link in private content.

    Best regards,
    Nikko

    #1344099

    Hi Nikko,

    please find two Pastebins in the private section: one for the archive.php and one for a part of the functions.php with related code.

    Thanks,
    Marc

    #1344363

    Hi Marc,

    Try to replace this code in archive.php:

    $atts   = array(
    //  'type' => 'grid',
        'items' => get_option('posts_per_page'),
        'columns' => 2,
        'class' => 'avia-builder-el-no-sibling',
        'paginate' => 'yes',
        'gap' => 'large',
        'overlay_fx' => 'bluronhover',
        'caption_elements' => 'title',
        'caption_styling' => 'overlay',
    //  'use_main_query_pagination' => 'yes',
        'custom_query' => array( 'post__in'=>$post_ids, 'post_type'=>get_post_types() )
    );
    
    $blog = new avia_masonry($atts);
    $blog->extract_terms();
    $blog->query_entries();
    $output .= $blog->html();
    echo "<div class='entry-content-wrapper'>".$blog->html()."</div>";

    with:

    $atts   = array(
        'type' => 'grid',
        'items' => get_option('posts_per_page'),
        'columns' => 2,
        '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() )
    );
    
    $blog = new avia_post_slider($atts);
    $blog->query_entries();
    echo "<div class='entry-content-wrapper'>".$blog->html()."</div>";

    Hope this helps.
    Best regards,
    Nikko

    #1344386

    Hi Nikko,

    thanks for the code snippet. This snippet works, but does something else.

    The original code in archive.php should show a post masonry grid like it is on the main blog page (just post image with post title on the image, but without abstract, category and so on).

    Is there any possibility to get back the original functionality of the archive.php (as sent to you in the pastebin)?

    Marc

    #1344442

    Hi Marc,

    We have reported this issue to our devs.
    For the meantime please use avia_post_slider or fallback to the previous version of Enfold(4.8) as a temporary solution.
    We’ll post here once a solution is made available, so you can use avia_masonry again.

    Best regards,
    Nikko

    • This reply was modified 2 years, 8 months ago by Nikko.
    #1344460

    Hi Marc,

    Can you test this version (private content) and see if it works properly on your end?
    Just upload the zip file in Appearance > Themes and it should replace the current version of Enfold.
    Once replaced, please change this code on your archive.php file:

    $blog = new avia_masonry($atts);
    $blog->extract_terms();
    $blog->query_entries();
    $output .= $blog->html();
    echo "<div class='entry-content-wrapper'>".$blog->html()."</div>";

    with:

    $masonry = new avia_masonry( $atts );
    $masonry->extract_terms();
    $masonry->query_entries();
    $masonry->get_element_styles();
    $masonry_html = $masonry->html();
    
    echo "<div class='entry-content-wrapper'>".$masonry_html."</div>";

    Regards,
    Nikko

    #1344569

    Hi Nikko,

    That worked as expected. Thanks for that. Is it save to continue using this private version until the next official update?

    Marc

    #1344669

    Hi Marc,

    We’re glad to hear that :)
    It’s safe to use that version, just think of it as the current version with some of the fixes and features of the upcoming version.

    Best regards,
    Nikko

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