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
| <?php | |
| add_filter( 'wpcf7_validate', 'wpq_validate' ); | |
| function wpq_validate( $result ) { | |
| $form = WPCF7_Submission::get_instance(); | |
| $phone = $form->get_posted_data('phone'); // Имя поля с телефоном | |
| $email = $form->get_posted_data('email'); // Имя поля с email | |
| $error_msg = 'Заполните телефон или email'; | |
| if( empty($phone) && empty( $email ) ) { |
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
| <?php | |
| /** | |
| * Возвращает ID рубрик товаров для указанного продавца. | |
| * | |
| * @param int $vendor_id ID продавца. | |
| * | |
| * @return array | |
| */ | |
| function get_id_cat_product_by_vendor( $vendor_id = 0 ) { | |
| global $wpdb; |
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
| <?php | |
| add_action( 'admin_init', 'posts_per_page__my_cpt_settings_api_init' ); | |
| function posts_per_page__my_cpt_settings_api_init() { | |
| register_setting( 'reading', 'posts_per_page__my_cpt', 'sanitize_text_field' ); | |
| add_settings_field( | |
| 'posts_per_page__my_cpt', | |
| '<label for="posts_per_page__my_cpt">На страницах MY_CPT отображать не более</label>', | |
| 'posts_per_page__my_cpt_field_html', | |
| 'reading' |
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
| <?php | |
| //see https://yadi.sk/i/M5hhJKkU3MkRdN | |
| add_filter("wpcf7_mail_components", function($components, $curent_cf, $sender ){ | |
| date_default_timezone_set('America/Sao_Paulo'); | |
| $data = date("Y-m-d H:i:s"); | |
| $components['body'] = str_replace("[protocol]", $data , $components['body'] ); | |
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
| <?php | |
| add_filter( 'request', function ( $query_vars ) { | |
| if ( isset( $query_vars['pagename'] ) && $query_vars['pagename'] === 'all-articles' ) { | |
| add_filter( "pre_option_page_for_posts", function () { | |
| return 484; // ID нужной страницы | |
| } ); | |
| } | |
| return $query_vars; |
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
| <?php | |
| /** | |
| * Plugin Name: CF7 Modal Invalid Answer | |
| * Plugin URI: https://gist.github.com/campusboy87/a056c288c99feee70058ed24cee805ad | |
| * Author: Campusboy (wp-plus) | |
| * Author URI: https://www.youtube.com/wp-plus | |
| */ | |
| add_action( 'wp_enqueue_scripts', 'wpcf7_modal_invalid_js' ); | |
| add_action( 'wp_footer', 'wpcf7_modal_invalid_js_inline', 999 ); |