Created
November 6, 2013 16:49
-
-
Save madalinignisca/7339663 to your computer and use it in GitHub Desktop.
a function to get a list of Contact Form 7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function get_contact_forms() { | |
$allContactForms7 = array(); | |
global $wpdb; | |
global $table_prefix; | |
$table_prefix = $wpdb->base_prefix; | |
$wpdb->tablename = $table_prefix . 'posts'; | |
$contact_forms7 = $wpdb->get_results( | |
" | |
SELECT ID,post_title | |
FROM $wpdb->tablename | |
WHERE post_type = 'wpcf7_contact_form' | |
" | |
); | |
foreach ( $contact_forms7 as $contact_form7 ) | |
{ | |
$allContactForms7[$contact_form7->ID] = $contact_form7->post_title; | |
} | |
return $allContactForms7; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment