-
AuthorPosts
-
September 26, 2018 at 8:58 pm #1014986
Hello,
I’new at this forum, and… I have a problem ;)
The case:
on my site there is a page with two masonry galleries: first one displays “featured news” category posts, and the second one – “news” category posts.
Everything works fine as long as there is at least one post in each of displayed categories.
But if there is no post in category “featured news”, then “first” masonry gallery (the one that should display “featured news”) displays ALL posts of ALL categories. Second masonry gallery (responsible for displaying “news” category posts) works fine.I’m running WP version 4.9.8 and Enfold 4.4.1.
My site uses 35 (so far) categories of posts.HELP ! :)
Regards,
GrzegorzSeptember 27, 2018 at 4:57 am #1015098Hey Grzegorz,
Thank you for using Enfold.
Where can we see the issue? Please provide the site url and the login credentials in the private field. Do you have a page called “news”?
Best regards,
IsmaelSeptember 27, 2018 at 9:07 am #1015186Hey Ismael,
thank you for reply.
Details in private field :)Best regards,
GrzegorzSeptember 28, 2018 at 7:48 am #1015601Hi,
That is the default behavior of the masonry element. If the selected term or category is empty or if it doesn’t contain any posts, the masonry element will display all posts from every terms or category. You should delete the element if you don’t have any posts for that category yet or you can add this code on the functions.php file.
add_filter('avia_masonry_entries_query', 'avia_masonry_custom_query', 10, 2); function avia_masonry_custom_query( $query, $params ) { $args = array( 'posts_per_page' => 1, 'offset'=> 1, 'category' => $params['categories'] ); $posts = get_posts( $args ); if(!$posts) { $query = array(); } return $query; }
Best regards,
IsmaelSeptember 28, 2018 at 11:17 am #1015700Thank you for reply.
After two little modifications of your function it works as expected. I only had to change “1” to “0” :)
Great support and great theme!
Best regards,
GrzegorzSeptember 29, 2018 at 3:41 pm #1016062Hi Grzegorz,
Glad you got it working for you! :)
If you need further assistance please let us know.
Best regards,
VictoriaSeptember 29, 2018 at 3:41 pm #1016063Hi Grzegorz,
Glad you got it working for you! :)
If you need further assistance please let us know.
Best regards,
Victoria -
AuthorPosts
- You must be logged in to reply to this topic.