[Resolved] WP Show posts and WPML

Home Forums Support [Resolved] WP Show posts and WPML

Home Forums Support WP Show posts and WPML

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1590133
    Vera

    Hi,
    I am building a German version of my website. On the homepage, I want to show recent posts, and for that, I am using Tom’s WP Show Posts plugin on the original English version of my website. But when I want to use it on the German version, it show’s the message: Sorry, no posts were found. Would you maybe know why it’s happening and how I can solve this problem? Thanks!

    #1590222
    Elvin
    Staff
    Customer Support

    Hi,

    WP Show post’s “No results message” can’t be translated by default.

    As shown here, it gets the string added directly from WPSP’s edit list page.
    https://github.com/tomusborne/wp-show-posts/blob/35e410d7800273fc66f211c0f80d553e95d17f83/wp-show-posts.php#L491

    To be able to translate it, you must edit this line within the plugin’s code to match your plugin’s standard.

    Here’s an example of following WPML’s requirement.
    https://wpml.org/documentation/support/enabling-text-translation-for-themes-not-compatible-with-wpml/

    Here’s the “edit” we must apply to the WP Show Post’s code plugin via Plugins > Plugin editor.

    We change this line in “Line 491”:
    echo wpautop( $settings[ 'no_results' ] );

    To this line:
    echo wpautop( esc_html__( $settings[ 'no_results' ] , 'wp-showposts' ) );

    We can then test it if it works by doing a gettext filter test.

    add_filter( 'gettext', function( $text ) {
        if ( 'Sorry, no posts were found.' === $text ) {
            $text = 'Your WPSP No results message translation';
        }
        return $text;
    } );

    Here’s how to add PHP – https://docs.generatepress.com/article/adding-php/

    A wise man once said:
    "Have you cleared your cache?"

    #1590226
    Vera

    Hi Elvin,
    I am not so concerned for getting a No posts message in another language. I can’t figure out why the posts don’t show. I even tried with the same short code as on English page, but they don’t show either.
    Thanks for your help!
    vera

    #1590243
    Elvin
    Staff
    Customer Support

    I can’t figure out why the posts don’t show.

    Ah if that’s the case, here’s a few things to check.

    1.) Check if the WPSP’s query settings is valid.
    – Do your shortcode have any settings="" in it? If yes, then perhaps its settings isn’t finding any posts that matches.
    – On your WPSP edit list settings, check for the query parameters on the posts tab. Perhaps you’re not seeing any posts because it is set to a certain taxonomy with no posts associated under it.

    2.) Check your post’s status.
    – Are they published? Draft posts don’t appear on WPSP.

    3.) Try testing WPSP with every other plugins disabled.
    – Perhaps there’s a plugin conflict that causes this issue.

    Also, if you’d like, we can try checking this with you. You can provide site details on the private information text field so we could check around.

    Let us know.

    A wise man once said:
    "Have you cleared your cache?"

    #1590295
    Vera

    Hi Elvin,
    On my German Homepage I am using the same short code with the same posts as on my English version. I do this on purpose in order to test if it’s working (thinking that if the short code works somewhere on the site, you should work elsewhere as well). English version is published long ago, and it works perfectly. I think that oretty much eliminates also plugin conflict other than maybe WPML itself? German Homepage isn’t published yet, can that cause that latests posts within WP Show posts don’t show on the preview of a German homepage (although the posts are published)? Thank you!

    #1591074
    Tom
    Lead Developer
    Lead Developer

    That’s strange – are all of the posts that are missing from the list translated already? It may be worth checking with WPML, as it could be something they’re aware of/know the solution to.

    #1591114
    Vera

    Hi Tom,
    I tested it on thenonly published page in German and it works. So it has to do with the page I am trying the WP Show Posts to show on, not being published. So they aren not showing on the page preview. I am now positive that once I publish German homepage, the posts will show up. If not, I’ll get back to you and perhaps to WPML.
    Thanks for your help!
    vera

    #1592385
    Tom
    Lead Developer
    Lead Developer
Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.