diff --git a/dynamic-select-plugin/cklph-ff-custom-select.php b/dynamic-select-plugin/cklph-ff-custom-select.php deleted file mode 100644 index cc2c425..0000000 --- a/dynamic-select-plugin/cklph-ff-custom-select.php +++ /dev/null @@ -1,67 +0,0 @@ -id != 7 ) { - return $data; - } - - // check if the name attriibute of the select field in fluent forms is 'dynamic_dropdown'. - if ( \FluentForm\Framework\Helpers\ArrayHelper::get( $data, 'attributes.name' ) != 'dynamic_dropdown' ) { - return $data; - } - - $product_titles = get_product_titles(); - $dropdown_data = array(); - - foreach ( $product_titles as $product_title ) { - $dropdown_data[] = array( - 'label' => esc_attr( $product_title ), - 'value' => esc_attr( $product_title ), - 'calc_value' => '1', - ); - } - // We are merging with existing options here. - $data['settings']['advanced_options'] = $dropdown_data; - - return $data; -}, 10, 2); - -/** - * Custom function to get the product titles of a CPT. For this example, gets product CPT's. - * - * @return String array of CPT titles - */ -function get_product_titles() { - $titles = array(); - $args = array( - 'post_type' => 'product', - 'posts_per_page' => 10, - ); - $loop = new WP_Query( $args ); - while ( $loop->have_posts() ) { - $loop->the_post(); - $titles[] = get_the_title(); - } - - return $titles; -} - -$data = apply_filters( 'fluentform_rendering_field_data_select', $data, $form ); \ No newline at end of file