Category Tag keeps colon when label is removed

Home Forums Calendar Products Events Calendar PRO Category Tag keeps colon when label is removed

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #720016
    rdall
    Participant

    I wanted to show the events category without the label. With some searching I found that if I use:
    ‘label’ => ”,
    instead of:
    ‘label’ => null,
    in the
    tribe_get_event_categories array I can show you the category without the label. Seen here: https://gist.github.com/codearachnid/4113903 But I still get the : the comes after the label.

    I found after some searching of the plugin source code that in the
    public/template-tags/general on line 270 the you are put the : colon in and when I removed that : the tribe_get_event_categories only show the category.

    I don’t want to hack the plugin to remove this colon so I was wondering if their was another workaround / filter / function or template tag that will allow me just to call the event category without anything preceding it.

    #720039
    rdall
    Participant

    Here is a screenshot with the tribe_get_event_categories applied without the label: http://cl.ly/image/413p1j2S0R1a

    #720495
    Barry
    Member

    Hi – great question!

    That definitely seems like something of a bug to me. If you provide an empty string as the label then ideally we wouldn’t see the colon (and I’ll log a bug report to ensure we address it). In the meantime, though perhaps a little cumbersome, perhaps you could workaround this as follows:

    1. Set up a template override. Full details can be found in our Themer’s Guide, but essentially you would copy views/modules/meta/details.php from the plugin directory to your-theme/tribe-events/modules/meta/details.php and make these changes in there.

    2. Locate this piece of code within your theme’s copy of the above template:

    echo tribe_get_event_categories( get_the_id(),array(
    	'before' => '',
    	'sep' => ', ',
    	'after' => '',
    	'label' => null, // An appropriate plural/singular label will be provided
    	'label_before' => '<dt>',
    	'label_after' => '</dt>',
    	'wrap_before' => '<dd class="tribe-events-event-categories">',
    	'wrap_after' => '</dd>'
    ) );

    3. Change this to:

    echo str_replace( ':', '', tribe_get_event_categories( get_the_id(),array(
    	'before' => '',
    	'sep' => ', ',
    	'after' => '',
    	'label' => '',
    	'label_before' => '',
    	'label_after' => '',
    	'wrap_before' => '<dd class="tribe-events-event-categories">',
    	'wrap_after' => '</dd>'
    ) ) );

    Not the very most elegant solution – but it might suffice as a workaround until we can get this addressed.

    Does that help?

    #720566
    rdall
    Participant

    Hi Barry
    Thanks for the help. The str_replace did the trick. Still learning about PHP. I already have a template override setup and was calling the category array in a different location. But your override works out just the same.

    Thanks for the help!

    #722966
    Barry
    Member

    My pleasure, glad it works for you 🙂

    What I’ll do at this point is close out the thread – but this seems like a valid bug and I have also linked it to our internal issue tracker so, as soon as we have some progress to report on the fix (realistically that may be a couple of releases away at this point) we’ll do our best to re-open this and let you know what’s happening.

    That apart, if you have a moment to spare we’d love to hear your thoughts on The Events Calendar across on our plugin review page – it’s always great to hear our users’ thoughts on the plugin and what sort of experience they’ve been having. Thanks again!

    #769047
    Leah
    Member

    Hi there,

    Thanks for bringing this issue to our attention. We weren’t able to get to it for our upcoming 3.8 release, but it is still very much on the radar. We hope to have it fixed in an upcoming release, and we will do our best to keep you posted on our progress. Thanks for your patience and support!

    Best,
    Leah
    and the team at Modern Tribe

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Category Tag keeps colon when label is removed’ is closed to new replies.