• Resolved billybob71a

    (@billybob71a)


    Hi,

    I have website for a photo gallery, which started of without polylang and then I installed polylang. The translation of languages is good as I see that the default registration page is already translated, wp-login.php is translated and I am allowed to create manual translations for certain pages.

    However, I am using some shortcode from another plugin with some customizations of my own to display posts with photo attachments and I find the functions that I am calling do not give me any results.

    $the_current_user_temp = wp_get_current_user();
    $the_current_user_id = esc_html( $the_current_user_temp->ID );
    $the_current_user_login_id = get_the_author_meta( ‘user_login’, $the_current_user_id );
    $args = array(
    ‘author’ => $the_current_user_id,
    ‘orderby’ => ‘post_date’,
    ‘order’ => ‘ASC’,
    ‘posts_per_page’ => 5
    );
    $current_user_posts = get_posts( $args );
    $total = count( $current_user_posts );

    For example, the above is returning 0 posts.

    However, after I remove your plugin, I can see the posts again.

Viewing 1 replies (of 1 total)
  • Thread Starter billybob71a

    (@billybob71a)

    OH I figured it out.

    I have to add the parameter ‘lang’= ”, for a wildcard of all languages.

    So it will be like this:

    $args = array(
    ‘author’ => $the_current_user_id,
    ‘orderby’ => ‘post_date’,
    ‘order’ => ‘ASC’,
    ‘posts_per_page’ => 5,
    ‘lang’ = ”
    );

Viewing 1 replies (of 1 total)
  • The topic ‘wordpress functions not working after installing polylang’ is closed to new replies.