WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
Adding Woocommerce shortcode in PHP to home page of other Theme (7 posts)

  1. finleydesign
    Member
    Posted 1 year ago #

    Ok any whizz kids want to help me, I have a non Wootheme I am using, which I have recently added woocommerce too, with some major CSS work I have managed to get it to work very well regarding products.

    However I would like to use a hook or shortcode in the PHP of the themes home page to show say 10 of all products

    I have tried many methods of php echo do_shortcode etc but it simply breaks the site, must be missing something

    I kind of understand the shortcode does reside in the main wordpress set up so maybe this is the problem

    But any clever chaps want to give me some pointers it would be appreciated

    http://wordpress.org/extend/plugins/woocommerce/

  2. Roy Ho
    Member
    Posted 1 year ago #

    WooCommerce shortcode is not dependent on a wootheme's theme. So it will work on any theme as long as WooCommerce is installed.

    So I am not sure what exact issues you're seeing. So perhaps elaborate on what you mean by "breaks the site".

  3. finleydesign
    Member
    Posted 1 year ago #

    Ok so I am going to home.php and under the last section of post I want to list certain product categories I am using the following

    <?php echo do_shortcode("[product_category category="gold-silver-courses" per_page="12" columns="2" orderby="price" order="desc"]"); ?>

  4. Roy Ho
    Member
    Posted 1 year ago #

    Again, you're not stating how it breaks...Are you seeing errors messages? Are you seeing weird layouts? What?

  5. finleydesign
    Member
    Posted 1 year ago #

    Oops sorry - no the page just goes white and nothing, the site stops working altogether

  6. Roy Ho
    Member
    Posted 1 year ago #

    Try this instead:

    <?php echo do_shortcode('[product_category category="gold-silver-courses" per_page="12" columns="2" orderby="price" order="desc"]'); ?>

    And post your URL, that always helps.

  7. finleydesign
    Member
    Posted 1 year ago #

    Your a star!!! that worked perfectly should have spotted the " "

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.