Widget links
-
Hello,
The widget to show posts i liked seems to have some problem, they all points the same post. In fact, i have extracted a piece of code from prezentacja.php to use in another place inside my sidebar, this part:
// outputs the content of the widget if ( is_user_logged_in() ) { global $kkLikeSettings; $current_user = wp_get_current_user(); $i = 5; extract(array($this, $args)); $title = apply_filters('widget_title', $instance['title']); $items = esc_attr($instance['items']); $like = new kkDataBase; $posts = $like->getInformation($items,$current_user->ID); echo $before_widget; echo $before_title; echo $title; echo $after_title; if($posts){ echo '<ul class="kklike-widget kklike-most-liked">'; foreach($posts as $post){ if($i == '1'){$cls = 'kklike-big-heart'; } else if($i == '2' || $i == '3'){$cls = 'kklike-small-heart'; } else{$cls = 'kklike-big-heart'; } ?> <li><span class="<?php echo $cls; ?>"></span> <span class="kklike-wg-text"> <span class="kklike-wg-title"> <a href="<?php echo get_permalink($post['ID']); ?>"><?php echo $post['post_name']; ?></a> </span> <span class="kklike-wg-rating"> <?php echo __('Você e outros','lang-kklike'); ?> <?php echo $post['liked']; ?> </span> <span class="kklike-wg-date"> <?php echo __('Desde:','lang-kklike'); ?> <?php echo date('d-m-Y', strtotime($post['date'])); ?> </span> </span> <span class="kkclear"></span> </li> <?php $i++; } echo '</ul>'; } else{ echo '<div class="kklike-empty-list">' . __('Do not have favorite items.','lang-kklike') . '</div>'; } echo $after_widget; }
“echo get_permalink($post[‘ID’]);” maybe it’s not working properly, any other way to do this?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Widget links’ is closed to new replies.