Advanced Most Recent Posts Code Hacks
TheAdvanced Most Recent Posts plugin, was reviewed back in April and I have been using it on this site ever since. Although it has worked & done exactly what is says on the box, there were one or two issues that I was not jumping through hoops over !
Now some 3 months later it would seem that quite a few of our readers are not jumping through hoops either
Damn did I make an error of judgement when picking this particular plugin..?
No! panic not my friends, this is a great plugin even if there are one or two issues with the coding so what I intend to do in this article, is to show you how to hack the code so that you have a new improved version of the Advanced Most Recent Posts Plugin.
Ok lets first take a look at the original code, or to be more precise, the two areas requiring modifying.
The first code hack is to prevent the plugin from listing the last article written in whichever category. Usually the last article written is already showing on the page, so not much point in listing it in the sidebar!
Original code plus modified code

All that is required is to edit the php file that is the code sheet for the plugin, find the relevant piece of code and amend as instructed in the image.
Note: Please deactivate the plugin prior to editing or modifying the code!
The original 2 lines of code shown below can be located at the bottom of the page, they are responsible for collecting together all the correct information to make up an entry to be listed. Now if you check the code below, you can see the width & height variables, but there is no alt tag being used at all (bad news eh) ! Another issue that many readers complained about whilst using the Advanced Most Recent Posts plugin, was the fact that if the title was fairly short, the excerpt would follow along on the same line as the title (very ugly indeed).
Code Sheet Image 2

The simplest of amendments can make a huge difference to the output of this plugin. Simply edit the code above to match the code shown below, the two red dots are there only to highlight the relevant code hacks. The alt amendment uses the post title as the alt text & as most titles are rich in keywords, this works just fine, the second amendment simply forces a line break after the title has been output & this causes the excerpt to now be put on a new line, leaving the title on the line above it !
Code Sheet Image 3

This final amendment achieves exactly the same as the previous one, but the difference is it uses a h3 tag to wrap the title and whilst this will also force the excerpt onto a new line, it also gives some slight SEO benefit through the use of the h3 title tag (see image below).
Code Sheet Image 4

The Results After Hacking The Code:
I have used SEO-Xray to highlight the heading tags in this image.
We can clearly see that the heading tags are working just fine, as they were set to h3 in the code sheet.

This final image now shows what the amended code is producing, a nice 48 x 48px thumbnail, the title as a h3 heading and then a 100 character excerpt !
Excellent !!!
That is all there is to it my friends, but please remember to de-activate the plugin before attempting to hack the code. I would also advise that you take a backup copy of the Advanced Most Recent Posts code sheet before you make any changes, then at least you can turn the clock back if you make any errors.
No related posts.














Nice tips!
I was wondering thought, if I could also display the post’s date and time… Is there any hack for that?