Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #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.

    #240468

    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,
    Devin

    #240581

    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,
    Dennis

    #240927

    You can add a filter to change the query like this:
    http://www.dailyblogging.org/wordpress/increase-wordpress-memory-limit/

    #1186702

    Hi,

    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;
    }

    To:

    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

    #1187392

    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,
    Nikko

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