Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter taadike

    (@taadike)

    Never mind, I think I got it ??

    Thanks for this incredible plugin!

    Plugin Author Ben Cole

    (@bcole808)

    Hello,

    Yes you can write custom queries that use the plugin data. All data is stored as custom meta fields on each post, so you can use a WP Meta Query to query based on the data.

    You can see a list of the available meta fields on the Github readme page here: https://github.com/chapmanu/wp-social-metrics-tracker

    So for example, a meta query to show posts with more than 5 shares might look like this:

    $args = array(
    	'post_type'  => 'post',
    	'meta_key'   => 'socialcount_total',
    	'orderby'    => 'meta_value_num',
    	'order'      => 'DESC',
    	'meta_query' => array(
    		array(
    			'key'     => 'socialcount_total',
    			'value'   => 5,
    			'compare' => '>',
    		),
    	),
    );
    $query = new WP_Query( $args );

    Edit: Looks like we posted at exactly the same time. Hope this info is helpful though in case anyone finds this in the future!

    Thread Starter taadike

    (@taadike)

    Cool, thanks! That helps.
    Just one question – if a post is “liked” is it equal to a “share”? both raise the total count by equal value?

    Plugin Author Ben Cole

    (@bcole808)

    I do believe that on Facebook they count all of these, and they all raise the total count by one:

    • Sharing a URL (by copy/pasting the URL onto a timeline or by clicking a “Share” button)
    • Clicking “Like” on that URL that has been shared
    • Posting a comment on the URL that has been shared
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘query most shared posts’ is closed to new replies.