Plugin Author
Guido
(@guido07111975)
Hi,
I do not list the categories for a reason, because if you click the category link (URL) all events will be displayed without meta (date, location, etc) and without my style (CSS). This happens because theme template file archive.php is used for that.
That’s why I recommend using this (example) shortcode if you want to display events from certain categories:
[vsel event_cat="first-category, second-category"]
With some coding it’s possible to list the categories on the event page, but it’s not wise to make them link to the relevant category page.
Guido
Hi,
Thanks for the quick reply.
I already notice in your FAQ and other related post here that you don’t show the category on purpose. However, on the topic link in my post, you mention a way to list the category without the link.
I am really interested in such solution. Doing something like:
Title
-------------------------------------------
Category: Theatre, Music | BlaBla
Date: XX |
Time: XX |
without any link on “theatre” or “Music”, just showing them.
Is it possible ? I tried to do something like that in vsel-shortcodes.php
$event_cat = get_the_category(get_the_ID())
and use it in vsel-list.php, without success. It simply displays “Array”.
If you have any idea on how to achieve it…
Thanks again for this great plugin π
Plugin Author
Guido
(@guido07111975)
Hi,
No, it’s not that simple because “event” is a custom post type. So you should do more to list categories of a custom post type. Will look into this later, kind of busy right now..
Guido
Plugin Author
Guido
(@guido07111975)
Hi again,
I’ve tried to find a solution to list them properly but because of the way how to return content (in file vsel-single.php) I wasn’t able to find a way to list them without link (URL). Maybe another user has a solution.
I have this for you:
$vsel_cats = '<p class="vsel-meta-cats">'.get_the_term_list( $postid, 'event_cat', 'Categories: ', ', ' ).'</p>';
And add this in the string that begins with $content and just before $startdate:
$vsel_cats .
Guido
Ok, thank you very much!
I did a hack using css to disabled links:
.vsel-meta-cats a {
pointer-events: none;
}
I will look further into it and come back.
Thanks again! Your plugin is very nice and you are *very* reactive!
—————————
EDIT:
I found it! We can use the strip_tags function (https://wordpress.stackexchange.com/questions/8284/get-the-term-list-without-links-in-3-1).
In vsel-shortcode.php, I added after each $event_summary = ...
$vsel_cats = strip_tags( get_the_term_list( get_the_ID(), 'event_cat', '', ', ' ));
and then in vsel-list.php I add just before the date related stuff:
if ( !empty($vsel_cats) ) {
$output .= '<p class="vsel-meta-cats">';
$output .= sprintf('Categories: <span>'.$vsel_cats.'</span>');
$output .= '</p>';
}
and it works π
-
This reply was modified 8 years, 8 months ago by
GwendalD.
-
This reply was modified 8 years, 8 months ago by
GwendalD.
Plugin Author
Guido
(@guido07111975)
Nice fix! Never thought of using strip_tags for this π
Guido
Plugin Author
Guido
(@guido07111975)
Hi,
Have found a better way to add event category to CSS class, please check this response in another thread.
Guido