This file contains 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 | |
$query = new WP_Query('posts_per_page=3&cat=3&order=ASC'); | |
// Цикл | |
if ( $query->have_posts() ) { | |
while ( $query->have_posts() ) { | |
$query->the_post(); | |
$post_id = get_the_ID(); | |
?> | |
<?php // вывод в тэг A для того чтобы было всё полностью ссылкой при наведение подсветка в ссылку прямой url до страница на которой страница с табами постов | |
//?> |
This file contains 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 hash_History(){ | |
var hash_location = window.location.hash; | |
var find_regex = /tab([\d]+)/i; | |
var matches = hash_location.match( find_regex ); | |
if (matches && matches.length > 1) { | |
//берём только id записи | |
var hh_number = matches[1]; | |
//console.log(matches); | |
This file contains 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: wp-category-list-links | |
Plugin URI: http://dayl.ru | |
Description: Категории сайта в отдельное меню, быстрые ссылки фильтрации | |
Version: 1.0 | |
Author: Олег Мешаев | |
Author URI: http://dayl.ru | |
*/ | |
if ( !defined('ABSPATH') ) exit; |
This file contains 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 | |
$query = new WP_Query('posts_per_page=15&cat=1'); | |
//или | |
// $query_arg = array( 'posts_per_page' => '20', 'post_type' => 'partners', 'order_by' => 'menu_order', 'order' => 'DESC' ); | |
// $query = new WP_Query($query_arg); | |
// Цикл | |
if ( $query->have_posts() ) { | |
while ( $query->have_posts() ) { |
This file contains 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 | |
$partners_query_arg = array( 'posts_per_page' => '20', 'post_type' => 'partners', 'order_by' => 'menu_order', 'order' => 'DESC' ); | |
$partners_query = new WP_Query; | |
$partners_posts = $partners_query->query($partners_query_arg); | |
// Цикл 1 | |
if ( $partners_posts ) { | |
$partners_count = count($partners_posts); | |
$i_0 = 0; | |
$i_1 = 1; | |
foreach( $partners_posts as $partner ) { |
This file contains 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
$('click_class_or_id_name').bind('click', function(event){ | |
var div_id_name = $(this).attr('id'); | |
if(div_id_name === ''){ | |
var div_data_id_name = $(this).attr('data-id'); | |
$(this).attr('id', div_id_name ); | |
} else { | |
$(this).attr('id', ''); | |
$(this).attr('data-id', div_id_name ); | |
} |
This file contains 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
// use isUnd(var_ , true); = yes undefined; || isUnd(var_ , false); = no undefined; | |
window.isUnd = function(v_var, v_boo ){ | |
//v_boo = (v_boo === true) ? true : false; | |
var isUnd_regex = /(undefined|NULL|NaN)/i; | |
if( isUnd_regex.test(v_var) ){ | |
if(v_boo) {return true;} else {return false;} //if undefined | |
} | |
if(v_boo) {return false;} else {return true;} //not undefined | |
}; |
This file contains 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 get_type_furniture_tabs( $attr ) { | |
// задаем нужные нам критерии выборки данных из БД | |
$args = array( | |
'post_type' => 'furniture', | |
'posts_per_page' => 10, | |
'orderby' => 'menu_order' | |
); | |
$query_fur = new WP_Query( $args ); | |
if ( $query_fur->have_posts() ) { |
This file contains 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 | |
$tax_slug = 'category'; | |
$tax_arg = array('taxonomy' => $tax_slug, 'hide_empty' => false ); | |
$tax_query = get_terms( $tax_arg ); | |
//echo '<pre>'; print_r($tax_query); echo '</pre>'; | |
$tax_parents = []; // массив родительских элементов | |
$tax_children = []; // массив дочерних элементов | |
$tax_childs_term_ids = []; // массив дочерних элементов | |
$tax_childs_lvl2 = []; // массив дочерних элементов |
OlderNewer