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

    First of all, i love the Enfold theme, good job!

    I have Blog posts with a like-dislike counter, the like dislike counts are stored within the database.
    I have added the number of likes for each post to the postslider.php, and i echo them just above the title (into a div span)
    This way visitors can see the likes in the postslider.

    Now i would like to order the blog posts according to their likes (most likes first, least likes last).

    Is there a way to sort the posts according to the number of likes? The custom field does not have meta-data to it.


    Hey DennisDriessen!

    No not that I can think of or already know of. It would most likely need to be a new custom function to modify the query to sort by that number.

    Best regards,


    Hi Devin,

    Thank you for you fast reply!
    There is a query filter in the postslider.php script; it seems to take ‘date’ and ‘rand’ but it won’t work with ‘title’ or any other standard “orderby” parameter. Any idea why this query won’t take anything else?

    the query:

    $query = array( ‘orderby’ => ‘rand’,
    ‘order’ => ‘ASC’,
    ‘paged’ => $page,
    ‘post_type’ => $params[‘post_type’],
    ‘posts_per_page’ => $params[‘items’],
    ‘offset’ => $params[‘offset’],
    ‘post__not_in’ => (!empty($no_duplicates)) ? $avia_config[‘posts_on_current_page’] : array(),
    ‘tax_query’ => array( array( ‘taxonomy’ => $params[‘taxonomy’],
    ‘field’ => ‘id’,
    ‘terms’ => $terms,
    ‘operator’ => ‘IN’)));

    Best regards,


    You can add a filter to change the query like this:



    I’m beginner, I need order my post slider and I change this function from:

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


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

    But this doesn’t work, could you help me?

    Thank you and best Regards


    Hi Partecipant,

    The code you posted seems to be correct but the quotes might be the ones causing the issue.
    Please retype the quotes


    Let us know if it helps.

    Best regards,

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