Thai
Thai

Reputation: 49

Adding WooCommerce Hooks to a Wordpress page

I'm trying to build a one-page website using wordpress and WooCommerce. The page will have four major blocks :

1- Intro text : cold content inserted in a page

2- A certain category of posts, in a slider

3- A different category of posts, in a slider

4- Shop : Grid view off all the products in the shop.

Here's something that would work sort of like i want (sorry for the design of that thing, it's brutal!) : http://westy.premiumcoding.com/

For that, i create an almost empty page-home.php file, as well as an empty "home" page that i set as default front page.

To hook the part 1, i think it's easy to grab the content of a precise page For parts 2 and 3, i'll create loops withing my php file, with some get_post tricks

The big issue is for part 4 : how do we access WooCommerce content from the template, directly in a php page?

Thanks to everyone for the hints!

Upvotes: 0

Views: 262

Answers (1)

Manohar singh
Manohar singh

Reputation: 509

You can make use of this code in you php file to list the needed woocommerce products

<?php
    echo do_shortcode('[product_category category="category name" per_page="12"  columns="2"]'); 
    ?>

Upvotes: 4

Related Questions