Forum Replies Created

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • Hey – I don’t know if anyone will find this usefull or not but I found a way to add tabs beside the Description tab and then populate them with custom fields which I add on the edit product page. The custom field will support shortcodes as well and the tab will not display if it is empty. Anyway, I had tried the info mentioned above but the link no longer works. Here is what I did ….

    (now if only we could get away with adding new tabs and content in the product data box itself instead of using custom fields)

    STEP 1

    For each new Tab that you want you need to create 2 new pages. (My example below is creating a “Specifications” Tab)

    Create new files here … /plugins/woocommerce/templates/single-product/tabs/

    One is for the Tab Label the other is for the Tab Content.

    specifications.php <-contains tab contents

    <?php
    /**
    * Specifications Tab
    */
    global $woocommerce, $post;
    $meta_content = apply_filters('the_content', get_post_meta($post->ID, 'specifications', true));
    ?>
    <div class="panel" id="tab-specifications">
    <?php $heading = apply_filters('woocommerce_product_specifications_heading', __('Product Specifications', 'woocommerce')); ?>
    <h2><?php echo $heading; ?></h2>
    <?php echo $meta_content; ?>
    </div>

    tab-specifications.php <-contains actual tab label text

    <?php
    // Get Custom Field "specifications" meta data and hide tab if empty
    global $woocommerce, $post;
    $meta_content = apply_filters('the_content', get_post_meta($post->ID, 'specifications', true));
    if (!empty($meta_content)) { ?>
    <li><a href="#tab-specifications"><?php _e('Specifications', 'woocommerce'); ?></a></li>
    <?php } ?>

    STEP 2

    Add your tabs to the woocommerce template here … /plugins/woocommerce/woocommerce-template.php

    Starting at line 375 you should see function definitions for “Product page tabs” and “Product page tab panels”.

    Add your new tab and panel there ….

    // THIS IS MY NEW SPECIFICATIONS TAB
    if (!function_exists('woocommerce_product_specifications_tab')) {
    function woocommerce_product_specifications_tab() {
    woocommerce_get_template('single-product/tabs/tab-specifications.php');
    }
    }
    // THIS IS MY NEW SPECIFICATIONS PANEL
    if (!function_exists('woocommerce_product_specifications_panel')) {
    function woocommerce_product_specifications_panel() {
    woocommerce_get_template('single-product/tabs/specifications.php');
    }
    }

    STEP 3

    Add hooks to your new tabs here … /plugins/woocommerce/woocommerce-hooks.php

    Starting at line 73, add your backticks in the “Product page tabs” sections

    add_action( 'woocommerce_product_tabs', 'woocommerce_product_specifications_tab', 40 );
    add_action( 'woocommerce_product_tab_panels', 'woocommerce_product_specifications_panel', 40 );

    STEP 4

    Edit your product and “Add New Custom Field” and its “Value”

    That is it – you should be done!

    Hi Guys – I would LOVE to get this working. I just tried this and it almost worked but I got the following error …

    Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, ‘rightside_woocommerceproduct_sidebar’ was given in /home/content/24/8177724/html/wp-includes/plugin.php on line 405

    So my guess is that it is looking for a sidebar that does not yet exits? Is that correct?

    How do I add this sidebar?

    Your help would really be appreciated!

    PS – I did manage to do something useful that I think others would appreciate … I managed to add my own product information tabs, then added custom field for that tab, and finally disiplay that custom field so that utilizes shortcodes!

    in reply to: Query Portfolio Related Posts in Sidebar #36585

    I have a solution, but it is not that elegantly coded …

    I added an Executable PHP Widget to the theme. Added that widget to the Sidebar Blog. And then added the following PHP code to the widget …

    Code:
    <?
    //parameters for querying portfolio entries
    global $more;
    $more = 0;
    $overview_post_id = $post->ID;
    $posts_per_page = 9999;
    $query_string = “posts_per_page=”.$posts_per_page;
    $query_string .= “&post_type=portfolio”;
    $query_string .= “&orderby=title&order=ASC”;
    if(isset($useTemplate)) $query_string .= “&portfolio_entries=”.$useTemplate;
    // send query
    $additional_loop = new WP_Query($query_string);
    echo “<div id=”nav_menu-2″ class=”box_small box widget widget_nav_menu”><div class=”menu-main-container”><ul id=”menu-main-1″ class=”menu”>”;
    while ($additional_loop->have_posts()) : $additional_loop->the_post();
    echo “<li class=”menu-item menu-item-type-post_type”>“.get_the_title().”“;
    endwhile;
    wp_reset_query();
    echo “</div></div>”;
    ?>

    in reply to: Query Portfolio Related Posts in Sidebar #36584

    I too would really like to see an actual answer to this question (How do I create a sorted ordered list of portfolio post titles with links to posts). I have looked at both links provided – but neither actually helps. These pages help you list the the taxonomy categories – but not the actual posts within that category. I have installed 3 different taxonomy plugins/widgets and they all do the same thing – they list the portfolio category name. Anyone?

Viewing 4 posts - 1 through 4 (of 4 total)