Plugin Author
Guido
(@guido07111975)
Hi,
It should be possible to list posts by tag, please check info on plugin page:
Post tags
Besides categories you can also list native post tags: [knowledgebase taxonomy="post_tag"]
Update: I now understand what you want to accomplish..
Did you already try to add both taxonomies?
[knowledgebase taxonomy="category, post_tag"]
(not tested, yet)
And together with the include
and exclude
attribute.
Guido
Thread Starter
lizwoo
(@lizwoo)
Hi there,
Thank you so much for getting back to me so quickly! I had tried both taxonomies originally, but didn’t structure it correctly. So, thank you for modeling the correct structure.
I just tried your suggestion
[knowledgebase taxonomy=”category, post_tag”]
but it doesn’t render anything on the page.
Thanks again for your help!
Liz
Plugin Author
Guido
(@guido07111975)
Hi Liz,
Too bad. I have to create a test environment for this, so I will keep you informed.
Guido
Plugin Author
Guido
(@guido07111975)
Hi again,
Are you able to tweak your VSKB plugin?
1) Open file “vskb-list” and look for string:
foreach( $vskb_posts AS $single_post ) :
Add this underneath:
$posttags = get_the_tags($single_post->ID);
if ($posttags) {
$tags = array();
foreach($posttags as $tag) {
$tags[] = $tag->slug;
$the_tags = join( " ", $tags );
}
} else {
$the_tags = '';
}
2) Look for this string:
$return .= '<li class="vskb-post-name">';
Change into:
$return .= '<li class="vskb-post-name '.$the_tags.'">';
Now the post tags are being added to the CSS class of your knowledgebase posts.
3) Hide the posts of certain tags on the category page, by using custom CSS.
Example: if you want to hide the 3 tags “Sierra, Alma, Millenium” on category page “Cataloging”, look for the ID of that page (for example 156) and add this at the CSS page in Customizer:
.page-id-156 li.sierra, .page-id-156 li.alma, .page-id-156 li.millenium {display:none;}
Now all posts with those 3 tags are hidden on that page. Repeat that for the other category pages.
No, this is not a very clean fix but it does work just fine 😉
I might add this or something similar in a future update as well..
Guido
Plugin Author
Guido
(@guido07111975)
Liz,
I’ve updated plugin few moments ago. Just update it and you only need to do step 3 mentioned in my previous reply. So hide the posts of the relevant tags by using custom CSS.
Guido
Thread Starter
lizwoo
(@lizwoo)
Hi Guido,
Wow, this is great! Thank you for making that fix and for updating the plugin. I was able to make the irrelevant posts disappear pretty easily. A blank category heading still stays, but I think I can just eyeball those and get rid of that with the exclude functionality you have already built into the plugin.
One last question – if I have a post that is in more than one category/tag – which takes precedent? Inclusion or Exclusion
For example: If I build this code into a page where I intend to list by category all the posts with tag “A”, but one of my posts is tagged for both “A” AND “B”, will the code remove out ALL posts that have the tag of B, regardless of if the “A” tag is also selected?
Thank you again for all the help you have been. I’ve spent a lot of time trying to make this work and your plugin has been amazing!
Liz
Plugin Author
Guido
(@guido07111975)
Hi Liz,
If I understand correctly, you needed all categories at all pages, but you wanted to hide posts that contained certain tags, depending on the page?
If a post contains 2 tags (for example siera and alma), and you’ve already hidden the first tag (sierra) on the relevant page, you could still display the post via this tweak:
.page-id-156 li.sierra {display:none;}
.page-id-156 li.alma {display:block;}
Guido
Thread Starter
lizwoo
(@lizwoo)
Hi Guido,
That does the trick! Thank you so much for both your help and your quick responses. I am very excited to get this up and going!
Thanks again,
Liz
Plugin Author
Guido
(@guido07111975)
Hi Liz,
Great to hear! And you’re very welcome 🙂
Guido