Read More (More Tag) on Single-Product-Page
-
Hello,
since yesterday I am constantly searching for a solution, but now I give up and ask for help here. Maybe I just got something wrong, because I can’t believe my goal should be that hard to achieve.
I am looking for a simple, code based solution to expand text on single product pages. I tried using the integrated more-button, expecting a quick and satisfying result, but then it became hours of struggling with search engines (www.ads-software.com included – I am not able to find anything according to my search queries), studying wordpress codex and even more research.
Do I really need to edit single-product.php to add ‘more’ variable for this?
To avoid scripts/changes to be overwritten by updates I am using a plugin with which I can add php, js and css to my theme. I do not want to use a child-theme.
One solution I found requires to create a div class in single-product.php and I would give it a try.<div class="collapsed-content"> <?php global $more; $temp = $more; $more = false; $short_description = get_the_content( '' ); echo $short_description; $more = $temp; ?></div>
But due to my requirements I need to add this through functions.php. Any hint on how to achieve that? Or is there a more simple way to add a read more button to product descriptions?
Please don’t suggest using a plugin. I would like to learn out of this and improve my scripting abilities. ??Edit:
I left the <!–more–> tag in the description as it is not affecting my layout (ID = more-173):
https://www.gluecklichezwerge.de/produkt/schnullerketten/schnullerkette-mit-namen-glitzerkrone-stern/Thank you so much,
-Bj?rn
The page I need help with: [log in to see the link]
- The topic ‘Read More (More Tag) on Single-Product-Page’ is closed to new replies.