How do I make every page/post show only unique articles?

Posted in: Newsmag
Post count: 30

How do I set the site default to only show unique articles on all pages/posts? For example, I have a post which shows that same post in the sidebar widget as well as the footer widget, while the user is on the post.

Post count: 6600

Hi,

Add this code:

global $post;
if (is_singular()){
$args['post__not_in'] = array( $post->ID );
}

..to the td_data_source.php file, like this: http://screencast.com/t/K8DVFT2LCb
This should exclude the current post from block queries on post pages and on pages you can use the unique articles feature: http://screencast.com/t/tfK8gAnhxQ

Thanks

Post count: 30

Thanks, but I do not see td_data_source.php in either Newsmag or Newspaper themes. Where is it located?

Post count: 6600

Hi,

Navigate to themes files into your wp files and follow this path: http://screencast.com/t/2vU35MpmS7 ..\wp-content\themes\Newsmag\includes\wp_booster\td_data_source.php
Let me know how it goes!

Thanks

Post count: 30

That worked for posts, but then it broke the unique articles on other pages such as the home page so I had to remove the code.

Post count: 6600

Hi,

That code is set to apply just on single post pages so I’m not sure how it affected the homepage or other pages. You could try it like this:

global $post;
if (is_single()){
$args['post__not_in'] = array( $post->ID );
}

Thanks

Post count: 30

That fixed the home page problem, but it didn’t work. The footer still shows the same posts as the side bar.

Post count: 6600

Hi danoah,

I have pointed that this applies and affects just single post pages so I’m not sure why you refer to your homepage, for pages we have the unique articles feature: http://screencast.com/t/tfK8gAnhxQ

Please also provide your site’s URL so I can access it and point me to a page on which I can see this behavior.

Thanks!

Post count: 30

Hello, here is an example. You will see in the sidebar block, it has the same post as one of the blocks in the footer.

http://www.danoah.com/2015/08/and-that-son-is-why-we-dont-do-drugs.html

Home page issue was resolved.

I have implemented the code above as you said.

Post count: 6600

Hi,

I see now that you were referring to sidebar posts not the current post viewed: http://screencast.com/t/LCKhnjfHl8T
Unfortunately other than taking advantage of those specific blocks filters and control the queries made there to avoid duplication you can’t control this on post pages. Sorry!

Sorry for the inconvenience!
Thanks for the message!

Post count: 30

Thanks. For future updates, it would be very helpful to have a sitewide unique articles setting in the theme panel for posts and pages.

Post count: 6600

Hi,

Thanks! we will consider this for future updates.

Thanks for the message!

Post count: 73

Hi Lucian and Tagdiv-Team! …

I have to agree with danoah. My magazine is growing fine and it becomes quite complex right now. A sidewide system for unique articles would be more than awesome!

For example:

You are reading the newest article of our magazine. On the sidebar there are widgets like “newest articles” – most favourite within the last 7 days … and so on … Sometimes one article is shown up to three times within the “single.php” (including sidebars and footer widgets) …

And this does not look like a professional magazine, then … 😉

As you know – I just love your theme! But this is really a MUST HAVE feature for a magazine and online-newspaper.

So please, it really would be awesome, if the tagdiv team could find a quick solution for this! 🙂

Warmest regards,
Torsten

Post count: 6600

Hi Torsten,

Thank you for your suggestion I understand your support on this. We will consider this, currently is on our requests list but we will review this and decide on it soon.

Thanks for the message!

Post count: 73

Hi Lucian,

thank you for your feedback! 🙂

The theme continuously grows up from premium to deluxe. 😉

Best regards
Torsten

Post count: 8

Hello, mai I ask how can i do it on the current latest version? (different from screencast you shared). Thanks in advance

Viewing 16 posts - 1 through 16 (of 16 total)
You must be logged in to reply to this topic.