WordPress.org

Ready to get started?Download WordPress

Forums

Ambrosite Next/Previous Post Link Plus
[resolved] meta_key exclude thoes without thumbnail (4 posts)

  1. lukehm
    Member
    Posted 1 year ago #

    Hi I'm trying to show previous next which have a thumbnail
    'meta_key' => '_thumbnail_id' works with WP_Query but not Ambrosite Next/Previous Post Link Plus. Any thoughts.
    Many Thanks
    Luke

    http://wordpress.org/plugins/ambrosite-nextprevious-post-link-plus/

  2. ambrosite
    Member
    Plugin Author

    Posted 1 year ago #

    That might actually work, but only if you set 'order_by' to 'custom', which will cause the posts to be sorted by thumbnail ID. If you want to sort by some other value, it would require a hack. I can tell you which lines need to be changed if you want to try it.

  3. lukehm
    Member
    Posted 1 year ago #

    Many Thanks for response
    I've pre found list of IDs with thumbnails and used in_posts, sorted alphabetically. Works a treat. However Would love to try the hack.
    ps fabulous plugin
    Best

  4. ambrosite
    Member
    Plugin Author

    Posted 1 year ago #

    I haven't tested this, but I think all you need to do is comment out lines 152 and 153. They look like this:

    if ( $in_same_meta && $r['order_by'] != 'custom' && $r['order_by'] != 'numeric' )
        $in_same_meta_sql = $wpdb->prepare("AND m.meta_value = %s", get_post_meta($post->ID, $in_same_meta, TRUE) );

    Then set your parameters like this (use 'in_same_meta' instead of 'meta_key'):

    'order_by' => 'post_title', // or whatever you want to sort by
    'in_same_meta' => '_thumbnail_id'

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic