Author Topic: PHP Error in Wordpress  (Read 404 times)

0 Members and 1 Guest are viewing this topic.

Offline dnelsaltyTopic starter

  • Irregular
  • Posts: 4
    • View Profile
PHP Error in Wordpress
« on: March 12, 2010, 09:21:53 PM »
Here is the Link: http://dnelsalty.com/wordpress/wordpress/?page_id=6

Here is the Line containing Error: $pages = ceil($total_posts/$posts_per_page);

Can someone please tell me what is wrong with this? Thanks!

Offline Rustywolf

  • Enthusiast
  • Posts: 72
    • View Profile
Re: PHP Error in Wordpress
« Reply #1 on: March 12, 2010, 09:30:12 PM »
It means that one of the variables has no value (aka 0)

So id check that there isnt any errors gathering data

Offline dnelsaltyTopic starter

  • Irregular
  • Posts: 4
    • View Profile
Re: PHP Error in Wordpress
« Reply #2 on: March 12, 2010, 09:49:07 PM »
What do you mean? It is a brand new site. Considering the only variables I see there are based on post count... So if I make a post or get someone to make a post it should work fine? Or what?

Offline thorpe

  • Administrator
  • 'Mind Boggling!'
  • *
  • Posts: 29,255
    • View Profile
Re: PHP Error in Wordpress
« Reply #3 on: March 12, 2010, 09:52:02 PM »
0 cannot be divided by 0, its that simple. I would be taking a look at the code within pagination.php on line 13.

Offline dnelsaltyTopic starter

  • Irregular
  • Posts: 4
    • View Profile
Re: PHP Error in Wordpress
« Reply #4 on: March 12, 2010, 10:00:47 PM »
I did. Like is said... Here it is again

Code: [Select]
$pages = ceil($total_posts/$posts_per_page);

Offline thorpe

  • Administrator
  • 'Mind Boggling!'
  • *
  • Posts: 29,255
    • View Profile
Re: PHP Error in Wordpress
« Reply #5 on: March 12, 2010, 10:33:21 PM »
You'll need to ensure that $posts_per_page is not zero.
« Last Edit: March 12, 2010, 10:33:52 PM by thorpe »

Offline dnelsaltyTopic starter

  • Irregular
  • Posts: 4
    • View Profile
Re: PHP Error in Wordpress
« Reply #6 on: March 12, 2010, 10:34:33 PM »
Where can I find that and correct it?

Offline thorpe

  • Administrator
  • 'Mind Boggling!'
  • *
  • Posts: 29,255
    • View Profile
Re: PHP Error in Wordpress
« Reply #7 on: March 12, 2010, 10:36:40 PM »
I have no idea, but you could do it quite simply just prior to attempting to divide by it.


if ($posts_per_page == 0) {
  
$posts_per_page 1;
}
$pages ceil($total_posts/$posts_per_page);