Last active
July 14, 2018 21:37
-
-
Save obiPlabon/13be265a5f267ca68e8a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function list_wpcf7_form_shortcodes() { | |
global $post; | |
if ( ! post_type_exists( 'wpcf7_contact_form' ) ) | |
_e( "You haven't install/activate Contact Form 7 plugin yet.", "text_domain" ); | |
$wpcf7_posts = get_posts( array( | |
'post_type' => 'wpcf7_contact_form', | |
'posts_per_page' => -1, | |
) ); | |
echo "<select name='wpcf7_shortcodes'>"; | |
foreach ( $wpcf7_posts as $post ) : setup_postdata( $post ); | |
$wpcf7_shortcode = '[contact-form-7 id="' . get_the_ID() . '" title="' . get_the_title() . '"]'; | |
echo "<option value='" . $wpcf7_shortcode . "'>" . $wpcf7_shortcode . "</option>"; | |
endforeach; | |
wp_reset_postdata(); | |
echo "</select>"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment