All Good Things Must Come To An End

As you all know, I have been doing WordPress plugins and supporting it for the past 6 years. These 6 years of my life, I have been through my polytechnic education, my national service as well as my university education.

I just graduated from university in December 2009 and have been looking for full-time jobs. I am offered a full-time job and will be starting work on 1st February 2010.

I regret to say that I am NOT ABLE to provide support for my plugins anymore due to my full-time job commitment. I will leave this forum open and let the community help one another.

However, I WILL still update my plugins whenever I can and you still can report bugs to me via email and I will try to fix it.

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - dubsnipe

Pages: [1]
1
WP-PostViews / Re: Custom Total Views
« on: 30 March 2011, 18:42 »
That's what I thought as well, but it returns a 0 since it's the value at the beginning. It's as if the return from the_views cannot be used within operation even if it's a number, or saved into a variable.

I think the problem lies here:

Code: [Select]
$var = the_views();
How can I output the result into a variable? Perhaps there's a little something missing. I have faith that someone will come with the right answer. :)

2
WP-PostViews / Custom Total Views
« on: 09 March 2011, 05:07 »
Hello,

I've been lurkin around and found that the PostViews has already built some custom functions to show totals and most views, but I want to try something different for my site (I'm learning my PHPs so I'm just being curious). I run a blog and I created a custom template to show the last 100 posts along with their view count:

Code: [Select]
<?php query_posts("showposts=100"); ?>
<?php while (have_posts()) : the_post(); ?>
<div class="box">
<a href="<?php the_permalink() ?>" class="title"><?php the_title(); ?></a>
<br/><span class="author">By <?php the_author_posts_link('namefl'); ?></span>
<?php if(function_exists('the_views')) { the_views(); } ?>
</div>

Everything runs nicely. Now, I wanted to try using a summatory of the "the_views()" function, since I figured that this approach would help me get, for example, the total view count in a given time or a category, or whatever I want as long as it's powered by Wordpress' loop. Who knows if it's possible, I just wanted to give it a try, and ended up with something like this:
Code: [Select]
<?php query_posts("showposts=100"); ?>
<?php while (have_posts()) : the_post(); ?>
<div class="box">
<a href="<?php the_permalink() ?>" class="title"><?php the_title(); ?></a>
<?php $var = if(function_exists('the_views')) { $var the_views(); } ?>
<?php $total += $var?>
</div>
  <?php endwhile; ?>
<?php echo $total?>

I'm having a bit of trouble with the $var = the_views(); part, since it didn't work. Is there any way to output the_views() into a variable? I know it's a PHP problem, but I thought that the solution might benefit someone who might be looking for a power use of this plugin. I hope you can help me out, thank you!

Pages: [1]