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 | |
/* | |
Короткий пример для использования Theme_Customization_API | |
http://casepress.org/kb/web/nastrojki-temy-wordpress-kak-dobavit-svoi-polya/ | |
*/ | |
/** | |
* Добавляет страницу настройки темы в админку Вордпресса | |
*/ |
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: Test Select2 & AJAX | |
Plugin URI: http://casepress.org | |
Description: Это учебный плагин для понимания механизмов Select2 & AJAX в WordPress | |
Author: CasePress | |
Author URI: http://casepress.org | |
Version: 20141112 | |
*/ |
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
$results_array = get_terms('results', 'fields=ids'); | |
?> | |
<?php | |
//Без вероятности | |
$orders = get_posts(array( | |
'post_type' => 'cases', | |
'functions' => 'dealings', |
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 | |
if ( ! function_exists( 'acl_filter_posts_where' ) ) : | |
function acl_filter_posts_where($where){ | |
global $wpdb; | |
$current_user_id = get_current_user_id(); |
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
//Проверяем наличие комментария о нарушении срока | |
$items = get_posts(array( | |
'post_type' => 'post', | |
'numberposts' => 500, | |
)); | |
//Создаем массив и помещаем туда данные комментов | |
$data = array(); | |
foreach($items as $post): setup_postdata( $post ); | |
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: Заголовок - автонаписание | |
Description: Скрывает поле написания заголовка на странице объектов и формирует его на базе данных объекта | |
Version: 1 | |
*/ | |
/** | |
* | |
*/ | |
class TitleAutomatS{ |
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 | |
//Проверяем наличие комментария о нарушении срока | |
$cases = get_posts(array( | |
'post_type' => 'cases', | |
'numberposts' => 333, | |
'tax_query' => array( | |
array( | |
'taxonomy' => 'functions', | |
'field' => 'slug', |
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
//Сохранение данных поля uuid для категории продуктов | |
function mss_uuid_product_cat_form_edit($term_id){ | |
if ( ! isset( $_POST['mss_uuid_product_cat'] ) || ! wp_verify_nonce( $_POST['mss_uuid_product_cat_nonce'], basename( __FILE__ ) ) ) | |
return; | |
$mss_uuid_product_cat = $_POST['mss_uuid_product_cat']; | |
if(empty($mss_uuid_product_cat)) { | |
delete_term_meta( $term_id, 'uuid_product_category_mss' ); | |
} else { | |
update_term_meta( $term_id, 'uuid_product_category_mss', $mss_uuid_product_cat ); |
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
//получает term_id категории продуктов WC по значению метаполя | |
//Возвращает значение term_id для uuid | |
// $term_id = get_term_id_by_uuid_mss($uuid); | |
function get_term_id_by_uuid_mss($uuid){ | |
global $wpdb; | |
$data = $wpdb->get_results("SELECT term_id FROM $wpdb->termmeta WHERE meta_value = '" . $uuid . "' LIMIT 1"); | |
$data = $data[0]->term_id; | |
return $data; | |
} |
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
//Добавляем поля на форму категорий продуктов | |
function mss_uuid_product_cat_form($term){ | |
wp_nonce_field( basename( __FILE__ ), 'mss_uuid_product_cat_nonce' ); | |
?> | |
<div class="form-field mss_uuid_product_cat"> | |
<label for="mss_uuid_product_cat">uuid МойСклад</label><br/> | |
<input type="text" name="mss_uuid_product_cat" id="mss_uuid_product_cat" value="<?php echo get_term_meta( $term_id, 'uuid_product_category_mss', true ); ?>" /> | |
<p><small>Это поле идентификатор для синхронизации с МойСклад</small></p> |
OlderNewer