I would like to have a page like page.php to display the content of the shop page. How can i do it?
I copied everything from woocommerce/archive-product.php in to page.php but nothing is beeing displayed.
I would like to have a page like page.php to display the content of the shop page. How can i do it?
I copied everything from woocommerce/archive-product.php in to page.php but nothing is beeing displayed.
Share Improve this question asked Apr 19, 2019 at 7:50 Alessandro CraciunAlessandro Craciun 11 Answer
Reset to default 0Personally i would create a custom template and not use page.php and add a simply product loop
Quick break down
create new template called customshop.php
<?php /* Template Name: Custom Shop */ ?>
add your shop loop
<ul class="products">
<?php
$args = array(
'post_type' => 'product',
'posts_per_page' => 12
);
$loop = new WP_Query( $args );
if ( $loop->have_posts() ) {
while ( $loop->have_posts() ) : $loop->the_post();
wc_get_template_part( 'content', 'product' );
endwhile;
} else {
echo __( 'No products found' );
}
wp_reset_postdata();
?>
</ul><!--/.products-->
create your new page in pages and change your template to your new page in the drop down
logic behind adding the loop as a custom template is purely for neatness and you may want a variety of custom templates and adding customshop.php means you can add lots more and you are keeping your structure neat