Re: Missing close div causes html to break
-
I’m sorry to bring this issue back up again, but the previous topic was closed without a decent fix and I think there might be others with the same problem and this topic actually provides a working and decent fix. Perhaps the plugin author can also implement this fix?
First of all, thanks to the plugin author for creating and developing this wonderful plugin.
It’s a really wonderful plugin and with this tiny fix, it will be perfect!First let me explain the exact problem:
When the list of last viewed items has reached the limit that you can set in the settings (Number of posts to show, for example 5), it can break your website layout. The reason for this is, is that when the limit is reached – in my case 5 – the closing ul and closing div are missing. This is not the case as long as the limit hasn’t been reached.Why are this closing ul and closing div missing?
Because there is a tiny mistake in the php code of the plugin. A big big big thank you to my husband who helped me fix this problem.Go to the plugin folder posts-viewed-recently, open the php file recent_viewed_posts.php
Go to line 164, there you will find this:if($count >= $number) return;
This is the faulty line: when the condition is met, the line 214
<?php if($count > 0) echo '</ul>'. $after_widget; ?>
doesn’t get executed anymore, resulting in not displaying both closing ul and closing div tags (which is in the variable $after_widget).
Here’s the fix:
replace line 164, so this line:
if($count >= $number) return;
With this:
if($count >= $number){ if($count > 0){ echo '</ul>'.$after_widget; } return; }
This solved my problem entirely. So if you’re having this problem, please try this fix!
- The topic ‘Re: Missing close div causes html to break’ is closed to new replies.