WordPress.org

Forums

Bogo
[resolved] Best way to translate Post Loop (Title, Excerpt, URL) (3 posts)

  1. Daniel Zimmermann
    Member
    Posted 1 year ago #

    What's the best way to translate a WordPress Loop using title, permalink, featured image and excerpt?

    query_posts( $args );
    if ( have_posts() ) {
      while ( have_posts() ) {
        the_post();
    
        the_permalink();
        get_the_post_thumbnail(get_the_ID(), 'thumbnail');
        get_the_title();
        the_excerpt();
      }
    }

    I'm particularly struggling here:
    http://danihao.org/en/frontpage/

    https://wordpress.org/plugins/bogo/

  2. Takayuki Miyoshi
    Member
    Plugin Author

    Posted 1 year ago #

    The best way is to give the query_posts() a lang parameter, like this:

    query_posts( add_query_arg( array( 'lang' => 'de' ), $args ) );

    In this example, I added the 'de' value as the 'lang' parameter, then the loop only contains German posts.

  3. Daniel Zimmermann
    Member
    Posted 1 year ago #

    Works fine. Thanks!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Bogo
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic