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
// - это комментарии которые в коде не видны есть аналог /* тут комментарий */ (это работает в javascript, css) | |
<?php //это начало файла и обозначает что тут код php | |
//тут код php пишется | |
?> //это завершает область php кода | |
<?php | |
$var // это переменная в неё можно что то положить из нескольких типов данных | |
$var = 'привет'; //в переременной $var теперь тип данных строка с текстом (string) | |
$var = 0; //в переременной $var теперь тип данных число (number) |
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
//js | |
function n( num, plus, num2 ){ | |
if( num < 1 && num2 < 1 ){ | |
num = num * 10; | |
num2 = num2 * 10; | |
} | |
var num_out = ''+num+plus+num2; | |
num_out = eval(num_out); | |
return num_out/10; | |
} |
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 video_frame_resize(iframe_selector){ | |
var v = {}; | |
v.ww = $(window).width(); | |
v.wh = $(window).height(); | |
v.parent_w = $( iframe_selector ).parent().width(); | |
v.parent_h = $( iframe_selector ).parent().height(); | |
v.frame_w = $( iframe_selector ).attr('width'); | |
v.frame_h = $( iframe_selector ).attr('height'); |
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 = []; // массив дочерних элементов |
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
window.isset = function(v_var) { | |
if(typeof(v_var) == 'number'){ if(isNaN(v_var)){return false;}} | |
if(typeof(v_var) == 'undefined' || v_var === null){return false;} | |
return true; | |
}; | |
// if( typeof(v_var) == 'undefined' ) | |
// or | |
// if( v_var === [][[]] ) |
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
$('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
<?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() ) { |