Show views instead of comments on post blurbs (in blocks)

Posted in: Newspaper
Post count: 19

This is my site http://www.moodlenews.com.

Whenever we have a block, or a category listing of our posts, there is a callout that shows the number of comments. Is there a way to have this display the number of post views instead (the views are visible when you click on the full post).

Thanks!

Post count: 22421

Hello,
The theme wasn’t designed to display the post views on modules but you can achieve that adding this code http://pastebin.com/JdFgK89X in td_module.php like here: http://screencast.com/t/BjVvJT9m Then you need to edit the module you want the views displayed on
get_modules_views();?>
And add the code in one of these files replacing the get_comments code: http://screencast.com/t/HdSVmjPFqE0z
It will require further css positioning on some blocks.
I hope this helps.
Thank you!

Post count: 19

Thank you Bogdan. I’ve been able to insert the code and have the post views appear in the blocks.

Any chance you (or anyone else) would help me in the same way to fix/configure the CSS? Right now the views are appearing on the far left of the thumbnail and I’d love to them to be in the same spot as the comments used to be.

Thanks!

Post count: 7909

Hi,

I guess that you did not applied this on your live site, so I cannot customize this on your site.
Please check Marius solution from this topic, he also provided a css code and it should work – https://forum.tagdiv.com/topic/view-numbers-in-block/

Thanks!

Post count: 19

Thank you Alin!

I’ve been working on this on a development machine, so that is why it is not on our live site. I’ve been able to implement the code and CSS and it looks good.

However, the comment balloon/icon appears differently on the blocks and on a post page. I would like to have the same icon combination (the eye and balloon) found at the top of a post page, if possible.

Could you, or someone else at tadDiv, be able to provide help with this? Thanks!

Post count: 22421

Hello,
The 2 comment views were designed different for the modules and posts. You can have the same design if you wish but you will need to edit the function for the comments on modules here: http://screencast.com/t/cXBzuFUGMTHp and if you want the same comments design as the ones on posts, you can copy the get comments function from td_module_single_base
Thank you!

Post count: 19

Hi Bogdan –

Thanks for the information about how to implement, but I am a bit confused about which bits of code go where.

Could you please re-iterate your explanation about:

1) which code I copy to have the same comment design as on the post and
2) where I place it in the blocks I want to use

Thanks!

Post count: 22421

Hi,

If you want to have comments show up on your modules and have the same design to them as on posts, you need to replace this function: http://screencast.com/t/QEk6UMFZ4lv
with this one:

 function get_comments() {
        $buffy = '';
        if (td_util::get_option('tds_p_show_comments') != 'hide') {
            $buffy .= '<div class="td-module-comments">';
                $buffy .= '<a href="' . get_comments_link($this->post->ID) . '"><i class="td-icon-comments"></i>';
                    $buffy .= get_comments_number($this->post->ID);
                $buffy .= '</a>';
            $buffy .= '</div>';
        }

        return $buffy;
    }

Then you need to use this custom css:

.td-module-comments a{
color:black!important;
background-color:white!important;
}
.td-module-comments a:after{
display:none!important
}

This will be the result: http://screencast.com/t/arnMILyO
This will apply to all the modules as they all use the same function to get comments.
Hope this helps.
Thanks.

Viewing 8 posts - 1 through 8 (of 8 total)
The forum ‘Newspaper’ is closed to new topics and replies.