• Resolved Amit Biswas

    (@amitbiswas06)


    Hello!

    First, thank you for this great plugin. I am here for a little help. I am using the form in a modal and I need to display the form “title” and “description” in my template file. Unfortunately I am unable to find the proper code to do it.

    I think it will be simple echo/print in PHP.

    Please help me.

    Thanks,
    Amit

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor yikesitskevin

    (@yikesitskevin)

    Hi @amitbiswas06,

    I’m glad you’re enjoying the plugin!

    I can definitely supply you with some code to echo out a title and description. Form data is stored in the WordPress options table, and the description and title are attributes of the form. We don’t have a specific function like get_form_title( $form_id ).

    Here is a function that will fetch the form title, just pass in the $form_id:

    function yikes_mailchimp_get_form_title( $form_id ) {
    
    	$form_title = '';
    
    	if ( function_exists( 'yikes_easy_mailchimp_extender_get_form_interface' ) ) {
    		$interface = yikes_easy_mailchimp_extender_get_form_interface();
    		$form_data = $interface->get_form( $form_id );
    		$form_title = isset( $form_data['form_name'] ) ? $form_data['form_name'] : '';
    	}
    
    	return $form_title;
    }

    Here is a function that will fetch the form description (again, just pass in the $form_id):

    
    function yikes_mailchimp_get_form_description( $form_id ) {
    
    	$form_description = '';
    
    	if ( function_exists( 'yikes_easy_mailchimp_extender_get_form_interface' ) ) {
    		$interface = yikes_easy_mailchimp_extender_get_form_interface();
    		$form_data = $interface->get_form( $form_id );
    		$form_description = isset( $form_data['form_description'] ) ? $form_data['form_description'] : '';
    	}
    
    	return $form_description;
    }

    And here is how you would call them (in this example, I’m looking at the form with an ID of 1):

    $form_description = yikes_mailchimp_get_form_description( 1 );
    echo $form_description;
    
    $form_title = yikes_mailchimp_get_form_title( 1 );
    echo $form_title;

    Is that what you’re looking for?
    Kevin.

    • This reply was modified 9 years, 2 months ago by yikesitskevin.
    Thread Starter Amit Biswas

    (@amitbiswas06)

    Yes! Exactly. Thanks a lot.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘How to echo/print “Title” and “Description” without shortcode’ is closed to new replies.