add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 250, 250 );
function true_remove_default_sizes( $sizes ) {
unset( $sizes[ 'medium' ] );
unset( $sizes[ 'large' ] );
unset( $sizes[ 'medium_large' ] );
unset( $sizes[ '1536x1536' ] );
unset( $sizes[ '2048x2048' ] );
return $sizes;
}
add_filter( 'big_image_size_threshold', '__return_false' );
function replace_uploaded_image($image_data) {
if (!isset($image_data['sizes']['thumbnail'])) return $image_data;
$upload_dir = wp_upload_dir();
$uploaded_image_location = $upload_dir['basedir'] . '/' .$image_data['file'];
$current_subdir = substr($image_data['file'],0,strrpos($image_data['file'],"/"));
$thumbnail_image_location = $upload_dir['basedir'] . '/'.$current_subdir.'/'.$image_data['sizes']['thumbnail']['file'];
unlink($uploaded_image_location);
rename($thumbnail_image_location,$uploaded_image_location);
$image_data['width'] = $image_data['sizes']['thumbnail']['width'];
$image_data['height'] = $image_data['sizes']['thumbnail']['height'];
unset($image_data['sizes']['thumbnail']);
return $image_data;
}
add_filter('wp_generate_attachment_metadata','replace_uploaded_image');
function mytheme_add_woocommerce_support() {
add_theme_support( 'woocommerce' );
}
add_action( 'after_setup_theme', 'mytheme_add_woocommerce_support' );
single.php
будет приоритетнее по отношению к single-product.php
в подпапке темы$order = new WC_Order($order_id);
$order_email = $order->billing_email;
$email = email_exists( $order_email );
$user = username_exists( $order_email );
$random_password = wp_generate_password();
$userdata = array(
'user_pass' => $random_password,
'user_login' => $order_email,
'first_name' => $order->billing_first_name,
'user_email' => $order_email,
'role' => 'customer',
);
$userid = wp_insert_user( $userdata );
<div class="slider grid-row" >
while ( $loop->have_posts() ): $loop->the_post(); ?>
<div class="grid-col">
<div class="img-wrapper">
<?php if ( has_post_thumbnail()) {
the_post_thumbnail('full','class=img-fluid');
} ?>
</div>
<?php endwhile; wp_reset_postdata(); ?>
</div>
{
breakpoint: 480,
settings: "unslick"
}
@media (max-width: 480px) {
.product-row {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
margin-right: -15px;
margin-left: -15px;
}
.product-col-6 {
-webkit-box-flex: 0;
-ms-flex: 0 0 50%;
flex: 0 0 50%;
max-width: 50%;
position: relative;
width: 100%;
min-height: 1px;
padding-right: 15px;
padding-left: 15px;
}
}
function shortcode_function() {
ob_start();
$args = array(
'numberposts' => 5,
'category' => 0,
'orderby' => 'date',
'order' => 'DESC',
'meta_key' => '',
'meta_value' =>'',
'post_type' => 'movies',
'suppress_filters' => true,
);
$posts = get_posts( $args );
$cont = 0;
foreach( $posts as $post ){
setup_postdata($post);
?>
<li><a href="<?php echo $post->guid; ?>"><?php echo $post->post_title; ?></a></li>
<?php }
$cont = ob_get_clean();
return $cont;
}
add_shortcode( 'show_films', 'shortcode_function' );
$_SERVER['HTTPS']='on';
RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [R=301,L]
RewriteCond %{SERVER_PORT} !^443
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ https://yourdomain.by%{REQUEST_URI} [R=301,L]
RewriteCond %{HTTP:X-SSL-Emu} !on
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
For getting the current pagination number on a static front page (Page template) you have to use the 'page' query variable: Ссылка на источник
if ( is_front_page() ) {
$paged = (get_query_var('page')) ? get_query_var('page') : 1;
} else {
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
}
<span class="dashicons-before folder"><?php
$categories = get_the_terms( $post->ID, APP_TAX_CAT );
foreach ($categories as $category) {
if(!$category->parent)
{
echo "<a href='/ad-category/".urlencode(mb_strtolower($category->name)). "/' rel='tag' class='cp-fixed-color'>". $category->name. "</a>";
}
}
?></span>
$args = array(
'post_type' => APP_POST_TYPE,
'ignore_sticky_posts' => true,
'meta_query' => array(
'relation' => 'AND',
array('key' => 'cp_category',
'value' => 'Шины',
'compare' => '!='
),
array('key' => 'cp_new',
'compare' => 'NOT EXISTS'
)
),
);
$categories = get_posts( $args );
<div class="yellow"></div>
<div class="col-full">
<table class="shop_table shop_table_responsive cart woocommerce-cart-form__contents" cellspacing="0">
<thead>
<tr>
<th class="product-thumbnail">
<h1 class="entry-title">Корзина</h1>
</th>
<th class="product-name">Обработка заказов производится<br>с 09:00 до 18:00</th>
<th class="product-subtotal">Итого</th>
<th class="product-remove"><button>Оформить заказ</button></th>
</tr>
</thead>
<tbody>
<tr class="woocommerce-cart-form__cart-item cart_item">
<td class="product-thumbnail">
thumbnail
</td>
<td class="product-name" data-title="Товар">
Товар
</td>
<td class="product-subtotal" data-title="Итого">
Итого
</td>
<td class="product-remove">
Удалить эту позицию</td>
</tr>
</tbody>
</table>
</div>
.col-full {
position:relative;
z-index:999;
width: 980px;
margin-right:50px;
margin-left:50px;
}
.yellow {
position: absolute;
width: 100%;
height: 82px;
background-color: yellow;
z-index: 1;
}
thead {
background-color:yellow;
}
add_action( 'init', 'jk_remove_storefront_header_search' );
function jk_remove_storefront_header_search() {
remove_action( 'storefront_header', 'storefront_product_search', 40 );
}
add_action('init','removeOldFunction');
function removeOldFunction(){
remove_action( 'template_redirect', 'alienship_nice_search_redirect' );
}