Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author WebCodin

    (@webcodin)

    Hi Tynermeister,

    We are sorry for delay with the answer.

    We strongly recommend do not change plugin code directly in the plugin folder, because you can loose your changes after the plugin update to a new version.

    Regarding to your question about the placeholders, currently plugin functionality do not allow to add placeholders to form fields. We will add this functionality for future updates.

    But, we have added possibility to add placeholders via specific filter directly in function.php in your theme.

    To use this filter you will need:
    1) Update plugin to the latest version (v2.1.1)
    2) Add to function.php in your theme following code:

    add_filter( 'wcp_contact_form_get_fields_settings', 'tm6830_my_placeholders' );
        function tm6830_my_placeholders ($data) {
            foreach ($data as &$item) {
                switch ($item['name']) {
                    case 'My Field':
                        $item['atts']['placeholder'] = 'My Placeholder';
                        break;
                    case 'My Field 2':
                        $item['atts']['placeholder'] = 'My Placeholder 2';
                        break;
                    //...
                    default:
                        break;
                }
            }
            return $data;
        }

    Where,
    ‘My Field’, ‘My Field 2’,… – values of the “Name” field from the settings table for which we want to add placeholders;
    ‘My Placeholder’, ‘My Placeholder 2’, … – corresponding placeholders values.

    Please let us know, if this information help you.

    Plugin Author WebCodin

    (@webcodin)

    Hi Tynermeister,

    We resolved this issue. If you have other questions you can reopen this thread.

    Thread Starter Tynermeister

    (@tynermeister)

    Thanks for everything WebCodin,

    Should that have made it so it adds in placeholders automatically? Because the input boxes are still blank, unfortunately.

    I’m terrible with PHP so I’m afraid I’m going to need to ask for your help one more time on what more I need to modify?

    Plugin Author WebCodin

    (@webcodin)

    Hi Tynermeister,

    As mentioned in the previous post, current plugin functionality basically do not support placeholders. We will add this in future releases.

    As temporary solution for developers purposes we added some hook as described above that should be added in functions.php file of your theme.
    This code allows you to manually add placeholders for form fields that configured in admin panel.

    For example, if you have a form with fields: Name, Email, Message, you will need to add following code in the functions.php:

    add_filter( 'wcp_contact_form_get_fields_settings', 'tm6830_my_placeholders' );
        function tm6830_my_placeholders ($data) {
            foreach ($data as &$item) {
                switch ($item['name']) {
                    case 'Name':
                        $item['atts']['placeholder'] = 'Name Placeholder Text';
                        break;
                    case 'Email':
                        $item['atts']['placeholder'] = 'Email Placeholder Text';
                        break;
                    case 'Message':
                        $item['atts']['placeholder'] = 'Message Placeholder Text';
                        break;
                    default:
                        break;
                }
            }
            return $data;
        }

    Please let us know if this is help.

    Thread Starter Tynermeister

    (@tynermeister)

    Thank you so much, that make so much more sense to me now!

    Everything is working perfectly!

    Thank you again, and sorry for causing you hassle! ??

    Plugin Author WebCodin

    (@webcodin)

    Hi Tynermeister,

    It is not a problem.
    Thank you for using our plugin!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Placeholders’ is closed to new replies.