Home › Forums › Calendar Products › Community Events › Pre-selecting a category on the community submission form
- This topic has 3 replies, 2 voices, and was last updated 11 years ago by
George.
-
AuthorPosts
-
April 14, 2015 at 2:53 am #955307
Tony
ParticipantHi,
How can I pre-select a category on the community events submission form?
April 14, 2015 at 6:21 am #955355George
ParticipantHey Tony!
What you’re seeking to do here is definitely possible – the explanation I’m about to give may seem a little long, but trust me, it’s much simpler than it seems:
• First, head to our official Themer’s Guide to learn how to make custom template files for various parts of the Events Calendar → https://theeventscalendar.com/knowledgebase/themers-guide/
That should just help give you an idea of what’s going on here, but the shortcut is that you need to create /tribe-events/commmunity/modules/taxonomy.php in your theme or child theme.
Once this empty file is created in your theme, fill it with the exact same contents of the original file in your copy of Community Events – in the plugin, the path to the file is /views/commmunity/modules/taxonomy.php
Just copy that whole original file into the new version of it in your theme.
Once this is done and works, head to the your WordPress site admin and find the page where all the Event Categories are listed – then, simply hover your mouse over the category you want to be selected by default on the Community submission form, and look for a number called “tag_ID” in the URL that shows when you’re hovering over the tag link. Here’s a screenshot where I point this out for reference (in it, I am hovering over the category “Cabbage”) → https://cloudup.com/cwfs-COJGrY
Once you have the tag_ID, head back to your theme version of that file you copied over from the plugin, which should be at /tribe-events/commmunity/modules/taxonomy.php. Make some space before the events categories are shown and add code like the following:
$currently_selected_category_ids[] = 190;Replace “190” with the ID you want – if you want multiple IDs selected by default, just add another line, so if I wanted tag_ID of 190 192 to be added, I’d make the code look like this:
$currently_selected_category_ids[] = 190; $currently_selected_category_ids[] = 192;I only did one ID for testing purposes, and it works very well for me → https://cloudup.com/crEjx-RhOz1
I also put my code in a Gist for you to reference, check that out here: https://gist.github.com/ggwicz/7a61a291d15fa2876c4a#file-taxonomy-php-L30
But please note that some of my code might be different in that file than yours, so don’t copy and paste that whole file – just use the original file from your copy of Community Events, but look at line 30 of the Gist I shared here for an idea of where to place the code I mentioned above.
I told you this might seem like a lot of information! 🙂 But work on it step by step, and I’m sure you’ll be able to put this together Tony, it’s quite simple, just a bit of a tedious thing in parts to move everything in place.
Let us know if this helps!
Cheers,
George-
This reply was modified 10 years, 6 months ago by
George.
April 14, 2015 at 6:44 am #955366Tony
ParticipantThat’s perfect, thank you.
April 14, 2015 at 7:41 am #955413George
ParticipantAwesome! I’ll close up this ticket for now, but if other issues or questions arise, come back and open a new ticket at any time!
Cheers,
George -
This reply was modified 10 years, 6 months ago by
-
AuthorPosts
- The topic ‘Pre-selecting a category on the community submission form’ is closed to new replies.
