add_editor_style()
add_action( 'after_setup_theme', 'load_wysiwyg_style' );
function load_wysiwyg_style() {
add_editor_style( get_template_directory_uri() . '/assets/wysiwyg-style.css');
}
body#tinymce {
background: #131320!important;
color: #fff;
}
<?php
$args = array(
'posts_per_page' => -1,
'orderby' => 'date',
'post_type' => 'post',
);
$query = new WP_Query( $args );
// Цикл
if ( $query->have_posts() ) {
$i = 0;
while ( $query->have_posts() ) {
$query->the_post();
// в каждом 1-м посту каждой четверки открываем див
if (($i % 4) === 0) {
echo '<div class="swiper-slide"><div class="community-slider__items__grid">';
}
// Остальная логика
get_template_part('loop/loop','community');
// в каждом 4-м посту каждой четверки закрываем див
if ($i % 4 === 3) {
echo '</div></div>';
}
$i++;
}
// если в последней четверке не 4 поста, то див не закрыт. закрываем его
if ($i % 4 !== 0) {
echo '</div></div>';
}
}
wp_reset_postdata();
?>
function carbon_lang_prefix() {
$current = wpm_get_language();
$prefix = '';
if ( ! $current ) {
return $prefix;
}
if ( $current == 'ru') {
return $prefix;
}
$prefix = '_' . $current;
return $prefix;
}
function crb_get_i18n_suffix() {
$suffix = '';
if ( ! defined( 'ICL_LANGUAGE_CODE' ) ) {
return $suffix;
}
$suffix = '_' . ICL_LANGUAGE_CODE;
return $suffix;
}
function crb_get_i18n_theme_option( $option_name ) {
$suffix = crb_get_i18n_suffix();
return carbon_get_theme_option( $option_name . $suffix );
}
$wp_query = array(
'post_type' => 'page',
'posts_per_page' => 4,
'meta_query' => [
'relation' => 'AND',
]
);
if(isset($_GET["priceMin"]) or isset($_GET["priceMax"])){
$priceMin = $_GET["priceMin"];
$priceMax = $_GET["priceMax"];
if($priceMin or $priceMax){
$wp_query['meta_query'][] = array(
'priceMinMax_query' => array(
'key' => 'price',
'value' => array($_GET["priceMin"], $_GET["priceMax"]), // значение в промежутке от-до
'compare' => 'BETWEEN',
'type' => 'NUMERIC',
),
);
}
}
$customs = get_post_custom(ID);
foreach ( $customs as $key => $val ) {
echo '<tr>';
echo '<td>', esc_html( $key ), '</td><td>';
if ( count( $val ) === 1 ) {
$val = maybe_unserialize( $val[0] );
if ( ! is_array( $val ) ) {
echo esc_html( $val );
}
else {
echo '<pre>', esc_html( print_r( $val, 1 ) ), '</pre>';
}
}
else {
foreach ( $val as $v ) {
echo esc_html( $v ), '<br/>';
}
}
echo '</td></tr>';
echo '</tr>';
}
<input type="hidden" value="post" name="post_type" />
. В value
можете вписать тип поста. product, post, order и т.д<input type="hidden" value="1" name="sentence" />
<form role="search" method="get" id="searchform" action="<?php echo home_url( '/' ) ?>" >
<div class="stylevision-sear">
<div class="stylevision-sear__block">
<input class="stylevision-sear__input" type="search" value="<?php echo get_search_query() ?>" name="s" id="s site-search" placeholder="Example: what to wear to prom" aria-label="Search through site content">
<input type="hidden" value="post" name="post_type" />
<input type="hidden" value="1" name="sentence" />
</div>
<button class="stylevision-sear__btn">Search</button>
</div>
</form>
$min_price = "1";
$max_price = "99000";
if(isset($_POST['min_price'])) $min_price = $_POST['min_price'];
if(isset($_POST['max_price'])) $max_price = $_POST['max_price'];
echo "Ваш min_price: $min_price <br> Ваш max_price: $max_price <br><br>";
<form action="" method="post" >
<div class="left">
<label>
от <input name="min_price" type="number" value="<?php echo $min_price?>">
</label>
<div class="minus">
<img src="<?php bloginfo('template_directory')?>/accets/img/minus.png" alt="">
</div>
<label>
до <input name="max_price" type="number" value="<?php echo $max_price?>">
</label>
</div>
<button>го</button>
</form>
<?php
$query = new WP_Query( array(
'post_type' => 'post',
'posts_per_page' => 6,
'meta_query' => array(
'max_price' => array(
'key' => 'цена',
'value' => $max_price,
'type' => 'NUMERIC',
'compare' => '<=',
),
'min_price' => array(
'key' => 'цена',
'value' => $min_price,
'type' => 'NUMERIC',
'compare' => '>=',
),
),
'orderby' => 'max_price,min_price,minimal_price',
) );
?>
<?php while ( $query->have_posts() ) : $query->the_post(); ?>
<?php
get_template_part( 'loop/item_type1', 'loop' );
?>
<?php endwhile; ?>
<?php
wp_reset_query();
?>
<?php
$categories = get_the_category($post->ID);
foreach($categories as $category) :
$children = get_categories( array ('parent' => $category->term_id ));
$has_children = count($children);
if ( $has_children == 0 ) {
echo $category->cat_name;
}
endforeach;
?>
<?php $category = get_the_category();
if ($category) {
echo '<a class="txt txt_gray txt_small newsfeed__paramlink ' . $category[0]->category_nicename.'" href="' . get_category_link( $category[0]->term_id ) . '" title="' . sprintf( __( "%s", "elitenews" ), $category[0]->name ) . '" ' . '>' . $category[0]->name.'</a> ';
}
?>
/**
* Display Contact Form 7 messages in a popup.
*/
function ContactForm7_popup() {
$return = <<<EOT
<script>
jQuery(".wpcf7-form input[type='submit'], .wpcf7-form button").click(function(event) {
jQuery( document ).one( "ajaxComplete", function(event, xhr, settings) {
var data = xhr.responseText;
var jsonResponse = JSON.parse(data);
// console.log(jsonResponse);
if(! jsonResponse.hasOwnProperty('into') || $('.wpcf7' + jsonResponse.into).length === 0) return;
// alert(jsonResponse.message);
$.fancybox.open(
'<div class="message"><div class="result popup__result"><div class="result__succes result__item"><div class="result__wrapper"><div class="result__title"><div class="title title_big"><span>Успех!</span></div><div class="title title_small"><span>Ваша заявка успешно отправлена! </span><br><span>Я свяжусь с вами в ближайшее время.</span></div></div><div class="result__controls"><div data-fancybox-close class="btn btn_bg_pink"><span>Вернуться на сайт</span></div></div></div></div></div></div>',
{
smallBtn : true,
toolbar : false
}
);
});
});
</script>
<style>
div.wpcf7-response-output, div.wpcf7-validation-errors { display: none !important; }
span.wpcf7-not-valid-tip { display: none; }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: #ff2c00; // background-color: rgba(153,0,0,0.3); }
</style>
EOT;
echo $return;
}
add_action( 'wp_footer', 'ContactForm7_popup', 20 );
<!-- Карточки Начало цикла-->
<?php $penis = get_the_ID(); ?>
<?php
$sort = $_COOKIE["catalog_sort"];
$show_count = (int)$_COOKIE["catalog_show_count"];
$sort = str_replace('\\', "", $sort);
$sort = json_decode($sort, true);
if(!$show_count)
$show_count = 24;
$queryArr = array(
'post_type' => 'page',
'post_parent' => $penis,
'meta_query' => array(
"template" => array(
"key" => "_wp_page_template",
"value" => "templates/catalogue_detail.php",
"type" => 'NUMERIC'
),
),
'paged' => $currPage,
'posts_per_page' => $show_count,
'order' => strtoupper($sort["type"]),
);
if($sort)
{
switch ($sort["by"]) {
case 'alphabet':
$queryArr["orderby"] = "title";
break;
case 'price':
$queryArr["meta_key"] = "item_price";
$queryArr["orderby"] = "meta_value_num";
break;
}
}
$query = new WP_Query( $queryArr );
while ($query->have_posts()) : $query->the_post();?>
<?php $aidi = get_the_ID(); ?>
<section class="section timetable">
<div class="section__top section__top_page contacts__top" style="background-image: url('<?php the_field( "картинкарррррррррр" );?>')">
<div class="section__content"></div>
<svg class="section__triangle" viewbox="0 0 1000 105" preserveaspectration="none">
<polygon class="section__polygon" points="0,10 0,105 800,105 800,120"></polygon>
<polygon class="section__polygon" points="1000,0 1000,105 500,105 500,85"></polygon>
</svg>
</div>
<div class="section__bottom graphics__bottom graphics__bottom_padding">
<div class="section__wrapper courses__bg">
<div class="section__content section__content_min">
<div class="courses__wrap">
<h1 class="section__img-desc section__img-desc_black"><?php the_title()?></h1>
</div>
</div>
</div>
<div class="section__content">
<ul class="section__list courses__display">
<li class="section__item courses__item courses__item_one">
<div class="section__item-wrap graphics__item">
<div class="section__img">
<div class="section__img-pic" style="background-image: url('<?php the_post_thumbnail_url() ?>')"></div>
<div class="section__img-desc courses__img-desc"><?php the_title()?></div>
</div>
<div class="section__desc">
<div class="courses__desc-wrap">
<div class="courses__text section__text"><?php the_content(); ?></div>
<div class="courses__num-lesson courses__title-num_darken"><?php the_field( "urokiaaa" );?></div>
</div>
<div class="section__controls"><a class="courses__btn section__btn section__btn_darken" href="<?php the_permalink(); ?>">подробнее</a></div>
</div>
</div>
</li>
</ul>
</div> </div>
</section>
<?php
endwhile;
wp_reset_query();
?>
<!-- Конец цикла -->