Set up a shortcode with a dynamic variable in category.php
-
Hi,
I am trying to create a new category template that will show the post by using a third-party post plugin (WP News and scrolling widget pro).
I almost get it to work by inserting ‘<?php echo do_shortcode( ‘[sp_news design=”design-19″ limit=”16″ grid=”4″ pagination=”true” category=”category-id show_full_content=”false” show_date=”false” show_content=”true” show_category_name=”true” content_words_limit=”30″ show_read_more=”true” content_tail=”…” order=”DESC” orderby=”post_date” link_target=”blank” image_height=”250″]’ );?>’
However, I want category to show the ID of the currently open category. Can someone please explain how to do this?
-
To be clear: category is equal to nothing at the current moment (category= ), thus showing every element within the plugin.
-
It sounds like you are working with a self-hosted WordPress site as it’s not possible to edit the template files on WordPress.com
Check out the self-hosted WordPress (also known as WordPress.org) support forum at https://wordpress.org/support/ and you should find some help and resources there.
To learn more about the difference between WordPress.com and WordPress.org (self-hosted), take a look at http://en.support.wordpress.com/com-vs-org/
- The topic ‘Set up a shortcode with a dynamic variable in category.php’ is closed to new replies.