custom tag not showing up in — Select field —
-
Hey,
Im using a custom tag with wpcf7_add_form_tag. But it doesnt show up in “select field” dropdown. What am I missing?functions:
add_action( 'wpcf7_init', 'custom_views_post_title' ); function custom_views_post_title() { wpcf7_add_form_tag( 'custom_views_post_title', 'custom_views_post_title_shortcode_handler' ); } function custom_views_post_title_shortcode_handler( $tag ) { global $post; $args = array( 'post_type' => 'myposttype', 'orderby' => 'date', 'order' => 'DESC', 'posts_per_page' => -1 ); $myposts = get_posts( $args ); $output = '<select name="jobs" class="jobselect" autocomplete="off"><option value="Bitte wählen">Bitte wählen</option>'; foreach ( $myposts as $post ) : setup_postdata($post); $title = get_the_title(); $id = get_the_ID(); $output .= '<option value="'. $title .'">'. $title .' </option>'; endforeach; $output .= "</select>"; return $output; }
my shortcode:
[custom_views_post_title]
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘custom tag not showing up in — Select field —’ is closed to new replies.