Home » Topics » Feature Requests » Specify widget ID or Class

Specify widget ID or Class

ACF Widgets Support Feature Requests Specify widget ID or Class

Tagged: 

This topic contains 10 replies, has 3 voices, and was last updated by  Daron Spence 4 years, 5 months ago.

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #478

    Jason Rosewell
    Participant

    Would be cool to see a custom widget ID or Class option when adding/editing a new widget, instead of having this generated for you:

    <div id="acf_widget_30418-2" class="widget Acf_Widget_30418">

    Cheers.

    #479

    Daron Spence
    Keymaster

    This is a good idea. I was privately emailing with one of the beta testers about something like this. Definitely a possibility. I’ll look into it for sure.

    What about just using the widget slug as a classname? Or would user defined classes/id’s be more useful?

    #480

    Jason Rosewell
    Participant

    Yeah, I’m definitely going to use what’s available for now, but my anal self wants more control over the selectors!

    For example, in the above code snippet, that widget div is preceded by:

    <div id="mc_newslettersignup" class="widget widget_mc_newslettersignup">

    I’d love to give the widget generated by your plugin its own custom ID or class. Of course it isn’t necessary for it to work; just a nice perk, and my CSS will make more sense to me.

    #481

    Daron Spence
    Keymaster

    Ok. I’ll see what I can do. Hopefully I can work on it later tonight.

    #745

    Daron Spence
    Keymaster

    Hey Jason, just wanted to note, that until you activate your copy of ACFW you won’t see any updates. I highly recommend activating it!

    #746

    Jason Rosewell
    Participant

    Hey Daron – thanks for the heads up. After working on this for several hours, my client decided they didn’t like their idea for this widget so it’s now on the shelf. 😐 I got paid, but it’s still a bummer. Thanks for all your help – I’ll implement this again the first chance I get.

    #747

    Daron Spence
    Keymaster

    Ah. All good! Save it then! I may send out a couple preliminary emails about updates for the first few until I can implement something more like ACF that notifies users that their version is outdated even before they activate their license.

    #928

    bpartch
    Participant

    Couldn’t you add a class field to the widget then just wrap it in a div in the widgets template file?

    <div class="<?php $class = get_field('class', $acfw); echo $class; ?>">
      <h3><?php $title = get_field('title', $acfw); echo $title; ?></h3>
      <p><?php $description = get_field('description', $acfw); echo $description; ?></p>
      <img src="<?php $image = get_field('image', $acfw); echo $image['url']; ?>" width="100%" alt="" />
    </div>
    • This reply was modified 4 years, 8 months ago by  bpartch. Reason: add more text
    #929

    Daron Spence
    Keymaster

    You could, but then you have to specify if for each new instance of that widget. Not efficient if the client has to enter that stuff and they mispell the class or change it.

    #931

    bpartch
    Participant

    ^^ hadn’t thought of that, i vote my response down. 😛

    #1891

    Daron Spence
    Keymaster

    If either of you is watching this, I just did a major refactor for how widgets are formed in v1.4

    This will make adding this feature a piece of cake (more so than before).

    If you got any other ideas, let me know!

Viewing 11 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic.