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

    (@jeherve)

    Jetpack Mechanic ??

    You can use conditional tags to customize the output of the confirmation message depending on the page. Here is an example:

    function jeherve_contact_confirmation() {
    	if ( is_page( '1471' ) ) {
    		$conf = 'special';
    	} else {
    		$conf = 'general';
    	}
    	return $conf;
    }
    add_filter( 'grunion_contact_form_success_message', 'jeherve_contact_confirmation' );

    I hope this helps.

    Thread Starter Versari

    (@versari)

    Can you gently write a full example? What I have to do with this codde?

    Like if the page is id940 and I want to show “Hello World, this is a confirmation message” as confirmation message.

    Have I to put this code in my theme’s functions.php? What I must modify?

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic ??

    Have I to put this code in my theme’s functions.php? What I must modify?

    Yes, you can place that code in your theme’s functions.php file, or in a functionality plugin.

    Here is the full example with the parameters you specified:

    function jeherve_contact_confirmation() {
    	if ( is_page( '940' ) ) {
    		$conf = 'Hello World, this is a confirmation message';
    	}
    	return $conf;
    }
    add_filter( 'grunion_contact_form_success_message', 'jeherve_contact_confirmation' );
    Thread Starter Versari

    (@versari)

    How can I set a custom message for a contact form (your code) and a global for every other form?

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic ??

    You can do it like this:

    function jeherve_contact_confirmation() {
    	if ( is_page( '940' ) ) {
    		$conf = 'Hello World, this is a confirmation message';
    	} else {
    		$conf = 'Hello World, this is the confirmation message for all the other forms.';
    	}
    	return $conf;
    }
    add_filter( 'grunion_contact_form_success_message', 'jeherve_contact_confirmation' );
    Thread Starter Versari

    (@versari)

    Thanks!

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