how to show post views on modules?

Posted in: Newsmag
Post count: 7

How do I get the post views to show on the homepage modules?
I switch on the (SHOW POST VIEWS) option but it only show on the single post page,
I would like it to show in the modules like (COMMENT COUNT, DATE and AUTHOR NAME)

Post count: 7909

Hi,

Please check your module files and see maybe comments,date and author are commented: http://screencast.com/t/5AannU4OB

Thanks!

Post count: 7

Comment, date and author works fine

My issue is with the POST VIEWS, it does not show on modules

I want it to show on modules

Post count: 9544

Try copying the post views code from one of the post page templates into your module template.

Post count: 7

Thought about it but was unable to locate that code

Post count: 9544

Well, there is finite number of files in your theme folder root?

Maybe look at one of the “single” files for the single post, which is how WordPress refers to posts.

Perhaps … loop-single.php ?

Note the section

                <div class="meta-info">

                    <?php echo $td_mod_single->get_author();?>
                    <?php echo $td_mod_single->get_date(false);?>
                    <?php echo $td_mod_single->get_views();?>
                    <?php echo $td_mod_single->get_comments();?>
                </div>

then perhaps, in the /includes/modules/ folder …

say, maybe you’re using td_module_5.php

note the section
<div class="meta-info">
<?php echo $this->get_author();?>
<?php echo $this->get_date();?>
<?php echo $this->get_comments();?>
</div>

Great to go “exploring” in the files, as it’s pretty simple to change some basic stuff by locating the stuff based on logical naming structure.

Hope that helps 🙂

  • This reply was modified 11 years by simchris.
Post count: 7

Tried this and it didn’t work, also adding that line of code prevented the module from render properly

<div class=”meta-info”>
<?php echo $this->get_author();?>
<?php echo $this->get_date();?>
<?php echo $this->get_views();?>
</div>

Post count: 9544

TagDiv support will need to help on this one 🙂

Post count: 7909

Hi,

Sorry for misunderstanding! Please try Lucian’s solution from here: https://forum.tagdiv.com/topic/comment-and-post-view-count/#post-31049
I also tested and it works fine: http://screencast.com/t/3VHg24u59

Thanks!

Post count: 7

Thank you

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