Hiding a Post on a wordpress post page using tags
I have a wordpress website that; based on the category selected will
display in a grid format across a single page, hiding the content (you can
click on read more to get a fancybox pop-up with the rest of the content
contained within).
Currently There are controls to increase usability this is done via the
tags: Colspan_# to increase
I am trying to create a hide tag to hide a post from the page so I can
call it later on in the page using the fancy box.
I need to add a "hide" tag to the code below
Any help is appreciated!
Tag code is here:
<script type="text/javascript">
$(document).ready(function() {
var content_limit = 200;
$(".readmore").fancybox({
maxWidth : 500,
maxHeight : 400,
fitToView : false,
width : '70%',
height : '70%',
autoSize : false,
closeClick : false,
openEffect : 'none',
closeEffect : 'none'
});
$('.faqtable').find('.faqcontent').each(function(){
if ($(this).html().length > content_limit &&
$(this).find('img, a').length == '0' &&
!$(this).hasClass('full_content')) {
var title = $(this).parent().find('span');
var slug = title.attr('id');
console.log($.trim(title.html()).length);
//Store the full content in a hidden div
if ($.trim(title.html()).length == 0) {
$('#pages_content').append('<div
id="fancybox_'+slug+'"
class="readmore_content"
style="display:none"><h3
class="readmore_title"></h3>'+$(this).html()+'</div>');
} else {
$('#pages_content').append('<div
id="fancybox_'+slug+'"
class="readmore_content"
style="display:none"><h3
class="readmore_title">'+title.html()+'</h3>'+$(this).html()+'</div>');
}
//Check to see if there is a colspan (so we
can increase the max chars allowed
if ($(this).parent().attr('colspan')) {
var content_limit_temp =
content_limit*parseInt($(this).parent().attr('colspan'));
} else {
var content_limit_temp = content_limit;
}
//replace and add a more...
var after_space = ($(this).html().substring(0,
content_limit_temp).lastIndexOf(" "))+1;
$(this).html($(this).html().substring(0,
after_space));
$(this).append('<a href="#fancybox_'+slug+'"
class="readmore">...</a>');
}
});
});
</script>
No comments:
Post a Comment