Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #248725

    Hello

    I would like to have a page displaying posts in a certain language in my Enfold installation.
    Using a default WP theme I would know where to put something like the following:
    $posts = get_posts(‘numberposts=4&order=DSC&orderby=post_title&lang=en’);

    But Enfold is a lot more complex.

    So my question is:
    Is there a way to alter the (I suppose) loop-index so it would call only the posts in a certain language? How could I do it?

    Thank you in advance

    #249650

    Hi kidcabide!

    If you’re using the standard blog template you can manipulate the main query in wp-content/themes/flashlight/template-blog.php. Just replace:

    
    $avia_config['new_query'] = array( "paged" => get_query_var( 'paged' ), "posts_per_page"=>get_option('posts_per_page') ) ;
    

    with

    
    $avia_config['new_query'] = array( "paged" => get_query_var( 'paged' ), "posts_per_page"=>get_option('posts_per_page') ) ;
    query_posts(‘numberposts=4&order=DSC&orderby=post_title&lang=en’);
    

    If you’re using a Advanced layout blog element you can try to use the query filters to manipulate the query but I’m not sure if this works out. The code would look like:

    
    if(!function_exists('avia_change_posts_query'))
    {
    	function avia_change_posts_query($query, $params)
    	{
    	    if(!empty($query['post_type']))
    	    {
    	            if((is_array($query['post_type']) && in_array('post', $query['post_type'])) || $query['post_type'] == 'post')
    	            {
                                $query['lang'] = 'en';
    	            }
    	    }
    	
    	    return $query;
    	}
    	
    	add_filter('avia_masonry_entries_query', 'avia_change_posts_query', 10, 2);
    	add_filter('avia_post_grid_query', 'avia_change_posts_query', 10, 2);
    	add_filter('avia_post_slide_query', 'avia_change_posts_query', 10, 2);
    	add_filter('avia_blog_post_query', 'avia_change_posts_query', 10, 2);
    }
    
    

    Regards,
    Peter

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.