WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Woocommerce] Not sure about this Hook thing, to intergrate with theme (7 posts)

  1. acknowledged74
    Member
    Posted 1 year ago #

    Hi

    I found http://wcdocs.woothemes.com/codex/third-party-custom-theme-compatibility/

    And frankly I don't understand it.

    The hook method is more involved that using woocommerce_content, but is more flexible. This is similar to the method we use when creating our themes. It’s also the method we use to integrate nicely with Twenty Ten and Eleven.

    By inserting a few lines in your theme’s functions.php file, First unhook the WooCommerce wrappers;

    1.remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10);
    2.remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10);

    Then hook in your own functions to display the wrappers your theme requires;

    add_action('woocommerce_before_main_content', 'my_theme_wrapper_start', 10);
    add_action('woocommerce_after_main_content', 'my_theme_wrapper_end', 10);

    function my_theme_wrapper_start() {
    echo '<section id="main">';
    }

    function my_theme_wrapper_end() {
    echo '</section>';
    }

    Make sure that the markup matches that of your theme. If you’re unsure of which classes or ID’s to use take a look at your theme’s page.php for a guide.

    I've tried adding this to lines 1. onward in the function.php file and nothing happens?

    Please help.

  2. acknowledged74
    Member
    Posted 1 year ago #

    function.php start with

    1. <?php
    /**
    * @package WordPress
    * @subpackage Arapah-WP
    */

    /*
    * Loads the Options Panel

    --

    I've tried it before and after the <?php but literally nothing happens ?

  3. Andrew Nevins
    Barrel Rider, Spam Zapper & Volunteer Moderator
    Posted 1 year ago #

    You can receive urgent support here http://jobs.wordpress.net

  4. acknowledged74
    Member
    Posted 1 year ago #

    The top section of my page.php is as follows;

    <section id="maincontent">
    <div class="container">
    <div class="two-thirds column">
    <div class="gutter alpha">
    <section id="primary" class="main">
    <div id="content">

    --

    Where the hook instructions say -
    function my_theme_wrapper_start() {
    echo '<section id="main">';
    }

    I don't understand what I need to change 'my_theme_wrapper_start' or id="main" or both and to what?

    Any advice would be great much appreciated?

  5. acknowledged74
    Member
    Posted 1 year ago #

    I have tried the woocommerce_content() by the way, which works fine but just doesn't provide the functionality I require, so I need to work out the Hook.

  6. acknowledged74
    Member
    Posted 1 year ago #

    I've put

    add_action('woocommerce_before_main_content', 'my_theme_wrapper_start', 10);
    add_action('woocommerce_after_main_content', 'my_theme_wrapper_end', 10);

    function my_theme_wrapper_start() {
    echo '<section id="maincontent">';
    }

    function my_theme_wrapper_end() {
    echo '</section>';
    }

    into my function.php and literally nothing has happened.

    I am actually sitting here getting angry now, wasting my swearword expletive time.

    Woo say contact support but you can't until you have purchased an extension, but if this won't work with my theme I'm not going to buy an extension, complete catch 22 and the instructions,

    " By inserting a few lines in your theme’s functions.php file, First unhook the WooCommerce wrappers;

    1.remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10);
    2.remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10); "

    just doesn't even make sense - comma capital letter what the hell.

    argggggggggggggggggggggggggggggggggggggggggggggggggghhh WordPress is such a pain.

  7. acknowledged74
    Member
    Posted 1 year ago #

    Would someone please take the time to help with this, hopefully someone from Woo.

Topic Closed

This topic has been closed to new replies.

About this Topic