New filter for the glm_blocks, markup added to list.html
authorLaury GvR <laury@gaslightmedia.com>
Fri, 14 Apr 2017 19:01:33 +0000 (15:01 -0400)
committerLaury GvR <laury@gaslightmedia.com>
Fri, 14 Apr 2017 19:01:33 +0000 (15:01 -0400)
functions.php
glm-member-db/views/front/members/list.html

index 7c69d9a..b5b559f 100644 (file)
@@ -41,6 +41,20 @@ add_filter('glm-member-db-front-search-query', function() {
     }
     return $queryParts;
 });
+
+add_filter('glm_blocks', function() {
+    if(function_exists('fetch_all_glm_blocks')) {
+        $blocks = fetch_all_glm_blocks();
+
+        return $blocks;
+    }
+    return false;
+});
+
+add_filter('glm_block_image', function($id) {
+    echo get_the_post_thumbnail($id, 'glm-block-image');
+});
+
 /**
  * Return the client info option for the given key
  *
index 1e1e828..67b14dd 100644 (file)
     {/if} {*list_show_list*}
 
 <div id="manufacturers-brands-container">
-    : &nbsp&nbsp&nbsp-&nbsp&nbsp&nbsp D &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbspBlocks go here
+    {$blocks = apply_filters('glm_blocks', '')}
+    {if $blocks}
+        {foreach $blocks as $block name="glm_block"}
+
+            {if $smarty.foreach.glm_block.index % 3 == 0}
+                <div class="glm-row">
+            {/if}
+                {if $block->url}
+                    <a href="{$block->url}">
+                {/if}
+                    <div class="glm-small-12 glm-medium-4 glm-column">
+                        <h4>{$block->post_title}</h4>
+                        {apply_filters('glm_block_image', $block->ID)}
+                    </div>
+                {if $block->url}
+                    </a>
+                {/if}
+            {if $smarty.foreach.glm_block.index % 3 == 2}
+                </div>
+            {/if}
+        {/foreach}
+    {/if}
+
 </div>
     <script type="text/javascript">
         jQuery(document).ready(function($) {