Home Forums WoodMart support forum How to add Author Name in the Product Page

How to add Author Name in the Product Page

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #586076

    garg.abhisar
    Participant

    Hi Team,

    I am creating a book store, I want to add Author name just under the book name. How can I achive it ?

    Sample Image attached.

    Attachments:
    You must be logged in to view attached files.
    #586095

    garg.abhisar
    Participant

    attached few more screenshots for reference.

    Attachments:
    You must be logged in to view attached files.
    #586193

    Hello,

    Sorry, but there is no option available for that in Theme Settings.

    It requires customizations and this is beyond our limitations and support policy.

    Regards.
    Xtemos Studios

    #589281

    garg.abhisar
    Participant

    okay. Thanks.

    I have done it, if you want to know how I did it, let me know.

    Thanks
    Abhisar

    #589419

    Hello,

    Yes, please explain the solution here so in future if any one required this same feature, it will help full.

    Best Regards.

    #589469

    garg.abhisar
    Participant

    Step 1: Create a Custom Field using “Add New Custom Field” in Single Product Page named as “AuthorName” and give its value. (Screenshot Attached.)

    Step 2: Add the following code in fucntion.php File

    // Display custom field on the single product page
    function display_custom_product_field() {
        global $post;
        $custom_field_value = get_post_meta( $post->ID, 'AuthorName', true );
        if ( ! empty( $custom_field_value ) ) {
            echo '<div class="custom-product-field" style="margin-top: -15px;"><strong>Author: </strong>' . esc_html( $custom_field_value ) . '</div>';
        }
    }
    add_action( 'woocommerce_single_product_summary', 'display_custom_product_field', 5 );

    ——-
    Output Image attached.
    ——-
    You can close this Ticket for now.

    Attachments:
    You must be logged in to view attached files.
    #589568

    Hello,

    Thanks for sharing the solution with all of us.

    I’m so happy to hear you are pleased with the Theme and Support. XTEMOS strives to deliver the best customer experience, and it makes our day to hear we have accomplished that.

    We count ourselves lucky to have you as a customer. You can always reach us at any time. We are always here to help you.

    Thanks for contacting us.
    Have a great day.

    Topic Closed.
    Best Regards.

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

The topic ‘How to add Author Name in the Product Page’ is closed to new replies.