Tagged: 

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #1338188

    Hi!

    We have a blog page built via Advanced Layout Editor. This consists only of a slider and the “Blog posts” content element. No special category was chosen so that all posts are displayed.

    In the base language (German) all blog posts are displayed. However, as soon as you translate this page into another language (using the translation editor), posts of type “nav_menu_item” are displayed in this language. At least this case occurs if no blog post has been translated yet.

    Changing the theme to another theme (e.g. TwentyTwenty) shows the typical “no posts available” page, so it can be assumed that the error exists on the part of Enfold.

    #1338189

    And YES, we are using the latest version of Enfold (4.8.8.1). PHP version is 8.0.13, browser is irrelevant.

    #1338353

    Hi,

    Thank you for the inquiry.

    Where can we check the issue? Please post the site URL in the private field. Did you set the blog and front page in the Enfold > Theme Options panel?

    And please update the theme to version 4.8.9 when you have the chance.

    Best regards,
    Ismael

    #1338428

    The links are in “private content”. Sorry but I don’t want to show the page to the public here.
    The problem can be seen on the mirrored dev server as well as on the live website.

    The Enfold settings for all languages are (nearly) identical. Version 4.8.9 also does not fix the problem. If I switch to another standard theme those posts don’t show up.

    #1338632

    Hi,

    Thank you for the update.

    According to the postslider.php file, the theme will automatically display all posts in the selected taxonomy when no category or term is selected. Unfortunately, the postslider element doesn’t handle cases where a category or a post doesn’t exists. To ensure that the post slider remains blank when there are no entries or categories, please add this code in the functions.php file.

    add_filter("avia_post_slide_query", function($query, $params) {
    	if(count($query["tax_query"]) == 0) {
    		$query["post_type"] = "category";
    	}
    
    	return $query;
    }, 10, 2);
    

    Best regards,
    Ismael

    #1338656

    Thanks for the workaround! But shouldn’t “nav_menu_item” posts never be displayed in frontend? Shouldn’t this case be handled inside the Enfold code?
    I will fix the problem temporarily using your code (thanks again!) but I would suggest to apply this fix globally in one of the next Enfold versions.

    Best regards
    Fabian

    #1338814

    Hi,

    We will forward the issue to our channel. Can you manually edit the page and remove the blog posts element temporarily, or is the page translated using the default translation editor?

    As you may noticed, there is no post type selection in the blog posts editor, so the theme includes all post types in the query by default and control what posts to retrieve using the tax_query or taxonomy query parameter, so if there are no posts or categories in the site, it will display all items from every post types because the tax_query parameter is blank. And since the blog posts element can only be added via builder, it is assumed that the user will only use the element when there are actually posts to display. It doesn’t really make sense to add an element in the builder that is not going to be used.

    Best regards,
    Ismael

    #1338853

    Thank you,

    the pages are all translated using the translation editor of WPML. No manually page-editing on other languages beside the base language is done.
    In my opinion there should be a filter of some kind that prevents non-frontend post-types from being shown, even if there is no post in a language at all.

    The point is:

    it is assumed that the user will only use the element when there are actually posts to display

    makes absolutely sense, BUT: the user does not “use the element”, it is copied automatically by adding a translation. There could always be a situation where the user wants to translate the blog page (listing of posts) but has no single post translated so far. Or a user wants to show posts in a completely different page using the “Blog posts” content element.

    Nevertheless: I will use your workaround inside the functions.php but I think it might be useful to implement a fix in the main theme.

    Thank you!

    #1339254

    Hi,

    makes absolutely sense, BUT: the user does not “use the element”, it is copied automatically by adding a translation

    This is why we asked if the page was translated using the default editor. In that case, you will have to temporarily use the filter that we provided above to keep the blog posts blank while there are no posts yet. We will forward the issue to our channel.

    Thank you for your understanding.

    Best regards,
    Ismael

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