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
// https://www.sitepoint.com/create-a-wordpress-theme-settings-page-with-the-settings-api/ | |
function theme_settings_page() | |
{ | |
?> | |
<div class="wrap"> | |
<h1>Настройка темы</h1> | |
<form method="post" action="options.php"> | |
<?php | |
settings_fields("section"); |
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
var x = '|f|oo||'; | |
var y = x.replace(/^\|+|\|+$/g, ''); | |
document.write(x + '<br />' + y); |
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 | |
$db_props = CIBlockElement::GetProperty($item["IBLOCK_ID"], $item["ID"], "sort", "asc", array()); | |
$PROPS = array(); | |
while($ar_props = $db_props->Fetch()){ | |
$PROPS[$ar_props['CODE']] = $ar_props['VALUE']; | |
echo $PROPS[$ar_props['CODE']] . "<br />"; | |
} | |
?> |
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
$view_counter = 0; | |
if(CModule::IncludeModule("iblock")){ | |
CIBlockElement::CounterInc($item["ID"]); | |
$res = CIBlockElement::GetByID($item["ID"]); | |
if($ar_res = $res->GetNext()){ | |
$view_counter = $ar_res['SHOW_COUNTER']; | |
} | |
} |
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 close_print(){ | |
var beforePrint = function() { | |
console.log('Functionality to run before printing.'); | |
}; | |
var afterPrint = function() { | |
//console.log('Functionality to run after printing'); | |
$("#animal_menu, .single-subnav, #footer-credits-wrap, #mainpage-header, #print_button, .legend").show(); | |
$(".park_map_page").css("width", 1170); | |
}; |
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
#301 Redirects for .htaccess | |
#Redirect a single page: | |
Redirect 301 /pagename.php http://www.domain.com/pagename.html | |
#Redirect an entire site: | |
Redirect 301 / http://www.domain.com/ | |
#Redirect an entire site to a sub folder | |
Redirect 301 / http://www.domain.com/subfolder/ |
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
$publicationsWithoutTerms = new WP_Query(array( | |
'post_type' => 'doc', | |
'tax_query' => array(array( | |
'taxonomy' => 'category', | |
'field' => 'term_id', | |
'operator' => 'NOT IN', | |
'terms' => get_terms('category', array( | |
'fields' => 'ids' | |
)) | |
)) |
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
// 163 - necessary category id | |
// "category" - taxonomy name | |
$children_id = get_term_children(163, "category"); | |
foreach($children_id as $child){ | |
$term = get_term_by("id", $child, "category"); | |
$id = $term->term_id; | |
$name = $term->name; | |
$count = $term->count; | |
} |
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
$app = Jfactory::getApplication(); | |
$input=$app->input; | |
if ($input->getCmd('option')=='com_content' | |
&& $input->getCmd('view')=='article' ){ | |
$cmodel = JModelLegacy::getInstance('Article', 'ContentModel'); | |
$catid = $cmodel->getItem($app->input->get('id'))->catid; | |
echo $catid; | |
} |
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 request_url() | |
{ | |
$result = ''; // Пока результат пуст | |
$default_port = 80; // Порт по-умолчанию | |
// А не в защищенном-ли мы соединении? | |
if (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS']=='on')) { | |
// В защищенном! Добавим протокол... | |
$result .= 'https://'; | |
// ...и переназначим значение порта по-умолчанию |