adding content limit to the blocks output
authorAnthony Talarico <talarico@gaslightmedia.com>
Fri, 7 Sep 2018 15:24:10 +0000 (11:24 -0400)
committerAnthony Talarico <talarico@gaslightmedia.com>
Fri, 7 Sep 2018 15:24:10 +0000 (11:24 -0400)
functions.php
parts/blog-feed-front.php

index 73ae0b2..c5302a9 100644 (file)
@@ -212,7 +212,7 @@ function content_excerpt($post_id, $length = 35){
     if( $the_post->post_excerpt ){
        $the_excerpt = $the_post->post_excerpt;
     } else {
-        $the_excerpt = $the_post->post_content;
+        $the_excerpt = apply_filters('the_content', $block->post_content);
     }
 
     $excerpt_length = $length; //Sets excerpt length by word count
@@ -224,7 +224,7 @@ function content_excerpt($post_id, $length = 35){
         array_push($words, '…');
         $the_excerpt = implode(' ', $words);
     endif;
-    
+    echo $the_excerpt;
     return $the_excerpt;
 }
 ?>
index aed19b2..825f48b 100644 (file)
@@ -71,9 +71,9 @@
                                     <div class="front-page-post-content-container overlay">
                                         <h2 class="title-posts"><a href="<?php echo $block->url; ?>"><?php echo $block->post_title; ?></a></h2>
                                         <div class="glm-block-content">
-                                            <?php echo apply_filters('the_content', $block->post_content) . $block->post_excerpt;?>
+                                            <?php content_excerpt($block->ID) . $block->post_excerpt;?>
                                             <?php if($block->url) { ?>
-                                                <!-- <a class="glm-block-readmore" href="<?php echo $block->url;?>">...More content at this link</a> -->
+                                                <a class="glm-block-readmore" href="<?php echo $block->url;?>">...More content at this link</a>
                                             <?php } ?>
                                         </div>