Home › Forums › WoodMart support forum › Dynamic Size Guide Title on Product Page
Dynamic Size Guide Title on Product Page
- This topic has 9 replies, 2 voices, and was last updated 1 year, 8 months ago by
Luke Nielsen.
-
AuthorPosts
-
May 19, 2023 at 1:12 pm #468279
Cioppi88ParticipantHi 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.phpIt 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?
ThanksAttachments:
You must be logged in to view attached files.May 19, 2023 at 5:03 pm #468356
Luke NielsenKeymasterHello,
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.
June 6, 2023 at 6:08 pm #473094
Cioppi88ParticipantSorry 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?June 6, 2023 at 6:24 pm #473102
Cioppi88ParticipantI 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
June 6, 2023 at 7:52 pm #473114
Cioppi88ParticipantI 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?
June 7, 2023 at 2:49 pm #473278
Luke NielsenKeymasterHello,
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
June 7, 2023 at 3:23 pm #473294
Cioppi88ParticipantIn which directory do I find this file woodmart_sguide_display_table_template? Or do you mean I need to copy as function?
June 8, 2023 at 9:51 am #473472
Luke NielsenKeymasterHello,
Yes, copy as a function from the
inc/integrations/woocommerce/modules/size-guide.php
path.I’d be happy to assist if you have any other questions or concerns.
Kind Regards
June 8, 2023 at 12:13 pm #473529
Cioppi88ParticipantIt works great.
Thank you so much!June 8, 2023 at 12:39 pm #473541
Luke NielsenKeymasterHello,
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
-
AuthorPosts
The topic ‘Dynamic Size Guide Title on Product Page’ is closed to new replies.
- You must be logged in to create new topics. Login / Register