Tagged: read more tag, Text block
Hi to you all!
I would like to insert a READ MORE tag in a text block. And I’ve found this code from Ismael:
————–
Add something like this in the text block:
This is a paragraph.
<div class=”hide_this”>This is a paragraph hidden initially</div>
Read more
And then add this code in the functions.php file:
add_action(‘wp_footer’, ‘ava_new_custom_script’);
function ava_new_custom_script(){
?>
<script type=”text/javascript”>
(function($) {
function j() {
$(‘.show_button’).click(function() {
$(‘.hide_this’).toggle();
});
}
j();
})(jQuery);
</script>
<?php
}
—–
Which works ‘almost’ ;) It does it just the other way around. First the whole text is visible and when I click READ MORE it hides the paragraph.
What am I missing?
Please help!
Kind regards
capuchin
Hey capuchin,
Thank you for using Enfold.
The “hide_this” container should be hidden on page load. Use this css code.
.hide_this { display: none; }
Best regards,
Ismael
Hello Ismael,
Brilliant! Thank you for your quick response! It works.
Kind regards
capuchin
Hi Ismael
Thanks for all your input so far!
I tried to set it up on my client’s website and I see the Read More tag works but the page always jumps to the top…then you have to scroll
down to the text again. Can you think of a solution for this please?
Please see sample website.
Kind regards
capuchin
Hi,
Glad it worked. :)
Remove the href attribute of the read more text or replace it with a span tag.
<span rel="nofollow">Read more</span>
Best regards,
Ismael
Hi Ismael!
All good! Thx!
You can close this…
Kind regards
capuchin