Add Custom field in Category page - by kkszeto8

This topic has 17 replies, 2 voices, and was last updated 8 years, 9 months ago ago by Robert Hall

  • Avatar: kkszeto8
    kkszeto8
    Participant
    January 29, 2016 at 09:12

    Hi Good Monring Genuis,

    Could you please help to add custom field between title and price in category page so that i can add different value (text) on each category product?

    2016 01 29 160930

    Thanks
    Keith

    Please, contact administrator
    for this information.
    16 Answers
    Avatar: Robert Hall
    Robert Hall
    Support staff
    January 29, 2016 at 09:58

    Hello,

    You can show the Short Product Description (http://prntscr.com/9waf4a) under the price.
    Also you need to add this code in Global Custom CSS.

    .products-grid .product-excerpt {
        display: block;
    }

    Regards,
    Robert Hall.

    Avatar: kkszeto8
    kkszeto8
    Participant
    January 29, 2016 at 11:10

    Hi Robert,

    Nice to talk with you again !! 🙂

    Actually, i would like to add custom field and write product brand name in the red rectangle only and i dont want to show the short description.

    Or if you have any professional idea how can make the brands into this red rectangle column easily? I tried to buy bramds plugin but it doesn`t work so far.

    Thank you ao much for your support and idea!!

    Regards
    Keith

    Avatar: Robert Hall
    Robert Hall
    Support staff
    January 29, 2016 at 11:55

    You can try to add the following code in \wp-content\themes\woopress\woocommerce\content-product.php file on line 150

    	        <?php  
                    $terms = wp_get_post_terms( $post->ID, 'brand' );
                    if(count($terms)>0) {
                        ?>
                        <div class="custom-product-brands">
                            <?php foreach($terms as $brand) { ?>
                                    <a href="<?php echo get_term_link($brand); ?>">
                                        <?php 
                                            echo $brand->name;
                                         ?>
                                    </a>
                            <?php } ?>
                        </div>
                        <?php 
                    }
                ?> 

    after this code

    <?php if (etheme_get_option('product_page_productname')): ?>
                    <div class="product-title">
                       <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
                    </div>
    	        <?php endif ?>

    Please see screenshot how it should be http://prntscr.com/9wbin9

    Also we recommended to do it in the Child Theme.
    We have already created and included child theme in theme package. You just need to find woopress-child folder in theme package and upload it to /wp-content/themes/ folder of your server.

    Please copy content-product.php file into it saving folder structure like:
    wp-content/themes/woopress_child/woocommerce/content-product.php and make changes there.

    Regards,
    Robert Hall.

    Avatar: kkszeto8
    kkszeto8
    Participant
    January 29, 2016 at 12:36

    You are the best of the best!!

    So means i just upload content-product.php in child theme and adding the code in child theme. Am i correct?

    1 more question, could you please show me which coding that you provided i can modify it if i want to put the brands name at title above or under price in category page in future?

    Thank you for you professional support always.

    Thanks
    Keith

    Avatar: Robert Hall
    Robert Hall
    Support staff
    January 29, 2016 at 13:18

    Yes, correct. If you’ll have the problems with adding code in content-product.php file then provide us with FTP credentials in Private Content and we’ll help you to add this code.
    To display a brand name below the price you need add our code below the following part of code.

                <?php
                    /**
                     * woocommerce_after_shop_loop_item_title hook
                     *
                     * @hooked woocommerce_template_loop_rating - 5
                     * @hooked woocommerce_template_loop_price - 10
                     */
                    if (etheme_get_option('product_page_price')) {
                        do_action( 'woocommerce_after_shop_loop_item_title' );
                	}
                ?> 

    See here: http://prntscr.com/9wcfhc

    Regards,
    Robert Hall.

    Avatar: kkszeto8
    kkszeto8
    Participant
    January 30, 2016 at 05:50

    Hi Robert,

    You are my star!
    It would be fantastic if you can upload for me. No need upload the code for “ display brand name below the price”.

    And can you also adding code in css to change fonts and color for this brand name column so that i can edit anytime?

    Just in case if remove this brand name in category page in the future, i just delete the code in content-product.php at child theme, am i correct?

    Thank you so much from my heart!

    Regards
    Keith

    Please, contact administrator
    for this information.
    Avatar: kkszeto8
    kkszeto8
    Participant
    February 1, 2016 at 09:30

    Hi Robert,
    You are my star!
    It would be fantastic if you can upload for me. No need upload the code for “ display brand name below the price”.

    And can you also adding code in css to change fonts and color for this brand name column so that i can edit anytime?

    Just in case if remove this brand name in category page in the future, i just delete the code in content-product.php at child theme, am i correct?

    Thank you so much from my heart!

    Regards
    Keith

    Avatar: Robert Hall
    Robert Hall
    Support staff
    February 1, 2016 at 11:25

    Hello,

    I’ve created the Child Theme and added code above. Also added CSS style for brand name.

    .custom-product-brands{
    margin-bottom:15px;
    font-family:Arial;
    font-size: 14px;
    }
    .custom-product-brands a{
    color: red;
    }

    This isn’t a custom field. The brand name comes from product settings->brands. See screenshot: http://prntscr.com/9xk333

    Regards,
    Robert Hall.

    Avatar: kkszeto8
    kkszeto8
    Participant
    February 2, 2016 at 05:52

    Hi Robert,

    Good Morning!
    Thanks for your magic hands to save my life!

    From our previous conversation, can the brand name swap with Product Title means display Brand Name in fist column & Product Title is in second column. could you mind show me the code that I can paste into chidl CSS if need change in the future?

    And Just in case if remove this brand name in category page in the future, i just delete the code in content-product.php at child theme, am i correct?

    Thank you again and have a great day!

    Avatar: Robert Hall
    Robert Hall
    Support staff
    February 2, 2016 at 08:27

    Hello,

    From our previous conversation, can the brand name swap with Product Title means display Brand Name in fist column & Product Title is in second column. could you mind show me the code that I can paste into chidl CSS if need change in the future?

    Do you mean to disaply it like on this screenshot? http://prntscr.com/9xy8s9

    And Just in case if remove this brand name in category page in the future, i just delete the code in content-product.php at child theme, am i correct?

    Yes, you’re correct.

    Regards,
    Robert Hall.

    Avatar: kkszeto8
    kkszeto8
    Participant
    February 2, 2016 at 10:55

    Hi Robert,

    Thank you for your assit with this matter!

    Here is the screenshot and it would be great if can use your magic to write the code for me so I can update into Child CCS easily in the future.

    First column: Brand Name
    Second Column: Product Name
    And could you please make smaller gap between brand name and Product name?
    2016 02 02 174226

    Thanks
    Keith

    Avatar: Robert Hall
    Robert Hall
    Support staff
    February 2, 2016 at 11:03

    I’ve made changes in the Child Theme files. Please check it.

    Regards,
    Robert Hall.

    Avatar: kkszeto8
    kkszeto8
    Participant
    February 2, 2016 at 11:18

    Heartful thank you for your help and make it for me.

    Is that possible to make the gap thinner between Brand Name and Produt title in Desktop mode only?

    Thanks
    Keith

    Avatar: kkszeto8
    kkszeto8
    Participant
    February 2, 2016 at 11:59

    Adn also, How can change product name fonts as same as Brand name in category page?

    Thank you so much!!

    Regards
    Keith

    Avatar: kkszeto8
    kkszeto8
    Participant
    February 2, 2016 at 12:31

    Many Thanks Robert!!

    Thank you for you hardworking and everytime you setup the code for me to save my time and life.

    🙂
    You can close the case!!!
    Thank always
    Keith

    Avatar: Robert Hall
    Robert Hall
    Support staff
    February 2, 2016 at 12:34

    You’re welcome and have a good day!

    Regards,
    Robert Hall.

  • Viewing 17 results - 1 through 17 (of 17 total)

The issue related to '‘Add Custom field in Category page’' has been successfully resolved, and the topic is now closed for further responses

8theme customization service

Helpful Topics

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.