Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #987663

    I found this code on your support site, and works just fine, BUT it also pulls PAGES on the query … Is there any chance to pull only posts ??

    //——————————
    // php – Display random post
    //——————————

    add_filter(‘avia_post_slide_query’, ‘enfold_customization_query_custom’);
    function enfold_customization_query_custom( $query ) {
    $query[‘orderby’] = ‘rand’;
    return $query;
    }

    Thanks a lot !!
    Luis

    #988209

    Hey LUISCANAL,

    Please try the code like this:

    
    add_filter('avia_post_slide_query', 'enfold_customization_query_custom');
    function enfold_customization_query_custom( $query ) {
    	if (is_page()) return $query;
    	$query['orderby'] = 'rand';
    	return $query;
    }
    

    If you need further assistance please let us know.
    Best regards,
    Victoria

    #988717

    Unfortunely It did not worked, now brings always the same two posts instead of random ones …

    #989101

    Hi LUISCANAL,

    How many posts do you have? What kind of caching are you using?

    Best regards,
    Victoria

    #989216

    Hi Victoria, 197 posts, cache level 0.

    #989614

    Hi LUISCANAL,

    I tested this code and it works fine and it doesn’t fetch pages if you only selected posts or category of posts:

    add_filter('avia_post_slide_query', 'enfold_customization_query_custom');
    function enfold_customization_query_custom( $query ) {
    	$query['orderby'] = 'rand';
    	return $query;
    }

    Can you give us a link to the page mentioned and give us temporary admin access? so we can check on it further.
    Just post the details in private content.

    Best regards,
    Nikko

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