From: Anthony Talarico Date: Mon, 11 Jan 2016 17:17:59 +0000 (-0500) Subject: removing links from blog feed title if contains < 16 words X-Git-Tag: v1.0.0^2~73 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=0ad086a34dcfd739592dfb57e081af2bfcae0781;p=WP-Themes%2Fotsego.git removing links from blog feed title if contains < 16 words --- diff --git a/js/app.js b/js/app.js index e2b73f6..4a508ee 100644 --- a/js/app.js +++ b/js/app.js @@ -103,6 +103,22 @@ $(document).ready(function () { $(this).parent("li").addClass("current"); } }); + + // remove link from posts with less than 16 words + for (var i = 0; i < $('div[class*="excerpt"]').length; i++){ + var words = $(".excerpt" + i).text().split(' '); + if(words.length < 16){ + + alert($(".excerpt" + i).parent().find("a").attr("href")); + $(".excerpt" + i).parent().find("a").replaceWith(function(){ + return $("

", {html: $(this).html()}); + }); + } + } + +// alert(words.length); +// var words = $('div[class*="excerpt"])').text().split(' '); +// alert(words.length); /* get number of elements in DOM console.log($("*").length); var pageBytes = $('html').html().length; var kbytes = pageBytes / 1024; diff --git a/js/custom/pageSetup.js b/js/custom/pageSetup.js index 29fbb3d..f5c96b3 100644 --- a/js/custom/pageSetup.js +++ b/js/custom/pageSetup.js @@ -94,6 +94,22 @@ $(document).ready(function () { $(this).parent("li").addClass("current"); } }); + + // remove link from posts with less than 16 words + for (var i = 0; i < $('div[class*="excerpt"]').length; i++){ + var words = $(".excerpt" + i).text().split(' '); + if(words.length < 16){ + + alert($(".excerpt" + i).parent().find("a").attr("href")); + $(".excerpt" + i).parent().find("a").replaceWith(function(){ + return $("

", {html: $(this).html()}); + }); + } + } + +// alert(words.length); +// var words = $('div[class*="excerpt"])').text().split(' '); +// alert(words.length); /* get number of elements in DOM console.log($("*").length); var pageBytes = $('html').html().length; var kbytes = pageBytes / 1024; diff --git a/parts/blog-feed-home.php b/parts/blog-feed-home.php index 4429f72..5efda11 100644 --- a/parts/blog-feed-home.php +++ b/parts/blog-feed-home.php @@ -2,6 +2,7 @@
@@ -15,10 +16,11 @@ foreach($lastposts as $post) : setup_postdata($post); ?>

Posted on -
+

+ \ No newline at end of file