• Resolved kristynakadlecova

    (@kristynakadlecova)


    Hi, support,

    I have found two odd behavior of Advanced Post Block.

    1. It displays the correct author meta, but in the front end, there is only one author – the same for all posts. When inspecting the page, there is no error or warning.

    2. APB allows me to choose to display posts from all the categories (even in the second language of my website, which is exactly what I need), but it shows the correct posts categories only when working on the page, not on the front-end, again.

    I use the Polylang plugin on the site, so it might be caused by some of the rules of Polylang regarding changing all the content to the chosen language of the page. But I need to have a posts module of the opposite language on the Home side for both languages.

    Thanks for your help in advance.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Charles Cormier

    (@charlescormier)

    Hi @kristynakadlecova,
    We fixed the issue and release a new version, please update.

    Thread Starter kristynakadlecova

    (@kristynakadlecova)

    Hi, thanks a lot.

    Another question,
    I have websites with two languages moderated by the Polylang plugin. I would like to force the plugin.php file of APB to act according to the current page’s language (if/else conditions maybe? Or adding some filter?). I think it is possible because When I change your code to (below), it forces loading posts only in the German language.
    Aaand that’s why I think it is possible to give APB the order to display the posts if the current page’s language is “de” or “en”. (Pages in “de” should display “en” posts only and contrarywise.)
    // All Posts
    $defaultPostFilter = ‘post’ === $postType ? [
    ‘category’ => $selectedCategories
    ] : [];
    $posts = get_posts( array_merge( [
    ‘post_type’ => $postType,
    ‘posts_per_page’ => $isPostsPerPageAll ? -1 : $postsPerPage,
    ‘orderby’ => $postsOrderBy,
    ‘order’ => $postsOrder,
    ‘lang’ => ‘de’,
    ], $defaultPostFilter ) );

    Is it possible? Could you please help me with this?
    Thanks

    Plugin Author Charles Cormier

    (@charlescormier)

    Hi @kristynakadlecova,
    ‘lang’ => function_exists( ‘pll_default_language’ ) ? pll_default_language() : ”
    Please use this code to filter the posts according to your language.
    This is custom code, we didn’t add the code in plugin. So, for future use store the code. And when you update the APB Plugin, you have to place the code again.
    And one more thing, this code is not working in the back end.
    Thanks!

    Thread Starter kristynakadlecova

    (@kristynakadlecova)

    Hi and thanks a lot, I’m not sure I do it correctly, where exactly I should drop the code?

    Plugin Author Charles Cormier

    (@charlescormier)

    Hi @kristynakadlecova,

    Replace this code (old):
    $posts = get_posts( array_merge( [
    ‘post_type’ => $postType,
    ‘posts_per_page’ => $isPostsPerPageAll ? -1 : $postsPerPage,
    ‘orderby’ => $postsOrderBy,
    ‘order’ => $postsOrder
    ], $defaultPostFilter ) );`

    To this code(new):
    $posts = get_posts( array_merge( [
    ‘post_type’ => $postType,
    ‘posts_per_page’ => $isPostsPerPageAll ? -1 : $postsPerPage,
    ‘orderby’ => $postsOrderBy,
    ‘order’ => $postsOrder,
    ‘lang’ => function_exists( ‘pll_default_language’ ) ? pll_default_language() : ”
    ], $defaultPostFilter ) );

    You just add as post query, like you did in 3rd replay.

    Thread Starter kristynakadlecova

    (@kristynakadlecova)

    Oh my, I can see it now. There was ‘lang’ not ‘lang’, and so on… I was blind.
    Anyway, The German page displays the English posts correctly, but the English does not display anything. Although, in the working space there are the correct English posts from the correct lang. categories. Quite odd…

    Thread Starter kristynakadlecova

    (@kristynakadlecova)

    I mean, basically, the issue was in wrong quotation marks.
    But the result of the filter is that the page with the default second language displays the post in the first language correctly, but the page with the default main website’s language displays nothing, no posts from the other language.

    Thread Starter kristynakadlecova

    (@kristynakadlecova)

    Ok, I’ve got it!

    ‘lang’ => function_exists( ‘pll_default_language’ ) ? pll_default_language(‘en’, ‘de’) : ”

    Thanks a lot, man!

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Plugin does not show the right author’ is closed to new replies.