wdpv_popular template tag modification

I need to display post excerpt along with the post title when “wdpv_popular” template tag is used. How do I modify the core plugin files? i tired changing the process_popular_code function like this(class_wdpv_codec.php), but its not working:

function process_popular_code ($args) {
$args = extract(shortcode_atts(array(
'limit' => 5,
'network' => false,
), $args));

$model = new Wdpv_Model;
$posts = $network ? $model->get_popular_on_network($limit) : $model->get_popular_on_current_site($limit);

$ret = '';
if (is_array($posts)) {
$ret .= '<div class="wdpv_popular_posts ' . ($network ? 'wdpv_network_popular' : '') . '">';
foreach ($posts as $post) {
if ($network) {
$data = get_blog_post($post['blog_id'], $post['post_id']);
if (!$data) continue;
}
$title = $network ? $data->post_title : $post['post_title'];
$author = $network ? $data->get_the_author($post['blog_id'], $post['post_id']) : get_the_author($post['ID']);
$authorurl =$network ? $data->bp_core_get_user_domain( $author): bp_core_get_user_domain( $author);
$permalink = $network ? get_blog_permalink($post['blog_id'], $post['post_id']) : get_permalink($post['ID']);
$thumb = $network ? $data->get_the_post_thumbnail($post['blog_id'], 'thumbnail') : get_the_post_thumbnail($post['ID'], 'thumbnail');
$excp = $network ? $data->get_the_excerpt($post['blog_id']) : get_the_excerpt($post['ID']);

$ret .= "<div class='work type-work'>" ."<div class='imgwrap'><a href='{$permalink}'>{$thumb}</a><div class='post_meta'><div class='block_comm'><div class='comments'><a>".
sprintf(__('<span class="wdpv_vote_count">%s votes</span>', 'wdpv'), $post['total']) ."</a></div></div></div></div><div class='fh_cat_content'><a class='fh_feat_tt' href='{$permalink}'>{$title}</a></div><div class='author'>by <a href='{$authorurl}'>{$author}</a></div>{$excp}
</div>";
}
$ret .= '</div>';
}

return $ret;
}

Any help from the developer will be appreciated.

  • Timothy
    • Chief Pigeon

    Hey again.

    Perhaps I don’t fully understand your goal here?

    Are you looking to change the location of the voting options?

    Perhaps our shortcodes could be used for this:

    [wpmdv_vote]

    You can find those shortcodes and functions in the admin settings:

    wp-admin/options-general.php?page=wdpv

    Admin –> Settings –> Post Voting

    Take care.

  • towfiqi
    • Flash Drive

    I am trying to display the post excerpt of top voted pots. you see, when you use the template tag “wdpv_popular” it only shows the post titles, and the vote count. I want to it show the post excerpt too.

    Please notify the plugin developer. it won’t take him a minute to solve this.

  • Timothy
    • Chief Pigeon

    Hey again.

    Please notify the plugin developer. it won’t take him a minute to solve this.

    The developer is rather busy at the moment working on various projects. :slight_smile:

    I can help though, it will only take me two minutes as well.

    This will get you the excerpt:

    $excerpt = $network ? $data->post_excerpt : $post['post_excerpt'];

    You will then want to echo it out and style it as you please:

    $ret .= "<li>" .
    "<a href='{$permalink}'>{$title}</a> " .
    sprintf(__('<span class="wdpv_vote_count">(%s votes)</span>', 'wdpv'), $post['total']) .
    "{$excerpt}</li>";

    You will format that.

    Take care.

  • towfiqi
    • Flash Drive

    Thanks for the reply…. Still isn’t working. I also tried this, as you can see on my customized code above:

    $excp = $network ? $data->get_the_excerpt($post['blog_id'], $post['post_id']) : get_the_excerpt($post['ID']);

    didn’t work

  • Timothy
    • Chief Pigeon

    Odd, I just tried it and its fine for me.

    http://monkies.cowpat.net/popular-page/

    Thats my sandbox website, where I play about and test things.

    The code in my example above is the code you see pulling the excerpt on my page now.

    if (is_array($posts)) {
    $ret .= '<ul class="wdpv_popular_posts ' . ($network ? 'wdpv_network_popular' : '') . '">';
    foreach ($posts as $post) {
    if ($network) {
    $data = get_blog_post($post['blog_id'], $post['post_id']);
    if (!$data) continue;
    }
    $title = $network ? $data->post_title : $post['post_title'];
    $excerpt = $network ? $data->post_excerpt : $post['post_excerpt'];
    $permalink = $network ? get_blog_permalink($post['blog_id'], $post['post_id']) : get_permalink($post['ID']);
    $ret .= "<li>" .
    "<a href='{$permalink}'>{$title}</a> " .
    sprintf(__('<span class="wdpv_vote_count">(%s votes)</span>', 'wdpv'), $post['total']) .
    "{$excerpt}</li>";
    }
    $ret .= '</ul>';
    }

    return $ret;

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.