Меняем вид корзины WooCommerce

По умолчанию у нас за вид страницы корзины отвечает шаблон page.php в корне нашей темы. Мы можем изменить этот файл, либо создать свой шаблон для корзины, но тогда в свойствах страницы нам нужно будет указать нужный шаблон.

По умолчанию page.php выглядит так:

page.php

<?php
/**
 * The template for displaying all pages
 *
 * This is the template that displays all pages by default.
 * Please note that this is the WordPress construct of pages
 * and that other 'pages' on your WordPress site may use a
 * different template.
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
 *
 * @package DostavkaElki
 */

get_header();
?>

	<main id="primary" class="site-main">

		<?php
		while ( have_posts() ) :
			the_post();

			get_template_part( 'template-parts/content', 'page' );

			// If comments are open or we have at least one comment, load up the comment template.
			if ( comments_open() || get_comments_number() ) :
				comments_template();
			endif;

		endwhile; // End of the loop.
		?>

	</main><!-- #main -->

<?php
get_sidebar();
get_footer();

Меняем его, но учтите, что внесенные изменения будут применены ко всем страницам, которые используют шаблон "Шаблон по умолчанию", если мы хотим, что бы поменялась только корзинга, то тогда нам нужно создать новый шаблон именно только для корзины. В данном примере мы будем менять общий шаблон для страниц page.php.

Новый page.php 

<?php
/**
 * The template for displaying all pages
 *
 * This is the template that displays all pages by default.
 * Please note that this is the WordPress construct of pages
 * and that other 'pages' on your WordPress site may use a
 * different template.
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
 *
 * @package DostavkaElki
 */

get_header();
?>





	<div class="uk-page-001">
		<div class="uk-page-001-content uk-margin-auto">
			<div class="uk-page-001-bannerblock uk-page-001-katalog-bannerblock uk-flex uk-flex-column uk-flex-between" style="background-image: url(/wp-content/themes/dostavkaelki/assets/images/mainfon_page.jpg);">
			<div class="uk-page-001-title">
			<h1 class="uk-page-001-title-maintext"><?php single_post_title(); ?></h1>
			</div>
			</div>
		</div>
	</div>





    <div class="uk-page-002">
		<div class="uk-page-002-content uk-margin-auto" style="text-align: justify;">
            
		<?php
		while ( have_posts() ) :
			the_post();

			get_template_part( 'template-parts/content', 'page' );

			// If comments are open or we have at least one comment, load up the comment template.
			if ( comments_open() || get_comments_number() ) :
				comments_template();
			endif;

		endwhile; // End of the loop.
		?>
			
        </div>
    </div>






    <div class="uk-separator"></div>





<?php
get_footer();

На этом все, добавляем только стили для нашей страницы "Корзина". 

Так же с моим портфолио можно ознакомиться на любой из представленной социальной сети, на своих страницах я публикую посты о своих работах, заданиях и целях.

Для связи со мной можно воспользоваться любой социальной сетью,
любым мессенджером, позвонить или написать на почту:

С моим резюме можно ознакомиться по ссылке:

© 2020-2023 Портфолио Юдина Александра г.Пенза. Все права защищены