Hi, I have a nicely working fade container, but I would like to use it conditionaly only where it is neccesary for [wpv-post-body]. For example I want to disable it here: hidden link This is OK: hidden link
I am not sure what to use as a conditional. Height of [wpv-post-body]? Rows of [wpv-post-body] and is it even possible? Length of [wpv-post-body]? Or anything else, which would work responsible?
<div id="fade-container">
<div id="fade-content">
[wpv-post-body view_template="None"]
<div class="fade-anchor">
<span class="fade-anchor-text">ZOBRAZIT VÍCE...</span>
</div>
</div>
</div>
<script>
$('.fade-anchor').click(function(e) {
e.preventDefault();
$('#fade-content').css('max-height', 'none');
$('.fade-anchor').remove();
});
</script>
Dear Dave,
There isn't such a built-in feature within Toolset, any workaround for the Height, row or length of [wpv-post-body] will involve custom codes, but according to our support policy we don't provide custom codes support.
Here are my suggestions:
You can create a custom shortcode for it:
https://codex.wordpress.org/Function_Reference/add_shortcode
In this shortcode, get the post content of current post:
https://codex.wordpress.org/Function_Reference/get_the_content
Then count the length of post content:
hidden link
Hi Luo,
I have created custom function by your help. Thank you, it works nice. If anyone need the same:
add_shortcode('postbodylength', 'postbody_length');
function postbody_length() {
$post_body = get_the_content();
$length_count = mb_strlen($post_body);
return $length_count;
}