Tagged: wpml
-
AuthorPosts
-
February 1, 2022 at 11:19 am #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.
February 1, 2022 at 11:26 am #1338189And YES, we are using the latest version of Enfold (4.8.8.1). PHP version is 8.0.13, browser is irrelevant.
February 2, 2022 at 5:06 am #1338353Hi,
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,
IsmaelFebruary 2, 2022 at 11:58 am #1338428The 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.
February 3, 2022 at 9:01 am #1338632Hi,
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,
IsmaelFebruary 3, 2022 at 11:08 am #1338656Thanks 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
FabianFebruary 4, 2022 at 6:28 am #1338814Hi,
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,
IsmaelFebruary 4, 2022 at 10:40 am #1338853Thank 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!
February 7, 2022 at 3:41 am #1339254Hi,
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 -
AuthorPosts
- You must be logged in to reply to this topic.