add files
This commit is contained in:
19
popularnode-amp.php
Normal file
19
popularnode-amp.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/*
|
||||
Template Name: Popular node
|
||||
*/
|
||||
|
||||
$count = (int)get_option('popularnode_count');
|
||||
$count = $count+1;
|
||||
update_option('popularnode_count', $count);
|
||||
|
||||
$posts = array_slice(json_decode(get_option('ppp_options')), 0, 10);
|
||||
$rates = array();
|
||||
|
||||
foreach ($posts as $item){
|
||||
$rate = 100 * $item->rate/array_sum(array_map(function($obj){return $obj->rate;}, $posts));
|
||||
$rates[$item->id] = $rate;
|
||||
}
|
||||
|
||||
wp_redirect(get_permalink(chance($rates)).'/amp/', 301);
|
||||
exit;
|
||||
Reference in New Issue
Block a user