WordPress.org

Ready to get started?Download WordPress

Forums

Image Widget
Custom Classes (6 posts)

  1. jedifunk
    Member
    Posted 2 years ago #

    First off... Love this plugin! I've been using it for about 6 months now, and its become one of the plugins I install at the beginning of any new project.

    On my latest project, I've run into a situation where I need different images to function differently.

    Specifically, I'd like to like the images to video's hosted at Vimeo, but play in a Fancybox. I use Fancybox for WordPress to handle images, but have to do a custom JS call that looks for the class of .vimeo to get a vimeo link to display in Fancybox.

    What I would love to see is a Custom Class input box in the admin area of the Image Widget. This way I could selectively apply the .vimeo class to only those images that I need to play a video in Fancybox.

    I looked at making a custom template, but I'm unsure of how to write the if/then statement to look for links to vimeo....

    so again, I was hoping that it might be easy enough to add a dialog box to write my own custom classes.

    Any help is greatly appreciated. Thanks.

    http://wordpress.org/extend/plugins/image-widget/

  2. Peter Chester
    Modern Tribe
    Plugin Author

    Posted 2 years ago #

    I've been thinking about the possibility of launching a premium line of image-widget extensions for that sort of thing. In the interim (as it may take a while), you can override the admin template, the widget template and add a filter to save the added data. The template override filter basically exists to let you have that level of customization if your comfortable with the coding.

    I believe the filters are:

    'sp_template_image-widget_widget.php' for the widget display on the website.
    'sp_template_image-widget_widget-admin.php' for the widget admin ui.

    You can copy the widget.php and widget-admin.php files from the plugin /views/ folder into your theme and then add filters in yout functions file to point to the files in your theme. By doing this you get all of the image-widget core functionality but you can control the details of the form input and the rendering.

  3. ryansigg
    Member
    Posted 2 years ago #

    I second this notion...

    In the meantime I'll try out those filters...

  4. jedifunk
    Member
    Posted 2 years ago #

    @ryansigg did you have any luck with the custom filters? i haven't given them a go yet, but plan to soon.

  5. jedifunk
    Member
    Posted 2 years ago #

    just wanted to report back on my modifications.

    i have successfully added a custom class field to the plugin, and all works as expected. i would explain how here, but it's a bit long winded.

    i looked to see if this plugin was on github but did not find it. i am more than happy to share how i did it if anyone is interested.

    i would still like to see this added to the plugin itself so that i don't have to modify it each time i want to use it.

    please let me know the best way to go about getting the code to someone. thanks.

  6. m.lan
    Member
    Posted 2 years ago #

    hi,
    I use the Plugin: "image-widget" with the plugin custom-widget-classes

    know I can choose in every widget a diffrent class :-)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic