Tagged: x
-
AuthorPosts
-
December 1, 2016 at 3:34 pm #1277950
JfantasyBooksParticipantHey there, Themeco Team!
Name: JFantasyBooks
Site: Fantasy-Books
Site Url: https://fantasy-books.live
WordPress Version: 4.6.1
X Version: 4.6.4
Cornerstone Plugin Version: 1.3.3Problem:
Ok! So, I have a shortcode that appears on everypage as I used the php do shortcode.
Is there a way to make it selective to only posts under a particular category?
December 1, 2016 at 6:53 pm #1278195
FriechModeratorHi There,
Thanks for writing in! You can use the is_category function.
e.g.
<?php if(is_category( 'category-slug' )): ?> /*your do_shortcode here*/ <?php endif; ?>Where
category-slugis the actual slug of your category or the category ID.Hope it helps, Cheers!
December 1, 2016 at 8:28 pm #1278283
JfantasyBooksParticipantSo I have this:
function somefu <?php if(is_category( 'category-slug' )): ?> <div class="x-nav-1"> <?php echo do_shortcode('[shortcode]');?> </div> <?php endif; ?> }But it’s still not appearing. Did I do something wrong? It appears without it the category function, but not with it.
December 1, 2016 at 10:30 pm #1278379
RupokMemberHi there,
Make sure to replace
category-slugwith your real category slug, it should work. Make sure other code is also correct; like I am not sure aboutfunction somefuThanks!
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1277950 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
