• Resolved petrosweb

    (@petrosweb)


    Hallo people.

    I have a very weird problem. In the front-page template i execute 2 wp_querys:

    1st.
    $args = array(
    ‘post_type’ => ‘announcement‘,
    ‘posts_per_page’ => -1,
    ‘lang’ => the_curlang(),
    ‘orderby’ => ‘date’,
    ‘order’ => ‘DASC’
    );

    2nd.
    $args = array(
    ‘post_type’ => ‘post‘,
    ‘posts_per_page’ => -1,
    ‘lang’ => the_curlang(),
    ‘orderby’ => ‘date’,
    ‘order’ => ‘DASC’
    );

    The 2nd query doenst work properly. It returns the home page and not the blog posts. If i remove the_curlang() option it works just fine.

    Any idea what causes the confict?

    https://wordpress.org/plugins/xili-language/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Michel – xiligroup dev

    (@michelwppi)

    Please use the support form inside xili-language settings for detailed infos and direct contact to exchange about the queries.
    Language is a taxonomy and it is better to use ‘as is’ in the query well documented in wp codex. I will send you some example as those visible in twentyfourten-xili child exemple theme to manage ephemera or grid…
    Hope to read you.
    M.

    NewSha

    (@newsha)

    I’ve got the same problem,
    ‘lang’ => the_curlang() doesn’t work with ‘post_type’ => ‘post’.

    It returns the home page instead of the posts.

    petrosweb, have you solved this problem?

    Plugin Author Michel – xiligroup dev

    (@michelwppi)

    As reported before it is better to use a taxonomy query like that

    array(
    			'order'          => 'DESC',
    			'posts_per_page' => $number,
    			'no_found_rows'  => true,
    			'post_status'    => 'publish',
    			'post__not_in'   => get_option( 'sticky_posts' ),
    			'tax_query'      => array(
    				'relation' => 'AND',
    				array(
    					'taxonomy' => 'post_format',
    					'terms'    => array( "post-format-$format" ),
    					'field'    => 'slug',
    					'operator' => 'IN',
    				),
    				array(
    					'field'    => 'slug',
    					'taxonomy' => 'language',
    					'terms'    => $the_lang,
    				),
    			),
    		) ;

    where $the_lang is the target slug of a language !

    Thread Starter petrosweb

    (@petrosweb)

    i couldn’t find a solution. I used an other plugin.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘post_type => 'post & the_curlang()’ is closed to new replies.