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: Get Count Publish Products by User ID | |
| * Plugin URI: https://gist.github.com/campusboy87/71c8849656b4b8e1fd1702cdf41d6d51 | |
| * Author: Campusboy | |
| */ | |
| // Example of using a shortcode [my-products id='1'] | |
| add_shortcode( 'my-products', 'get_count_published_products_by_user_id_shortcode' ); |
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: Code Editor for Contact Form 7 | |
| * Plugin URI: https://gist.github.com/campusboy87/2daad24e45116721759991549b626977 | |
| * Author: Campusboy (wp-plus) | |
| * Author URI: https://www.youtube.com/wp-plus | |
| */ | |
| add_action( 'admin_print_styles-toplevel_page_wpcf7', function () { |
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: Change Title Depending Domain | |
| * Description: Добавляет возможность изменять title в зависимости от домена. | |
| * Author: campusboy | |
| * Version: 0.1.0 | |
| */ | |
| if ( ! defined( 'ABSPATH' ) ) { | |
| exit; |
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: WPCF Redirect | |
| */ | |
| add_filter( 'shortcode_atts_wpcf7', 'shortcode_atts_wpcf7' ); | |
| add_filter( 'wpcf7_editor_panels', 'wpcf7_add_redirect_panels' ); | |
| add_action( 'wpcf7_after_save', 'wpcf7_redirect_save_field' ); | |
| add_action( 'wp_footer', 'wpcf7_redirect_enqueue_assets' ); |
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 | |
| /** | |
| * Запускает процесс генерации записей через добавление к URL параметра import. | |
| */ | |
| if ( isset( $_GET['import'] ) ) { | |
| // Запускает добавление записей в базу. | |
| add_action( 'init', 'generate_test_posts' ); |
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( 'manage_media_columns', 'add_my_column_in_media_table' ); | |
| add_action( 'manage_media_custom_column', 'fill_my_column_in_media_table', 10, 2 ); | |
| /** | |
| * Создает новую колонку. | |
| * | |
| * @param array $columns | |
| * |
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_form_elements', function () { | |
| $manager = WPCF7_FormTagsManager::get_instance(); | |
| $form_html = do_shortcode( WPCF7_ContactForm::get_current()->prop( 'form' ) ); | |
| if ( wpcf7_autop_or_not() ) { | |
| $form_html = $manager->normalize( $form_html ); | |
| $form_html = wpcf7_autop( $form_html ); | |
| } |
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( 'manage_post_posts_columns', function ( $columns ) { | |
| $my_columns = [ | |
| 'id' => 'ID', | |
| 'image' => 'Миниатюра', | |
| ]; | |
| return array_slice( $columns, 0, 1 ) + $my_columns + $columns; |
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( 'pre_handle_404', 'fix_fake_category_page' ); | |
| function fix_fake_category_page( $false ) { | |
| global $wp_query; | |
| if ( is_archive() && get_query_var('category_name') === '0' ) { | |
| // if ( is_archive() && ! term_exists( get_query_var( 'category_name' ) ) ) { |