var loaded = 0;
$('.loadmore').click(function() {
$.ajax({
type: "POST",
url: "ajax/load_more.php",
data: {num:loaded}
}).done(function(result) {
$('.main').append(result);
});
loaded++;
});
$current_cat_id = get_query_var('cat');
$parent_cat = get_category(get_category($current_cat_id)->parent);
$categories = get_categories(array(
'orderby' => 'id',
'parent' => $parent_cat->term_id,
'hide_empty' => false,
));
echo '<nav class="aside-panel"><ul>';
foreach ($categories as $category) {
if ($category->term_id == $current_cat_id) $isThisCat = true;
else $isThisCat = false;
echo '<li class="panel-item';
if ($isThisCat) echo ' is-active';
echo '">
<a href="' .get_category_link ($category->term_id). '" class="label">' .writeTitle($category->name). '</a>';
if ($isThisCat) {
echo '<ul class="drop-menu">';
if ( have_posts() ){
while (have_posts()) { the_post();
echo '<li><a href="' .get_the_permalink(). '" class="link">' .nobrArticle(get_the_title()). '</a></li>';
}
}
echo '</ul>';
}
echo '</li>';
}
echo '</ul></nav>';
function processingText($text) {
if (preg_match("/\<.*\>/u", $text)) {
// До первого тега
$text = preg_replace_callback("|^([^\<]*)\<|u", function ($matches) {
return str_replace('-', '‑', $matches[1]).'<';
}, $text);
// Основная часть
$text = preg_replace_callback("|\>([^\<]*)\<|u", function ($matches) {
return '>'.str_replace('-', '‑', $matches[1]).'<';
}, $text);
// После последнего тега
$text = preg_replace_callback("|\>([^\<]*)$|u", function ($matches) {
return '>'.str_replace('-', '‑', $matches[1]);
}, $text);
return $text;
} else {
// Замена в тексте без тегов
return str_replace('-', '‑', $text);
}
}
$('table').each(function(iTable, thisTable) {
...
$(this).find('tr').each(function(iRow, thisRow) {
...
});
});
$sql = "SELECT * FROM `hashtags` WHERE ";
if (...) {
$sql .= "`id` = '$id' AND ";
}
if (...) {
$sql .= "`tag` = '$tag' AND ";
}
if (...) {
$sql .= "`type` = '$type' AND ";
}
$sql = substr($sql, 0, -5);