Tagged: masonry
-
AuthorPosts
-
March 8, 2022 at 4:35 pm #1343673
I have a custom category.php where I change the display to Masonry using this:
$masonry = new avia_masonry( $atts ); $masonry->extract_terms(); $masonry->query_entries(); $masonry_html = $masonry->html(); echo "<div class='entry-content-wrapper'>".$masonry_html."</div>";
It looks like 4.9 has changed the way Masonry is called. I get some errors related to the $atts. Can someone let me know the best way to call masonry now with the new method?
- This topic was modified 2 years, 8 months ago by christiemade.
March 9, 2022 at 4:34 am #1343757Hey Christie,
Thank you for the inquiry.
What was the exact error in your installation? Please post the error here so that we can understand the issue better.
Best regards,
IsmaelMarch 9, 2022 at 3:50 pm #1343865Here is the error:
PHP Fatal error: Uncaught Error: Call to a member function get_default_sc_args() on null in /nas/content/live/dembostage/wp-content/themes/enfold/config-templatebuilder/avia-template-builder/php/base-classes/class-sub-item-query-base.php:84\nStack trace:\n#0 /nas/content/live/dembostage/wp-content/themes/enfold/config-templatebuilder/avia-shortcode-helpers/class-avia-masonry.php
Also, the contents for $atts, if needed:
$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() ) );
- This reply was modified 2 years, 8 months ago by christiemade.
March 11, 2022 at 3:04 am #1344081Hi christiemade,
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,
NikkoMarch 12, 2022 at 8:58 pm #1344245Here you go!
March 14, 2022 at 4:57 pm #1344441Hi christiemade,
Thanks, 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.Best regards,
Nikko- This reply was modified 2 years, 8 months ago by Nikko.
March 14, 2022 at 7:18 pm #1344459Hi christiemade,
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 category.php file:$masonry = new avia_masonry( $atts ); $masonry->extract_terms(); $masonry->query_entries(); $masonry_html = $masonry->html();
with:
$masonry = new avia_masonry( $atts ); $masonry->extract_terms(); $masonry->query_entries(); $masonry->get_element_styles(); $masonry_html = $masonry->html();
Regards,
NikkoMarch 15, 2022 at 7:09 pm #1344645This fixes that error, yes, thank you!!
I had several other customizations in place inside the av-helper-masonry.php file. Enfold has moved all that functionality over to class-avia-masonry.php – which I cannot figure out how to override in the child theme. Any tips?March 16, 2022 at 7:41 am #1344672Hi christiemade,
We’re glad that we could help :)
What are those customizations?
As for overriding avia_masonry, you should be able to do it easily by creating a class with the name of avia_masonry in your child theme.
You can just copy the whole class and paste it in functions.php file (though I suggest you use a separate file and then include it) then make tweaks to it.class avia_masonry extends \aviaBuilder\base\aviaSubItemQueryBase { // all the code inside }
I hope this helps.
Best regards,
NikkoMarch 16, 2022 at 3:08 pm #1344751Thank you – it’s a lot of small things, but it’s all over that file (things not provided by any hooks or filters).
I’ve tried putting the class definition in my child theme and this is the error I get:
PHP Fatal error: Uncaught Error: Class "aviaBuilder\\base\\aviaSubItemQueryBase" not found in /nas/content/live/dembostage/wp-content/themes/dembo/custom/class-avia-masonry.php:5\nStack trace:\n#0 /nas/content/live/dembostage/wp-content/themes/dembo/functions.php(6): include()\n#1 /nas/content/live/dembostage/wp-settings.php(555): include('/nas/content/li...')\n#2 /nas/content/live/dembostage/wp-config.php(128): require_once('/nas/content/li...')\n#3 /nas/content/live/dembostage/wp-load.php(50): require_once('/nas/content/li...')\n#4 /nas/content/live/dembostage/wp-blog-header.php(13): require_once('/nas/content/li...')\n#5 /nas/content/live/dembostage/index.php(17): require('/nas/content/li...')\n#6 {main}\n thrown in /nas/content/live/dembostage/wp-content/themes/dembo/custom/class-avia-masonry.php on line 5
- This reply was modified 2 years, 8 months ago by christiemade.
March 16, 2022 at 3:37 pm #1344756Hi christiemade,
Can you setup a staging site for us? so we can try to inspect further without affecting your live site.
Best regards,
NikkoMarch 16, 2022 at 4:42 pm #1344761I am working on a staging site already, of course! The site won’t even load though with the class override. (As you can see)
March 16, 2022 at 6:37 pm #1344771Hey!
Please check enfold\config-templatebuilder\avia-template-builder\php\class-template-builder.php
around line 686 you have the function autoloadLibraries()
and inside filter avf_load_single_shortcode_file.
There you can hook to load your customized file instead the original one.
A few lines above you have filter avf_load_single_builder_core_file where you can load modified customized core files.
Regards,
GünterMarch 17, 2022 at 3:23 am #1344814Oh, wonderful! This is exactly what I need. Thank you so much as always for your help! I’ve got it from here!
March 17, 2022 at 4:44 am #1344815Hi christiemade,
We’re glad that we could help you :)
Thanks for using Enfold and have a great day!Best regards,
Nikko -
AuthorPosts
- The topic ‘Manual Masonry Call in Enfold 4.9’ is closed to new replies.