Last active
February 5, 2019 08:00
-
-
Save mdjwel/274b3a3b2bdd867fb31facffc1930727 to your computer and use it in GitHub Desktop.
Contact Form 7 Post Title Lists
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 | |
if ( ! function_exists( '_get_contact_form_7_posts' ) ) : | |
function _get_contact_form_7_posts(){ | |
$args = array( 'post_type' => 'wpcf7_contact_form', 'posts_per_page' => -1 ); | |
$catlist = []; | |
if( $categories = get_posts( $args ) ){ | |
foreach ( $categories as $category ) { | |
(int)$catlist[$category->ID] = $category->post_title; | |
} | |
} | |
else{ | |
(int)$catlist['0'] = esc_html__( 'No contect From 7 form found', 'mak-shortcode' ); | |
} | |
return $catlist; | |
} | |
endif; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment