0
votes

I'm creating a custom theme for the product single page for the books category. I'm using the themerex bookshleft theme for wordpress and the plugin addicional tags (themerex too) that add the author tags for every book. But I would like to show the author biography in the single book page and not only the link of the autor that appear in the woocommerce single product summary between the meta info. I tryed insert this hook in the content-single-product-books.php file but not working:

<div class="col2-responsive" style="float:left;">
    <h3>O autor</h3>
    <?php   
    add_action('woocommerce_author', 'themerex_book_author', 10);
    do_action('woocommerce_author', 'themerex_book_author', 10);

    ?>
</div>

Additional tags plugin created this hook themerex_book_author in the addicional tags file in line 53:

    //Hook into the 'init' action
    add_action('init', 'themerex_book_author', 0);

The funcion for this hook is this one:

if (!function_exists('themerex_book_author')) {
                function themerex_book_author()
                {

                    themerex_require_data('taxonomy', 'authors', array(
                            'post_type' => array('product'),
                            'hierarchical' => true,
                            'labels' => array(
                                'name' => _x('Authors', 'Taxonomy General Name', 'themerex'),
                                'singular_name' => _x('Author', 'Taxonomy Singular Name', 'themerex'),
                                'menu_name' => __('Author', 'themerex'),
                                'all_items' => __('All Authors', 'themerex'),
                                'parent_item' => __('Parent Author', 'themerex'),
                                'parent_item_colon' => __('Parent Author:', 'themerex'),
                                'new_item_name' => __('New Author Name', 'themerex'),
                                'add_new_item' => __('Add New Author', 'themerex'),
                                'edit_item' => __('Edit Author', 'themerex'),
                                'update_item' => __('Update Author', 'themerex'),
                                'separate_items_with_commas' => __('Separate authors with commas', 'themerex'),
                                'search_items' => __('Search authors', 'themerex'),
                                'add_or_remove_items' => __('Add or remove authors', 'themerex'),
                                'choose_from_most_used' => __('Choose from the most used authors', 'themerex'),
                            ),
                            'show_ui' => true,
                            'show_admin_column' => true,
                            'query_var' => true,
                            'rewrite' => array('slug' => 'authors')
                        )
                    );

                }
            }

but I don't know how to use it in my custom template for single book page. I thanks any help!

1

1 Answers

1
votes
<div class="col2-responsive" style="float:left;">
<h3>O autor</h3>
  <?php   
     do_action('woocommerce_author', 'themerex_book_author', 10);
  ?>

just use do action in single product page And trigger your fuctions code in add_action hook in fuctions.php or in your plugin. then this code will automatically fire in the do action

    add_action('woocommerce_author', 'themerex_book_author', 10);
if (!function_exists('themerex_book_author')) {
            function themerex_book_author()
            {

                themerex_require_data('taxonomy', 'authors', array(
                        'post_type' => array('product'),
                        'hierarchical' => true,
                        'labels' => array(
                            'name' => _x('Authors', 'Taxonomy General Name', 'themerex'),
                            'singular_name' => _x('Author', 'Taxonomy Singular Name', 'themerex'),
                            'menu_name' => __('Author', 'themerex'),
                            'all_items' => __('All Authors', 'themerex'),
                            'parent_item' => __('Parent Author', 'themerex'),
                            'parent_item_colon' => __('Parent Author:', 'themerex'),
                            'new_item_name' => __('New Author Name', 'themerex'),
                            'add_new_item' => __('Add New Author', 'themerex'),
                            'edit_item' => __('Edit Author', 'themerex'),
                            'update_item' => __('Update Author', 'themerex'),
                            'separate_items_with_commas' => __('Separate authors with commas', 'themerex'),
                            'search_items' => __('Search authors', 'themerex'),
                            'add_or_remove_items' => __('Add or remove authors', 'themerex'),
                            'choose_from_most_used' => __('Choose from the most used authors', 'themerex'),
                        ),
                        'show_ui' => true,
                        'show_admin_column' => true,
                        'query_var' => true,
                        'rewrite' => array('slug' => 'authors')
                    )
                );

            }
        }