Description of Category

Home Forums Calendar Products Community Events Description of Category

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1131883
    Rhonda
    Participant

    I had a request to include a long description of the category before the events begin listing. I tried inputting the information in the category description but it does not show up on the category list. Is there any way to do this.

    #1132344
    Geoff
    Member

    Hi Rhonda, and hope you had a great weekend!

    Good question. None of the templates display the category description by default, but that can certainly be added.

    You can add something like this to your theme’s functions.php file and it will display the description:

    if( tribe_is_event_query() && is_tax() ) {
    echo term_description( 'tribe_events_cat' )
    }

    Will this work for you? Please let me know. 🙂

    Cheers,
    Geoff

    #1132383
    Rhonda
    Participant

    I must have added the above code to the wrong section of my website. When I added it to the functions.php under Appearance > Editor > Theme Functions (functions.php) it took the website down. After restoring from a back up, I looked for a functions.php under The Events Calendar plugin, but did not see one.

    Thanks so much for your help.

    Rhonda

    #1132467
    Geoff
    Member

    Hi Rhonda,

    Oh shoot, it appears I led you down a wrong path — I get the same error and should have tested my answer more thoroughly before sharing it. Sorry about that!

    On a second look, it appears the cleanest way to get the category description is to add it directly to the template. Our Themer’s Guide provides steps for customizing calendar templates, but it basically boils down to this:

    • Make a copy of the template. In this case, let’s add this to the list/content.php template which is located at wp-content/plugins/the-events-calendar/src/views/list/content.php
    • Make a new folder in your theme called tribe-events
    • Make a new folder in that one called list
    • Drop the copied content.php file in that last folder

    Now that the template is in your theme, it can be customized to suit your needs. In this case, add the following where you would like the category description to display:

    <?php if( is_tax() ) {
    echo term_description( get_queried_object_id(), 'tribe_events_cat' );
    }?>

    I tested that out and it does seem to do the trick. Please let m know if it works for you as well. 🙂

    Cheers!
    Geoff

    #1138700
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Description of Category’ is closed to new replies.