Show only Posts in Jetpack Top Posts & Pages Widget

By Kishan on January 11th, 2013
jetpack

Yesterday I published a new page on my Events website which was visited a lot. This page became one of the top visited pages on the website. The problem is that I have activated the WordPress Jetpack Top posts & pages widget. Now my page starts showing in the list. This should not happen and there’s no option to select the posts only. Even Google couldn’t give me the solution.

That’s where I started to search for the file where the widget is located. It’s in the wp-content plugins folder: jetpack>modules>widgets>top-posts.php. After analyzing this file I concluded that the solution was very simple. All you need to do is find this line:

And replace it with this:

That’s it! It’s very simple and you can even built it as an option. So you can choose if you want to show both pages and posts or only posts.

A Jetpack plug-in author stated that maybe this will be implemented in the next update. Unfortunately I could not wait till the next update, so I had to fix it.

* UPDATE: Even after the latest Jetpack 2.2 update this fix is still needed.

Was this helpful for you? Let me now in the comments!

Wat u nu kunt doen?

Huur mij in

Wilt u een website hebben of wilt u een social media strategie ontwikkelen voor uw bedrijf of product? Neem contact op met mij. Ook als u geen tijd heeft om uw website te onderhouden kunt u het aan mij vragen.

Reageer

Is er iets onduidelijk? Of wilt u uw mening geven? Is er iets wat ik verkeerd gezegd heb? Laat een reactie achter

12 Comments

Posted By: José Luís On: February 05, 2013 At: 3:00 pm

Great tip!

Do you have any news on this matter?

After the last Jetpack update (2.1.2) is this fix still needed?

Thanks!

Posted By: Alexander Ebel On: February 14, 2013 At: 10:11 am

Thanks!

Posted By: Kishan On: February 15, 2013 At: 8:54 pm

Yes, this fix is still needed.

Posted By: Mark Roth On: February 24, 2013 At: 4:39 pm

I just implemented it. Thank you!

Posted By: krishnaTORQUE On: February 26, 2013 At: 12:17 pm

i did but it is not showing only post. it’s showing both but i want to show only post. if you can then please add extra code for show comment and viewers counter
thanks

Posted By: Kishan On: March 06, 2013 At: 7:08 pm

Even with version 2.2 this fix is still needed.

Posted By: Cassidy On: March 19, 2013 At: 11:21 pm

Thank you so much! This fix was extremely helpful!

Posted By: joseph On: May 01, 2013 At: 4:19 pm

thanks for crashing my site with this change. Had to go back in through my file manager in order to reset. such a great idea…

Posted By: Lyricsguru On: May 12, 2013 At: 9:26 am

Thanks Kishan, thank you so much.

The contact us page on my site, was displayed in the top posts lists widgets, and with your simple code, it’s now no more listed in the that widget.

:)

Posted By: DanDan On: May 14, 2013 At: 4:51 am

You sir, are a genius.

Posted By: James Gentes On: May 30, 2013 At: 5:47 pm

Thanks for this.. much appreciated.

Posted By: Kishan On: June 20, 2013 At: 5:22 am

I just saw your website & services. Quite interesting

Reageer