Archived topic
shortcode + wp show post problem
29 replies · Started by francesco on February 16, 2022
I would like the related news to be related to the type of category. the programmer who gave me this code (..... settings="taxonomy-category&tax_term=current"]) does not answer me, so I ask you if you can help me understand. he entered this piece of code, but it doesn't seem to work. can it be fixed? or should I create two element with different shortcodes for the categories?

Hi there,
what does not work ? Does it display any posts ?
hi David, basically it should display articles by category. Which does not happen.
I understand that - what is it doing? Does it show any posts ? Or nothing at all?
the posts show them yes, but not by category.
Hi francesco,
That specific shortcode works by getting the current taxonomy set on the WPSP list and then gets the current taxonomy terms of the specific post: https://github.com/tomusborne/wp-show-posts/blob/1ff2257b0e8f5b899dd5f682979733cc36bb48ea/wp-show-posts.php#L230
Can you share the Post tab settings of WPSP list 1152?
If the post tab setting is invalid or if the current post has multiple terms then that would be an issue.
I suggest using an alternative so you can have more control on how it works.
Something like the suggestion on this thread - https://generatepress.com/forums/topic/radom-post-suggestion-of-the-same-category-on-sidebar-widget/#post-1938956
Hi Elvin, you mean this?

Try the alternative method that Elvin provided here:
hi David, in the post there is no mention of widgets in the sidebar? I would just like to change the settings of wp show post so that it makes the articles appear according to the type of category.
You add the PHP Snippet to your site.
How to add PHP: https://docs.generatepress.com/article/adding-php/
Then you can add this shortcode anywhere in your site:
[dynamic_wpsp id="1234"]
where id="1234" is the ID if the WPSP list.
thanx work.
Glad to hear that!
Sorry David, I finally solved it by simply removing (amp;) from the code. but if i may ask, is there any way to increase the space between columns? maybe some css?

Can you try increase the columns gutter in the WPSP list setting?
https://www.screencast.com/t/APaJXsbr
the problem is that it only increases the space on the side.
