Support » Plugin: Booking Calendar » Give select field a class

  • Resolved mediafishcanarias

    (@mediafishcanarias)


    Hi,

    I want to give the select field a class such as: class=”uk-select”

    Now:
    <select name=”active_booking_form” etc……</select>

    Should be:

    <select name=”active_booking_form” class=”uk-select” etc….</select>

    Can you tell me where I could do that?

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 17 total)
  • Plugin Author wpdevelop

    (@wpdevelop)

    Hello.
    You will be need to make this customization.
    Please open this file ../wp-content/plugins/{Booking Calendar Folder}/inc/_ps/personal.php

    ( you can check how to edit files in WordPress menu in this article https://wpbookingcalendar.com/faq/how-edit-file-in-wp-menu/ )

    then find this code:

    
           $booking_select_form .= '<select name="active_booking_form" onchange="jQuery(\'.bk_forms\').css(\'display\', \'none\');';
    

    and replace it to this code:

    
           $booking_select_form .= '<select name="uk-select" name="active_booking_form" onchange="jQuery(\'.bk_forms\').css(\'display\', \'none\');';
    

    Disclaimer. Unfortunately we can not start, right now, some personal customization or custom development, because almost have no free time.
    Check more about new features here https://wpbookingcalendar.com/faq/need-new-feature/
    Thank you for understanding.
    Please note, if you will modify the source code of the Booking Calendar, we will not guaranteed the correct work of plugin and do not support it.

    P.S. Please note this forum is only about the support of Booking Calendar Free version, so if you will have any questions about the paid versions, please contact here https://wpbookingcalendar.com/contact/

    Kind Regards.

    Thread Starter mediafishcanarias

    (@mediafishcanarias)

    Thanks,

    Stupid question is there a way in WP to make those overrides update safe?

    Sorry new to WP and cant find a way to do it…

    Plugin Author wpdevelop

    (@wpdevelop)

    Hello.
    If you will make that customization (from my previous reply), you will be need to make such fix each time, after update of plugin. Because during update process all files of plugin are replacing to new files.
    Kind Regards.

    Thread Starter mediafishcanarias

    (@mediafishcanarias)

    Hello,

    So in WP it is impossible to make update safe overrides? Is there no special folder within WP such as in Joomla for example you can store your overrides?

    Plugin Author wpdevelop

    (@wpdevelop)

    Hello.
    The problem with that fix, that it’s no the new function or some CSS that can be exist in new files, but changes apply to exist source code. So it’s does not possible to update it in safe mode.
    Kind Regards.

    Thread Starter mediafishcanarias

    (@mediafishcanarias)

    Thanks,

    But… why has your plugin no layouts file such as for example:

    /wp-content/plugins/booking.bm.Version/templates/layouts/xyz.php

    If you had that we could copy this xyz.php file and go to our theme:
    wp-content/themes/our-theme/ and create a folder booking.bm.Version and inside this folder create folder layouts.

    And paste the copied xyz.php file here and edit to our requirements.
    This file would override the plugin’s file. And we could update your plugin and keep our template changes.

    Isn’t that possible in your plugin or at least planned for the future?

    Plugin Author wpdevelop

    (@wpdevelop)

    Currently its does not possible.
    I will add to the TODO list for having some HOOK in that code, for overriding such functionality in external files, like in functions.php file of your theme.
    Kind Regards.

    Thread Starter mediafishcanarias

    (@mediafishcanarias)

    Would be a very logic thing as otherwise I cannot work with your Plugin as how should I look after 50+ pages with layout overrides and on updating plugins always check one by one… so in other Plugins I have seen and all other Joomla sites I manage I can do the following – I go to:

    /wp-content/plugins/MyPlugin/templates/layouts/FileToChange.php

    Copy FileToChange.php > go to my theme:

    wp-content/themes/MY-theme/ and create a folder MyPlugin and inside this folder create folder layouts.
    wp-content/themes/MY-theme/MyPlugin/layouts

    Inside the layout folder I can paste the copied FileToChange.php file and edit it to my requirements.

    This file would override the plugin’s FileToChange.php file.

    And I could update MyPlugin and keep the template changes without… that is how I think a plugin should work 🙂

    Plugin Author wpdevelop

    (@wpdevelop)

    In WordPress if you need to override some functionality you need to use hooks functionality, which add or modify exist values in some codes. Its do not the full file replacements.
    Please check more here https://developer.wordpress.org/plugins/hooks/custom-hooks/
    Kind Regards.

    Thread Starter mediafishcanarias

    (@mediafishcanarias)

    Thanks but are you sure? I don’t think that is needed I need to change the layout and not the functionality.

    Anyway we change our theme to YoothemePro and using your plugin looks like on this page: http://dev.lanzarotebike.de/buchung/ do you see how the dropdown looks?

    It should not look like that..and also the following parts of your plugin should look the same as in your theme – how do I achieve that? I would need to change the whole css of your plugin – or is there an easier way? There would be if I could simply change the classes of your layout files to the yootheme pro uikit classes – imagine how long it takes to override all css and make classes plus hover classes…. or what do you suggest? How do people deal with that?

    I just know how to deal with it in other plugins tha I can make overrides the way I explained above.

    Please let me know.

    Plugin Author wpdevelop

    (@wpdevelop)

    Hello.
    Why you can not use CSS for that drop-down configuration like this:

    
    select[name="active_booking_form"]{
      padding: 5px 10px;
    }
    

    And then add this CSS to your theme css file. for example to the bottom of this file: http://dev.lanzarotebike.de/wp-content/themes/yootheme/css/theme.1.css

    Thread Starter mediafishcanarias

    (@mediafishcanarias)

    Hello,

    Because I need to have it styled the same way as the theme is styled.

    And also your plugin uses complete different colors padding etc than the theme and our logo…

    btw the changes would go to a custom.css as otherwise the changes would be overwritten when updating the theme 😉

    But what are others do if they must adapt the corporate design of their company to your plugin?

    Plugin Author wpdevelop

    (@wpdevelop)

    Basically in the paid versions of Booking Calendar, possible to use any CSS classes in the booking form. Only this selectbox element for booking resource selection outside of the booking form configuration, that’s why there not possible to add such custom CSS class.

    So for having solution in future updates of plugin.
    You can replace this code (in this file ../wp-content/plugins/{Booking Calendar Folder}/inc/_ps/personal.php ):

    
           $booking_select_form .= '<select name="active_booking_form" onchange="jQuery(\'.bk_forms\').css(\'display\', \'none\');';
    

    to this code:

    
           //FixIn: 8.6.1.9
           $resource_selection_class = "active_booking_form";
           $resource_selection_class = apply_filters('wpbc_booking_resources_selection_class', $resource_selection_class );
           $booking_select_form .= '<select name="active_booking_form" class="'.$resource_selection_class.'" onchange="jQuery(\'.bk_forms\').css(\'display\', \'none\');';
    

    And then add this code in your functions.php file in your theme.

    
    function my_wpbc_booking_resources_selection_class( $resource_selection_class ) {
    	return 'uk-select';
    }
    add_filter( 'wpbc_booking_resources_selection_class', 'my_wpbc_booking_resources_selection_class', 10, 1 );
    

    This fix will be exist in next update of Booking Calendar, so you will no need to change it.
    Kind Regards.

    Thread Starter mediafishcanarias

    (@mediafishcanarias)

    So you are saying in the paid version I can change all classes and save it

    And when updating it those changes will be kept?

    And I do not have to do it again?

    Plugin Author wpdevelop

    (@wpdevelop)

    Configuration of form fields at the Booking > Settings > Form page of course will be safe during updates.
    Please use shortcode generator at the right side of the Booking > Settings > Form page for the fast and correct creation of booking form fields.
    Watch it in this video guide https://wpbookingcalendar.com/help/booking-form-fields-settings-video-tutorial/
    Kind Regards.

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘Give select field a class’ is closed to new replies.