Last active
July 10, 2018 21:56
-
-
Save kary4/4c7e2493c43cbb1dce9f9dc60f0d8e73 to your computer and use it in GitHub Desktop.
Blog Post Meta
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script id="custom-blog-module"> | |
jQuery( document ).ready(function() { | |
var checkInterval; | |
function blog_custom_meta () { | |
if ((parseInt(jQuery('.wpc-blog').css('opacity')) || jQuery('body').hasClass('archive') || jQuery('body').hasClass('single-post')) > 0.9) { | |
clearInterval(checkInterval); | |
jQuery('.post-meta').each(function(){ | |
var thisTime = jQuery(this).find('.published').html(); | |
var thisCat = jQuery(this).find('a[rel="category tag"]')[0].outerHTML; | |
thisCat = thisCat.replace(/,/g,''); | |
var thisAuthor = jQuery(this).find('.author.vcard').html(); | |
jQuery(this).find('.published').remove(); | |
jQuery(this).find('a[rel="category tag"]').remove(); | |
jQuery(this).find('.author.vcard').remove(); | |
jQuery(this).wrapInner('<span class="comments"></span>'); | |
var thisComments = jQuery(this).find('.comments').html(); | |
thisComments = thisComments.replace(/,/g,' '); | |
thisComments = thisComments.replace(/Comments/,'Comentarios'); | |
var thisMeta = jQuery(this).html(); | |
var thisLink = jQuery(this).parent().find('.entry-title a').attr('href'); | |
var thisMetaNew = 'Publicado en ' + thisTime + ' Por ' + thisAuthor + ' en ' + thisCat + '<span class="com-sep"></span>' + '<a href="' + thisLink + '#comment-wrap" class="comments-link">' + thisComments + '</a>'; | |
thisMetaNew = thisMetaNew.replace(/por/g,' '); | |
thisMetaNew = thisMetaNew.replace(/\|/g,' '); | |
jQuery(this).html(thisMetaNew); | |
jQuery(this).find('.com-sep').html(' |'); | |
}); //end jQuery each() | |
} // end if condition | |
} //end blog_custom_meta() function. | |
blog_custom_meta (); | |
jQuery('.wp-pagenavi a').click(function(){ | |
checkInterval = setInterval(blog_custom_meta, 100); | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment