开发者 | sambrishes |
---|---|
更新时间 | 2016年12月15日 09:35 |
PHP版本: | 4.0 及以上 |
WordPress版本: | 4.7 |
版权: | X11 / MIT License |
版权网址: | 版权信息 |
dexs-counter
folder to your /wp-content/plugins/
directoryYou can use the dexs counter environment easily within your own WordPress theme. This is useful, if
you want to adapt the dexs counter design seamless to your theme. Please Note: You should always
check, if the respective function exists with the php function_exists(function_name)
method!
Get one of the four view counter numbers for the respective post.
Parameters
get_the_ID()
WordPress function within a loop."total"
returns all registered clicks. (Default)"daily"
returns all registered clicks for the current day."unique"
returns all unique clicks (one click / user)."daily_unique"
returns all unique clicks (one click / user) for the current day.Checks if the current user has already clicked on the respective post. Parameters
get_the_ID()
WordPress function within a loop.Get the rating data for the respective post. Parameters
get_the_ID()
WordPress function within a loop.array("like" => [int])
array("like" => [int], "dislike" => [int])
array("1" => [int], "2" => [int], "3" => [int])
array("1" => [int], "2" => [int], "3" => [int], "4" => [int], "5" => [int])
Checks if the current user has already rated yet and returns perhaps his rating value. Parameters
get_the_ID()
WordPress function within a loop.false
checks only if the user has already rated. (Default)true
checks if the user has already rated and returns the rate value.($value == false):
Returns true if the user has already rated yet or false if not or if the $post_id is invalid.
Note: Returns NULL if the current user is within an excluded role!
($value == true):
Returns the respective rating value as string or an empty string if the current user hasn't
rated yet. Note: Returns false if the $post_id is invalid and NULL if the current user is
within an excluded role
Parameters Creates one or more rating links with an WordPress nonce. Example: http://www.example.com/post_permalink/?dexs-nonce=nonce&dexs=rating_value
get_the_ID()
WordPress function within a loop.NULL
all rating values, depending on the rating layout. (Default)*value*
checks if the user has already rated and returns the rate value.($value == NULL):
Returns all rating links as array or *false on failure. Note: The array keys are the
respective rating values, depending on the rating layout setting!
($value == value):
Returns the respective rating link as string or false on failure. Note: Returns also false
if the given value doesn't match to the rating layout setting!
You can use the following settings to change the post order, of your costum WP_Query requests, depending to view counter OR rating counter. Note: You may return an empty post list, if you use the daily or daily_unique counter and if nobody has viewed a single post item on the day yet. Note also: The Dexs.Counter plugin doesn't automatically add the counter meta data to all of your posts. So each post that havn't been clicked / rated yet are therefore not considered! `<?php // The Most-Viewed Posts (Total) $query = array( "order" => "DESC", "orderby" => "meta_value_num", "meta_key" => "dexs_views_total" ); $posts = new WP_Query($query); // The Most-Viewed Posts (Unique) $query = array( "order" => "DESC", "orderby" => "meta_value_num", "meta_key" => "dexs_views_unique" ); $posts = new WP_Query($query); // The Most-Viewed Posts (Total / Today) $query = array( "order" => "DESC", "orderby" => "meta_value_num", "meta_key" => "dexs_views_today" ); $posts = new WP_Query($query); // The Most-Viewed Posts (Unique / Today) $query = array( "order" => "DESC", "orderby" => "meta_value_num", "meta_key" => "dexs_views_today_unique" ); $posts = new WP_Query($query); // The Best-Rated Posts $query = array( "order" => "DESC", "orderby" => "meta_value_num", "meta_key" => "dexs_ratings" ); $posts = new WP_Query($query); // The Worst-Rated Posts $query = array( "order" => "ASC", "orderby" => "meta_value_num", "meta_key" => "dexs_ratings" ); $posts = new WP_Query($query); // The Most-Rated Posts $query = array( "order" => "DESC", "orderby" => "meta_value_num", "meta_key" => "dexs_ratings_num" ); $posts = new WP_Query($query); // The Fewest-Rated Posts $query = array( "order" => "ASC", "orderby" => "meta_value_num", "meta_key" => "dexs_ratings_num" ); $posts = new WP_Query($query); ?> `
dexs-counter-verify
option as part of the new "Humanity Test"._ip()
function has hashed the wrong value.