March 2, 2015 at 5:25 PM #1898
Hi – how do I add a title / title field to a widget?
For instance: I have created a widget called Featured Books, and successfully dragged it into my sidebar, filled out the associated custom fields, and have them successfully displaying on the front end of my site. I now go back and add another instance of the Featured Books widget in the same sidebar. Looking at those widgets in the Appearance > Widgets control panel page, I can’t tell them apart without opening them up because neither has its own title – they’re both just called Featured Books.
I’m afraid my clients will have half a dozen of these in each sidebar, and it’ll be a pain to locate the ones they want to edit. Also, they’re already familiar with widget titles, so it’d be convenient to use the default WP functionality/interface for that.
So – can I add in a ‘title’ field so I can distinguish between the widgets in the control panel – and use that on the front-end too while we’re at it? A filter for this would be fine if you don’t want to hard-code it in for everyone. ?? (I got a dev license but don’t have access to the Priority forum yet which is why I’m posting here. )
Thanks for the great plugin and your help!March 2, 2015 at 6:53 PM #1900
Hi Michelle, I recently rewrote a bunch of stuff for v1.4 so this could be a much easier task than it would have been in the current release!
As to your questions, you can already add a field called “title” and use it on your site. Just add another one in the ACF field group. However, that obviously won’t work as expected. Now that can be resolved, however, I imagine that it will be an opt-in feature for a few releases and then will become defacto. Since all of the current users don’t have titles, I will have to provide some backwards comparability support for that… sorry, just typing out loud here.
Also, your priority support license is supposed to activate when you log in to the site, so imagine it never logged you out from when you purchased it the first time. Regardless, I’ve fixed that for you 🙂
If you want, open an issue on GitHub and I’ll keep working on it. If you’re interested, I’m also looking for beta testers! I’ll be sending out an email either later today or tomorrow regarding that tidbit and reminding everyone about GitHub.March 2, 2015 at 8:54 PM #1901
Here is a link to download the current develop branch with this feature in it.
You’ll need to add a filter in your
functions.phpto show the titles.
add_filter('show_acfw_titles', '__return_true');March 3, 2015 at 9:07 AM #1931
Wow, thank you! that was so quick – and it works perfectly. I tested with a few different widgets, put a bunch o’ single-and-double quotes in the title, saved, moved in and out of inactive/active widget areas, all good.
Thank you!! I’ll be happy to beta test, and I’m sure I’ll be using this a ton for my clients.March 3, 2015 at 1:19 PM #1932
Glad it worked out for you! Did all of your existing field values carry over? That’s my biggest concern. I really did rework the entire widget creation/registration process so I want to make sure I don’t break anything moving forward with the update.March 3, 2015 at 1:30 PM #1933
Didn’t see any issues with the field data carrying over and didn’t need to edit my display code at all. I had a few regular fields and a few nesting repeaters / relationship queries going and they all worked fine. 🙂March 3, 2015 at 5:51 PM #1934
Oooh that sounds fun. Mind sharing some gists? 🙂March 3, 2015 at 6:00 PM #1935
Sure, here ya go: https://gist.github.com/FriendlyWP/86cff5341dca045219e3March 3, 2015 at 6:06 PM #1936
Awesome stuff! Funny to see someone actually using “books” for these types of things. Sometimes those tutorials are right on the money! 🙂
I’m marking this thread as closed. If you have any more questions, you can open a new topic or reply to this one if it’s the same issue.
Thanks for supporting the plugin! I really appreciate it 🙂 Be sure to spread the word! 😀
- The topic ‘Widget Titles / multiple instances of widget’ is closed to new replies.