How to introduce Permalinks into pop-u-lar widget?
I am using the pop-u-lar widget on my blog, which is linking to the selected posts by their "guid"s. However, the site itself is using human-readable links instead and I want the widget to do the same.
The widget uses a "for each" loop with the variable $post, so I thought get_the_permalink($post) would do the job, but it seems the refer to the site url instead. Basically it is about this line of code:
a href="?php echo $post-guid ?"?php echo $post-post_title ?/a
Where is the knot in my reasoning?
Here is the widget code:
ol class="f"
?php
$rows = (isset($instance['num_of_posts']))?$instance['num_of_posts']:3;
$ptype = (isset($instance['ptype_select']))?$instance['ptype_select']:'any';
$pop_tax = (isset($instance['pop_tax']))?$instance['pop_tax']:'';
$pop_tax_val = (isset($instance['pop_tax_val']))?$instance['pop_tax_val']:'';
if(false !== ($posts = get_transient($this-id))){
}else{
switch ($instance['select_by']) {
case 'views':
$posts = yg_popular::yg_getPopularPosts($rows,$instance['dur_select'],$ptype,$pop_tax,$pop_tax_val);
break;
case 'comments':
$posts = yg_popular::yg_getPopularPostsComments($rows,$ptype,$instance['dur_select'],$pop_tax,$pop_tax_val);
break;
case 'tags':
$posts = yg_popular::yg_getPopularPostsTags($rows,$ptype);
break;
case 'most recent':
$posts = yg_popular::yg_getPopularPosts($rows,'recent',$ptype,$pop_tax,$pop_tax_val);
break;
default:
$posts = yg_popular::yg_getPopularPosts($rows,false,$instance['dur_select'],$ptype,$pop_tax,$pop_tax_val);
break;
}
$cacheDur = yg_popular::yg_getCacheDuration();
if($cacheDur!=0)
set_transient($this-id,$posts, $cacheDur * 60);
}
foreach ($posts as $post){
?
li class="l"
a href="?php echo $post-guid ?"?php echo $post-post_title ?/a
/li class="l"
?php
}
?
/ol