Viewing 20 posts - 1 through 20 (of 20 total)
  • Author
    Posts
  • #1418356

    Hi team Enfold,

    If the masonry element contains no entries, other entries (like for example pages) will be displayed.
    Is there a way to just let the masonry element empty, if there are no results?

    We found this but it seems incomplete.
    add_filter('avf_masonry_query_no_entries_fallback', true, $terms, $valid_terms );

    Kind regards,
    Team VDLP

    #1418451

    Hey vdlpwp,

    Thank you for the inquiry.

    Adding the following code in the functions.php file should work.

    add_filter('avf_masonry_query_no_entries_fallback', '__return_false');
    

    Best regards,
    Ismael

    #1419256

    Hi Ismael,

    Thank you for your answer. The supplied code doesn’t have any effect.

    The masonry grid still shows (other) entries, when there are no entries (in the selected category).

    Kind regards,
    Team VDLP

    #1419262

    Hi,

    Thank you for the update.

    The filter works correctly on our end. Please provide the site URL and login details so that we can check the issue further. Did you purge the cache before checking the page?

    Best regards,
    Ismael

    #1421139
    This reply has been marked as private.
    #1421154

    Hi,

    Thank you for the info.

    We were not able to edit the functions.php file because the Appearance > Theme File Editor is not accessible. Please enable the editor or post the S/FTP details in the private field.

    // https://developer.wordpress.org/advanced-administration/wordpress/wp-config/#disable-the-plugin-and-theme-file-editor

    Best regards,
    Ismael

    #1426327
    This reply has been marked as private.
    #1426393

    Hi,

    Thank you for the info.

    Did you enable the .htpassword? We can’t access the site because it is requiring another authentication. Please provide the info in the private field and try to add the filter again in the functions.php file.

    add_filter('avf_masonry_query_no_entries_fallback', function($fallback) {
        return false;
    }, 10, 1);
    

    Best regards,
    Ismael

    #1426792

    Hi Ismael,

    Our apologies. We added the authentication credentials in above private reply.

    Best regards,
    Team VDLP

    • This reply was modified 7 months, 4 weeks ago by vdlpwp.
    #1426956

    Hi,
    When I test the filter that Ismael posted above on my test site child theme functions.php and test a masonry element for a specific category, and set all of the items to “draft” the masonry element is not included in the page source code and it shows no items until I publish one of the posts for the specific category.

    add_filter('avf_masonry_query_no_entries_fallback', function($fallback) {
        return false;
    }, 10, 1);

    So this filter seems to be working correctly, when I examine your site you seemed to also be tring to show posts in a masonry element, but you didn’t have a category selected:
    Enfold_Support_4009.jpeg
    thus on the frontend the masonry element showed some “pages” instead of “posts”
    Enfold_Support_4011.jpeg
    so I selected the category in the masonry element:
    Enfold_Support_4013.jpeg
    and now on the frontend the masonry doesn’t show any items:
    Enfold_Support_4015.jpeg
    the title and button show because they are separate elements:
    Enfold_Support_4017.jpeg
    Please check.

    Best regards,
    Mike

    #1427137

    on my test environment – this is standard behavior.
    if there are no entries there is no masonry shown.
    Only an element ( here it is a heading ) got the class: el_before_av_masonry_entries

    #1427139

    Hi Mike,

    Thank you for your detailed answer. To elaborate further on your answer, we wonder whether it is possible to add a filter that does not return any entries if there are no results (when no category in a certain taxonomy is selected).

    When a blog has multiple categories, we won’t select a category (within the taxonomy ‘Category’) so everything is shown regardless of a specific category.

    Thanks in advance
    Team VDLP

    #1427171

    Hi,
    If you had multiple categories then the category with posts would be the one to show and you would not need to use the filter above.

    Best regards,
    Mike

    #1432023

    Hi Mike,

    Thank you for your reply. Our apologies for our late response.

    … masonry element, but you didn’t have a category selected:

    This is correct. We don’t want to select a category in our masonry element. So when there are 3 categories, and in the future our client adds another category, this post (from this new category) will also be shown.

    But when we select ‘no categories’ and there are no posts, all pages and sort of post type entries are shown in the masonry. This should in our opinion result into 0 items. Because there are post categories, but there are no posts in this categories.

    Is there also a filter or function for this?

    Desired situation: When no categories are selected the masonry element has 0 results. When a new post is added in a new category, it shows 1 post.

    Kind regards,
    Team VDLP

    #1432103

    Hi,

    Desired situation: When no categories are selected the masonry element has 0 results. When a new post is added in a new category, it shows 1 post.

    That is not possible, unfortunately. You either have to select a category or select none at all to display all posts from all categories. The filter avf_masonry_query_no_entries_fallback when set to false will prevent fallback posts from displaying when there are no items in the selected category.

    Best regards,
    Ismael

    #1438421

    i know that this is an older topic – but with that new logic to show only Cat A and Cat B if both is true. Filter does not work as expected.
    It shows the posts of that Category which has a post.

    #1438773

    Hi,
    Thanks for pointing this out Guenni007, I summited a report to the Dev Team and will reply when I hear from them, thank you for your patience.

    Best regards,
    Mike

    #1438894

    Hi @Guenni007,

    I added a fix for 5.7:

    https://github.com/KriesiMedia/enfold-library/blob/master/temp_fixes/Enfold_5_6_11/avia-shortcode-helpers/class-avia-masonry.php

    LIMITATION: relation “AND” does not provide a fallback if empty categories are selected !!!

    Best regards,
    Günter

    #1439078

    LIMITATION: relation “AND” does not provide a fallback if empty categories are selected !!!

    means in the case of the And combination, if one of the categories contains no posts, nothing is displayed. – which would be my personal preference.

    #1439423

    Hi,

    means in the case of the And combination, if one of the categories contains no posts, nothing is displayed. – which would be my personal preference.

    This is how it is working for me when I check and using the filter:

    add_filter('avf_masonry_query_no_entries_fallback', function($fallback) {
        return false;
    }, 10, 1);

    this was the intention of the fix.

    Best regards,
    Mike

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