Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save shaddam/2cdda171ac6159d951765209142f22db to your computer and use it in GitHub Desktop.

Select an option

Save shaddam/2cdda171ac6159d951765209142f22db to your computer and use it in GitHub Desktop.
How to get Contact form 7 list for elementor addons
/*
* Contact form list
* return array
*/
function themename_contact_form_seven(){
$countactform = array();
$themename_forms_args = array( 'posts_per_page' => -1, 'post_type'=> 'wpcf7_contact_form' );
$themename_forms = get_posts( $themename_forms_args );
if( $themename_forms ){
foreach ( $themename_forms as $themename_form ){
$countactform[$themename_form->ID] = $themename_form->post_title;
}
}else{
$countactform[ esc_html__( 'No contact form found', 'text-domain' ) ] = 0;
}
return $countactform;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment