Hi!
I’m using Similar posts by category. I’ve got categories and subcategories and i’d like Similar posts to show posts using category, not subcategory.
Now if i have the only one post in subcategory, i have no similar posts despite i have a lot of posts in the main category.
Is there any ways to make it work?
Hi,
I have tested this and works fine. For the case you described I believe you have the post set like this: http://screencast.com/t/If3wUeklRE and just a single post in that subcategory. In that case it’s supposed not to work fine because it dose not have any posts to display as this is set to return posts based on the categories in which that posts is and exclude the current post so if you have only that post it supposed to display nothing. You need to set the main category to that post also in order to return posts from that category as similar posts: http://screencast.com/t/luaGsidpr6Z
Thanks
Yes, i added the post only in subcategory like on your screenshot http://screencast.com/t/If3wUeklRE
The thing is if i add it like you show it here http://screencast.com/t/luaGsidpr6Z
in my URL i can see only category name. I need it to be like /category/subcategory/subcategory/post’s name.html
Hi,
You can use this custom permalink structure: http://screencast.com/t/hjBw90o3z2y and if you set your categories like this: http://screencast.com/t/7AjiHluTFqXr you will get this result: http://screencast.com/t/AO9xAwijTmg which is what you want.
You can read more about this here: http://codex.wordpress.org/Using_Permalinks
Thanks
Thank you!
I’m using this structure /%category%/%postname%.html and having this problem. If i check only subcategory i have the full url with category and subcategory, but if i check category and subcategory together i have only category in url…it’s weird
But i guess it’s not a theme problem..
Hi!
One more issue/question about this feature.
I’m using Similar posts by category and on each post of category i can see only 2 last posts from this category. So if i have no new posts in category or there is no for some time on every post of category always will be the same 2 posts.
Could you tell me how can i change it and show in Similar articles, for instance, 1 previous and 1 next post for each article? Maybe it’s just me, but it seems it used to work this way before..
Hi,
I’m not sure how you could get there one previous/old published post, what you can do though is to add this 'orderby'=>'rand' argument to the query to pull random posts each time so that the related posts change every time the page is loaded, add it like this: http://screencast.com/t/5VVxsmgM3NkQ
You can check here for another way to achieve this by adding other arguments to the similar posts query: http://codex.wordpress.org/Class_Reference/WP_Query
Thanks
Maybe i just confused it with the next-previous post feature.
I added this code, but it’s just changed 2 posts which are shown. Related posts don’t change every time the page is loaded, it’s always the same 2 posts..
Ook, thank you, finally i found a solution how to make it work, needed to add 2 more lines of code
