Unique posts in sidebar on post page?

Posted in: Newspaper
Post count: 13

We run a news site and it is very common practice on news sites to have a sidebar on articles pages with featured articles, etc. The problem is, I can’t filter those featured posts to exclude the current post being viewed. I would be surprised if a theme designed for news sites does not have an option available for this.

Is there no way to have the sidebar on a post page exclude the current post? It looks ridiculous displaying the same article being read in the sidebar.

Post count: 9544

Theme doesn’t support that apparently. Most don’t as the module cannot check to see which story the module is being loaded on — would be huge hit on the dbase to query that for every page load. Lots of news sites default to this behavior under “latest stories…”

Post count: 27

Hi,

I just wanted to see if an option for this has since become available, where a sidebar displaying other articles can filter out the article currently being viewed?

Post count: 20688

Hi,

This will be implemented in the theme in a future update. I could give you a solution if this is required, in the meantime. Paste this code
https://pastebin.com/bM8MaNXR
In this file here – https://www.screencast.com/t/2Js2sDc5P6cQ

Thanks

Post count: 27

Thanks for that.

Are you please able to tell me how to get to the page in the screenshot?

Post count: 20688

Hi,

The modification will have to be made in the mentioned file, in the theme folder. Usually this requires FTP access to the WordPress install on the server
http://www.wpbeginner.com/beginners-guide/how-to-use-ftp-to-upload-files-to-wordpress-for-beginners/
The file has to be edited and the lines of code added as shown in order for this to work.

Thanks

Viewing 6 posts - 1 through 6 (of 6 total)
The forum ‘Newspaper’ is closed to new topics and replies.