'acfw30_forms', 'numberposts' => -1, ); $posts = get_posts( $args ); echo ''; } add_action('wp_head', 'acfw30_styles'); function acfw30_core(){ $args = array( 'post_type' => 'acfw30_forms', 'numberposts' => -1, ); $posts = get_posts( $args ); foreach( $posts as $post ){ $acfw30_form_fields = get_post_meta($post->ID, 'acfw30_form_fields', true); $acfw30_form_fields = wp_specialchars_decode($acfw30_form_fields, ENT_QUOTES); $acfw30_template_file = plugin_dir_path(__FILE__).'/templates/custom-popup-form.php'; if (file_exists($acfw30_template_file)){ require($acfw30_template_file); } else { require(plugin_dir_path(__FILE__).'/templates/popup-form.php'); } } } add_action('wp_footer', 'acfw30_core'); //shortcode add_shortcode('acfw30', 'acfw30_shortcode'); function acfw30_shortcode($atts, $content = null) { extract( shortcode_atts(array( "id" => '', ), $atts ) ); $form = ''; if(!empty($id)){ $args = array( 'post_type' => 'acfw30_forms', 'include' => $id, 'numberposts' => 1, ); $posts = get_posts( $args ); foreach( $posts as $post ){ $bg_spcolor = get_post_meta($post->ID, 'acfw30_form_bg_spcolor', true); $font_spcolor = get_post_meta($post->ID, 'acfw30_form_font_spcolor', true); $btn_spcolor = get_post_meta($post->ID, 'acfw30_form_btn_spcolor', true); $border_spcolor = get_post_meta($post->ID, 'acfw30_form_border_spcolor', true); $btn_text_spcolor = get_post_meta($post->ID, 'acfw30_form_btn_text_spcolor', true); $placeholder_spcolor = get_post_meta($post->ID, 'acfw30_form_placeholder_spcolor', true); $acfw30_form_fields = get_post_meta($post->ID, 'acfw30_form_fields', true); $acfw30_form_fields = wp_specialchars_decode($acfw30_form_fields, ENT_QUOTES); $acfw30_template_file = plugin_dir_path(__FILE__).'/templates/custom-form.php'; if (file_exists($acfw30_template_file)){ require($acfw30_template_file); } else { require(plugin_dir_path(__FILE__).'/templates/form.php'); } } return $form; } else { return $form; } } ?>