set_query_var( 'count', $count );
get_template_part( 'content', get_post_format() );
add_filter('the_content', function($content){
// Тут регулярки
return $content;
});
if (have_posts()) : while (have_posts()) : the_post();
$content = get_the_content();
// Тут тоже регулярки))
if (have_posts()) : while (have_posts()) : the_post();
ob_start();
the_content();
$content = ob_get_clean();
// Тут тоже регулярки))
add_filter( 'media_buttons', function($editor_id){
echo '<a href="#" id="custom-media-button" class="button custom-media" data-editor="content" title="Custom button"><span class="custom-icon"></span> Custom button</a>';
}, 20);
<?php wp_footer(); ?>
+function($){
$(document).ready(function(){
$('.external-reference').replaceWith (function (){return'<a href="'+$(this).data('link')+'" title="'+$(this).text()+'">'+$(this).html()+'</a>';});
});
}(jQuery);
if (data.loggedin == true){
document.location.href = ajax_login_object.redirecturl;
}
/* Restore original Post Data
* NB: Because we are using new WP_Query we aren't stomping on the
* original $wp_query and it does not need to be reset with
* wp_reset_query(). We just need to set the post data back up with
* wp_reset_postdata().
*/
wp_reset_postdata();
add_filter('wp_nav_menu', function($nav_menu){
$result = preg_match_all('#<li(?:.*)><a href="[\#]{1}(.*)">(?:.*)</a></li>#', $nav_menu, $matches);
if($result){
foreach($matches[0] as $match){
$link = $match;
$match = str_replace(array('current-menu-item', 'current-category-ancestor'), '', $match);
$nav_menu = str_replace($link, $match, $nav_menu);
}
}
return $nav_menu;
});
add_filter('term_link', function($termlink){
return str_replace('category/', '', $termlink);
});
<form action="/" method="get" role="search">
<select name="inventar">
<?php
$categories = get_categories(array(
'child_of' => 2 // если не знаешь ID то - get_category_by_slug( 'inventar' )->cat_ID
));
foreach($categories as $category): ?>
<option value = "<?=$category->cat_ID ?>"><?=$category->cat_name ?></option>
<?php endforeach ?>
</select>
<select name="park">
<?php
$categories = get_categories(array(
'child_of' => 3 // get_category_by_slug( 'park' )->cat_ID
));
foreach($categories as $category): ?>
<option value = "<?=$category->cat_ID ?>"><?=$category->cat_name ?></option>
<?php endforeach ?>
</select>
<input type="hidden" name="source" value="bb">
<button type="submit">Начать поиск</button>
</form>
add_filter('pre_get_posts', function($query){
if(isset($_GET['source']) && $_GET['source'] == 'bb'){
$query->set( 'category__and', array(
$_GET['inventar'],
$_GET['park']
) );
}
});