Skip to content

Instantly share code, notes, and snippets.

@zexeder
Last active August 29, 2015 14:23
Show Gist options
  • Save zexeder/86a360ac9e91a27e10cb to your computer and use it in GitHub Desktop.
Save zexeder/86a360ac9e91a27e10cb to your computer and use it in GitHub Desktop.
Уделение доступных тегов в комментах
<?php
// function remove_comment_fields($fields) {
// unset($fields['url']);
// return $fields;
// }
// add_filter('comment_form_default_fields', 'remove_comment_fields');
// function mytheme_init() {
// add_filter('comment_form_defaults','mytheme_comments_form_defaults');
// }
// add_action('after_setup_theme','mytheme_init');
// function mytheme_comments_form_defaults($default) {
// unset($default['comment_notes_after']);
// return $default;
// }
// Remove tag in comments
function mytheme_init() {
add_filter('comment_form_defaults','mytheme_comments_form_defaults');
}
add_action('after_setup_theme','mytheme_init');
function mytheme_comments_form_defaults($default) {
unset($default['comment_notes_after']);
return $default;
}
//хук в init action и вызов create_book_taxonomies когда хук сработает
add_action( 'init', 'create_topics_razdel_taxonomy', 0 );
//задаем название для произвольной таксономии Topics для ваших записей
function create_topics_razdel_taxonomy() {
// Добавляем новую таксономию, делаем ее иерархической вроде рубрик
// также задаем перевод для интерфейса
$labels = array(
'name' => _x( 'Раздел', 'taxonomy general name' ),
'singular_name' => _x( 'Раздел', 'taxonomy singular name' ),
'search_items' => __( 'Тип сделки' ),
'all_items' => __( 'Все сделки' ),
'parent_item' => __( 'Parent Topic' ),
'parent_item_colon' => __( 'Parent Topic:' ),
'edit_item' => __( 'Редактировать' ),
'update_item' => __( 'Обновить' ),
'add_new_item' => __( 'Добавить' ),
'new_item_name' => __( 'Новая' ),
'menu_name' => __( 'Раздел' ),
);
// Теперь регистрируем таксономию
register_taxonomy('razdel',array('post'), array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'show_admin_column' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'topic' ),
));
}
// Category (type estate)
//хук в init action и вызов create_book_taxonomies когда хук сработает
add_action( 'init', 'create_topics_type_estate_taxonomy', 0 );
//задаем название для произвольной таксономии Topics для ваших записей
function create_topics_type_estate_taxonomy() {
// Добавляем новую таксономию, делаем ее иерархической вроде рубрик
// также задаем перевод для интерфейса
$labels = array(
'name' => _x( 'Категория', 'taxonomy general name' ),
'singular_name' => _x( 'Количество комнат', 'taxonomy singular name' ),
'search_items' => __( 'Поиск комнат' ),
'all_items' => __( 'Все категории' ),
'parent_item' => __( 'Parent Topic' ),
'parent_item_colon' => __( 'Parent Topic:' ),
'edit_item' => __( 'Редактировать' ),
'update_item' => __( 'Обновить' ),
'add_new_item' => __( 'Добавить' ),
'new_item_name' => __( 'Новая' ),
'menu_name' => __( 'Категория' ),
);
// Теперь регистрируем таксономию
register_taxonomy('type_estate',array('post'), array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'show_admin_column' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'topic' ),
));
}
// Rooms
//хук в init action и вызов create_book_taxonomies когда хук сработает
add_action( 'init', 'create_topics_room_taxonomy', 0 );
add_filter( "radio-buttons-for-taxonomies-no-term-rooms", "__return_FALSE" );
//задаем название для произвольной таксономии Topics для ваших записей
function create_topics_room_taxonomy() {
// Добавляем новую таксономию, делаем ее иерархической вроде рубрик
// также задаем перевод для интерфейса
$labels = array(
'name' => _x( 'Количество комнат', 'taxonomy general name' ),
'singular_name' => _x( 'Количество комнат', 'taxonomy singular name' ),
'search_items' => __( 'Поиск комнат' ),
'all_items' => __( 'Количество комнат' ),
'parent_item' => __( 'Parent Topic' ),
'parent_item_colon' => __( 'Parent Topic:' ),
'edit_item' => __( 'Редактировать' ),
'update_item' => __( 'Обновить' ),
'add_new_item' => __( 'Добавить' ),
'new_item_name' => __( 'Новая' ),
'menu_name' => __( 'Комнаты' ),
);
// Теперь регистрируем таксономию
register_taxonomy('rooms',array('post'), array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'show_admin_column' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'topic' ),
));
}
// Price
//хук в init action и вызов create_book_taxonomies когда хук сработает
add_action( 'init', 'create_topics_price_taxonomy', 0 );
//задаем название для произвольной таксономии Topics для ваших записей
function create_topics_price_taxonomy() {
// Добавляем новую таксономию, делаем ее иерархической вроде рубрик
// также задаем перевод для интерфейса
$labels = array(
'name' => _x( 'Цена', 'taxonomy general name' ),
'singular_name' => _x( 'Диапазон цены', 'taxonomy singular name' ),
'search_items' => __( 'Поиск по цене' ),
'all_items' => __( 'Все цены' ),
'parent_item' => __( 'Parent Topic' ),
'parent_item_colon' => __( 'Parent Topic:' ),
'edit_item' => __( 'Редактировать' ),
'update_item' => __( 'Обновить' ),
'add_new_item' => __( 'Добавить' ),
'new_item_name' => __( 'Новая' ),
'menu_name' => __( 'Цена' ),
);
// Теперь регистрируем таксономию
register_taxonomy('price',array('post'), array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'show_admin_column' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'topic' ),
));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment