Home Forums WoodMart support forum Dynamic Size Guide Title on Product Page

Dynamic Size Guide Title on Product Page

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #468279

    Cioppi88
    Participant

    Hi guys,
    I’m looking a solution in order to display Dynamic Title on Size Guide text.
    What I’d like to archive is to show, instead the text “Size Guide”, the text filled in Title of each Size guides I have created on backend in Products > Size Guides.

    Is it possible?
    I’m trying to edit the template from /wp-content/themes/woodmart/inc/integrations/woocommerce/modules/size-guide.php

    It should be great to customize this output and use on child theme in order to avoid losing all customization.
    It should be great if we can choose the icon too.

    How can I made it?
    Thanks

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

    Luke Nielsen
    Keymaster

    Hello,

    Sorry to say but right now there is no option in Theme Settings available to achieve that. It requires Customization and this is beyond our limitations and support policy scope.

    If you’d like to contact us, we are here for whatever questions you may have.

    Best Regards.

    #473094

    Cioppi88
    Participant

    Sorry but the code I see seems should be works as I mention:

    <div class="wd-sizeguide<?php echo esc_attr( $wrapper_classes ); ?>">
    			<?php if ( $sguide_post->post_title && $element_args['title'] ) : ?>
    				<h4 class="wd-sizeguide-title">
    					<?php echo esc_html( $sguide_post->post_title ); ?>
    				</h4>
    			<?php endif; ?>
    
    			<?php if ( $sguide_post->post_content && $element_args['description'] ) : ?>
    				<div class="wd-sizeguide-content">
    					<?php echo do_shortcode( $sguide_post->post_content ); ?>
    				</div>
    			<?php endif; ?>

    The wd-sizeguide-title should grab the title from the backend instead of put a static text.
    How can I cahnge this code in order to work with title putted in backend?

    #473102

    Cioppi88
    Participant

    I try to change the code with this snippet:

    <?php if ( $sguide_post->post_title && $element_args['title'] ) : ?>
        <h4 class="wd-sizeguide-title">
            <?php echo get_the_title( $sguide_post->ID ); ?>
        </h4>
    <?php endif; ?>

    But nothing change

    #473114

    Cioppi88
    Participant

    I found a solution to get what I need, I update the file with changing in order to works fine.
    I changed the file size-guide.php from /wp-content/themes/woodmart/inc/integrations/woocommerce/modules.
    I changed this lines:

    <h4 class="wd-sizeguide-title">
    					<?php echo esc_html( $sguide_post->post_title ); ?>
    				</h4>

    with this:

    <h4 class="wd-sizeguide-title">
    					<?php echo get_the_title( $sguide_post->ID ); ?>
    				</h4>

    and this:

    <a class="wd-open-popup" rel="nofollow" href="#woodmart_sizeguide">
    					<span><?php esc_html_e( 'Size Guide', 'woodmart' ); ?></span>
    				</a>

    to this:

    				<a class="wd-open-popup" rel="nofollow" href="#woodmart_sizeguide">
    					<span><?php echo get_the_title( $sguide_post->ID ); ?></span>
    				</a>

    I try to use the child theme in order to avoid overriding for the future theme update but even I try to recreate the directory path it doesn’t work.

    Do you have any suggestion?

    #473278

    Luke Nielsen
    Keymaster

    Hello,

    You should return back all your changes and copy this woodmart_sguide_display_table_template to the functions.php file in your child theme with the changes that you did in the parent theme but instead of that code <?php echo get_the_title( $sguide_post->ID ); ?> use this one <?php echo esc_html( $sguide_post->post_title ); ?>.

    Kind Regards

    #473294

    Cioppi88
    Participant

    In which directory do I find this file woodmart_sguide_display_table_template? Or do you mean I need to copy as function?

    #473472

    Luke Nielsen
    Keymaster

    Hello,

    Yes, copy as a function from the inc/integrations/woocommerce/modules/size-guide.php path.

    https://take.ms/eWAG0

    I’d be happy to assist if you have any other questions or concerns.

    Kind Regards

    #473529

    Cioppi88
    Participant

    It works great.
    Thank you so much!

    #473541

    Luke Nielsen
    Keymaster

    Hello,

    You are welcome! In case you need any additional help, I’d be more than happy to assist you.

    Have a good day!

    Kind Regards

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

The topic ‘Dynamic Size Guide Title on Product Page’ is closed to new replies.