Home › Forums › Calendar Products › Filter Bar › Custom title for custom filter
- This topic has 6 replies, 2 voices, and was last updated 6 years, 8 months ago by ite.
-
AuthorPosts
-
June 21, 2017 at 4:21 am #1300954iteParticipant
Hey,
I’ve followed this article to add two custom filters to my filter bar.
However, I am trying to achieve a look similar to the image attached, where the filters are all select’s, and the default value, which today is hard coded as “Select”:
Line 201 in Filter.php:
<option value="" <?php selected( trim( $current_value ), '' ) ?>><?php esc_html_e( 'Select', 'tribe-events-filter-view' ); ?></option>
What I want is the possibility to replace this “Select”-value with the heading for the filter instead. How can I achieve this?
June 22, 2017 at 1:49 am #1301576iteParticipantHey!
I found a solution – you can override the
public function displayFilter()
in the custom filter to change the look and feel of a filter. Using the Filter.php’spublic function displayFilter()
as a template, I was able to create something similar to the screenshot.June 22, 2017 at 4:33 am #1301614CliffMemberHi, ite. Thanks for sharing that you found your solution.
Did you accidentally paste the same thing twice, or are you saying you extended the class and overrode the displayFilter method?
Did you find any errors or shortcomings in that knowledgebase article? If so, we’d love to fix it.
Or, if you have suggestions for how to improve the core plugin’s code, please let me know that.
Thank you!
June 22, 2017 at 4:40 am #1301617iteParticipantHi Cliff,
I was expecting the code blocks to work similar to how they work on StackOverflow, so that’s why it looks funky – there really isn’t any shortcomings, but I wish the knowledgebase included information on how to customise everything about the filters, such as how they’re displayed! I had to peek around the code to find the correct function to override in the sub-class, but I managed 🙂
June 23, 2017 at 3:42 pm #1302629CliffMemberGotcha.
Feel free to suggest specific edits you’d recommend to help other developers, too.
If not, no worries.
Please note that threads get Closed automatically after a couple weeks of inactivity. If it does get Closed, please open a new thread, adding your current problem description and also linking back to this thread.
Thank you!
July 15, 2017 at 9:35 am #1321739Support DroidKeymasterHey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.
Thanks so much!
The Events Calendar Support Team -
AuthorPosts
- The topic ‘Custom title for custom filter’ is closed to new replies.