Essential Grid with Custom Post Types for Masonry Layout [Solved]

I’m 99.9% there but I’m having issues getting EG to display my CPT Archive and Search (properties) posts.

I followed the guide here: https://theme.co/apex/forums/topic/custom-archive-and-search-index-page-with-essential-grid/ and here: https://theme.co/apex/forum/t/custom-post-type-archive-jquery-is-not-defined/9972/2

This is what I have now (A combination of blogs and CPT posts, and I just want CPT posts.)

https://vc.goiww.com/properties/?s=abby
https://vc.goiww.com/properties/

Here are the files and the code that I changed. I’m sure it’s a 2 second fix on something I missed.

I also need to be able to capture taxonomy information as well and custom fields so I can filter, but I believe I can do the custom fields pull from the grid settings itself. Example Taxonomies are “property_type” “amentity”, etc. If I can’t capture the taxonomies this way, this method will be useless to the client. I need the grid to handle sorting functions.

Here’s another: pro-child/framework/views/integrity/wp-properties.php

<?php

// =============================================================================
// VIEWS/ICON/WP-INDEX.PHP
// -----------------------------------------------------------------------------
// Index page output for Icon.
// =============================================================================

?>

<?php get_header(); ?>

  <div class="x-main full" role="main">
    <div class="x-container offset-bottom">

      <?php x_get_view( 'global', '_index-properties' ); ?>

    </div>
  </div>

  <?php get_sidebar(); ?>
<?php get_footer(); ?>

And another: pro-child/framework/views/global/_index-properties.php

<?php

// =============================================================================
// VIEWS/GLOBAL/_INDEX.PHP
// -----------------------------------------------------------------------------
// Includes the index output.
// =============================================================================

$stack = x_get_stack();

if ( is_home() ) :
  $style     = x_get_option( 'x_blog_style' );
  $cols      = x_get_option( 'x_blog_masonry_columns' );
  $condition = is_home() && $style == 'masonry';
elseif ( is_archive() ) :
  $style     = x_get_option( 'x_archive_style' );
  $cols      = x_get_option( 'x_archive_masonry_columns' );
  $condition = is_archive() && $style == 'masonry';

if(is_tag()) $my_posts = get_posts(array('tag' => get_query_var('tag')));
else if(is_author()) $my_posts = get_posts(array('author' => get_query_var('author')));
else if(is_date()) $my_posts = get_posts(array('m' => get_query_var('m'))); 
else $my_posts = get_posts(array('cat' => get_query_var('cat')));
 
$my_post_ids = array();
 
foreach($my_posts as $post) {
   array_push( $my_post_ids, $post -> ID );
}

elseif ( is_search() ) :
$condition = is_search() && $style == 'masonry';

if(is_tag()) $my_posts = get_posts(array('tag' => get_query_var('tag')));
else if(is_author()) $my_posts = get_posts(array('author' => get_query_var('author')));
else if(is_date()) $my_posts = get_posts(array('m' => get_query_var('m'))); 
else $my_posts = get_posts(array('cat' => get_query_var('cat')));
 
$my_post_ids = array();
 
foreach($my_posts as $post) {
   array_push( $my_post_ids, $post -> ID );
}

endif;

?>

<?php if ( $condition ) : ?>

  <?php x_get_view( 'global', '_script', 'isotope-index' ); ?>

  <div id="x-iso-container" class="x-iso-container x-iso-container-posts cols-<?php echo $cols; ?>">
<?php echo do_shortcode('[ess_grid alias="weekly_grid" posts="'.implode(',', $my_post_ids).'"]'); ?>
    <?php if ( have_posts() ) : ?>
      <?php while ( have_posts() ) : the_post(); ?>
        <?php if ( $stack != 'ethos' ) : ?>
          <?php x_get_view( $stack, 'content', get_post_format() ); ?>
        <?php else : ?>
          <?php x_ethos_entry_cover( 'main-content' ); ?>
        <?php endif; ?>
      <?php endwhile; ?>
    <?php else : ?>
      <?php x_get_view( 'global', '_content-none' ); ?>
    <?php endif; ?>

  </div>

<?php else : ?>

  <?php if ( have_posts() ) : ?>
    <?php while ( have_posts() ) : the_post(); ?>
      <?php x_get_view( $stack, 'content', get_post_format() ); ?>
    <?php endwhile; ?>
  <?php else : ?>
    <?php x_get_view( 'global', '_content-none' ); ?>
  <?php endif; ?>

<?php endif; ?>

<?php pagenavi(); ?>

And lastly: pro-child/archive-properties.php

<?php

// =============================================================================
// archive-properties.php
// =============================================================================

?>

<?php x_get_view( x_get_stack(), 'wp', 'properties' ); ?>

Hopefully, this is enough to give you an idea of what’s happening. Thanks for the help so far you guys been great.

B

I’ve been messing with the code and I got the Essential Grid to show on both /properties/ CPT, but still not having any luck with the search /s=what?

Here’s updated code:

<?php

// =============================================================================
// VIEWS/GLOBAL/_INDEX.PHP
// -----------------------------------------------------------------------------
// Includes the index output.
// =============================================================================

$stack = x_get_stack();

if ( is_home() ) :
  $style     = x_get_option( 'x_blog_style' );
  $cols      = x_get_option( 'x_blog_masonry_columns' );
  $condition = is_home() && $style == 'masonry';
elseif ( is_archive() ) :
  $style     = x_get_option( 'x_archive_style' );
  $cols      = x_get_option( 'x_archive_masonry_columns' );
  $condition = is_archive() && $style == 'masonry';

elseif ( is_search() ) :
$condition = is_search() && $style == 'masonry';
endif;?>

<?php if ( $condition ) : ?>

  <?php x_get_view( 'global', '_script', 'isotope-index' ); ?>

<div id="x-iso-container" class="x-iso-container x-iso-container-posts cols-<?php echo $cols; ?>">
<?php echo do_shortcode('[ess_grid alias="weekly_grid" posts="'.implode(',', ( $post -> ID )).'"]'); ?>
</div>

<?php else : ?>

  <?php if ( have_posts() ) : ?>
    <?php while ( have_posts() ) : the_post(); ?>
      <?php x_get_view( $stack, 'content', get_post_format() ); ?>
    <?php endwhile; ?>
  <?php else : ?>
    <?php x_get_view( 'global', '_content-none' ); ?>
  <?php endif; ?>

<?php endif; ?>

<?php pagenavi(); ?>

Hi there,

Try changing this block,

elseif ( is_search() ) :
$condition = is_search() && $style == 'masonry';
endif;?>

to this

elseif ( is_search() ) :
$condition = is_search();
endif;?>

or to this, much simpler

elseif ( is_search() ) :
$condition = true;
endif;?>

It’s simply because $style is only applicable for archive like this

elseif ( is_archive() ) :
  $style     = x_get_option( 'x_archive_style' );

Hence, the condition is false for search template.

Thanks!

1 Like

I realized that how the thing was coded in reality it wasn’t pulling the posts from the implode command in the script (for both search and archive) it was simply reading the ESSential Grid specs set in the Grid Backend (which was set to display properties cpt).

I was under the impression you could kinda ‘throw’ that data in between ESSential Grid shortcodes and have it render on the screen if you’re in that template.

That’s the code that I would need to get this back running again. I saw you handled it before on another thread which they appeared to get it working, but on my test with the code i pulled from the examples you fixed last year, it wasn’t doing anything and asking for incorrect information.

So I have the code backed up for the _index-properties.php if it’s possible to get this working in ESSential Grid. But as of right now I need to get these properties listed in the way the client wants them so I’m gonna try to do it in X Masonry grid and just add the meta data using the same theme files I separated from above, since I have to do it that way anyway. If you get time @Rad I’d love to get this working.

There was more than the search thing being off considering it would only pull the data that the source was set to in the grid backend and not what we were giving it via php templates with the implode function. I thought it was working but it was all lies :slight_smile:

Thanks

Hi there,

You’re right, the updated code is wrong sine it’s only imploding a single ID instead of an array.

<?php echo do_shortcode('[ess_grid alias="weekly_grid" posts="'.implode(',', ( $post -> ID )).'"]'); ?>

But in older code, the issue lies in get_posts() since it doesn’t respect the global query which you really need the most. Archives and searches are pulled from global query.

if(is_tag()) $my_posts = get_posts(array('tag' => get_query_var('tag')));
else if(is_author()) $my_posts = get_posts(array('author' => get_query_var('author')));
else if(is_date()) $my_posts = get_posts(array('m' => get_query_var('m'))); 
else $my_posts = get_posts(array('cat' => get_query_var('cat')));

And since you’ll be using EG, you don’t need the lines for condition, isotope index, and even the ethos covers. Which means, what you need is dedicated templates for your custom taxonomies and CPT instead of customizing the existing isotope/masonry templates. Copying from those threads will not work since their setup is different.

It will appear working, but it will display different items since you’re utilizing the get_posts() function instead of global query. You should start with a simple layout like this

<?php

// =============================================================================
// VIEWS/GLOBAL/_INDEX.PHP
// -----------------------------------------------------------------------------
// Includes the index output.
// =============================================================================

?>
    <?php if ( have_posts() ) : $my_post_ids = array(); ?>
      
      <?php while ( have_posts() ) : the_post(); ?>
       <?php $my_post_ids[] = get_the_ID() ; ?>
      <?php endwhile; ?>

    <?php echo do_shortcode('[ess_grid alias="weekly_grid" posts="'.implode(',', $my_post_ids).'"]'); ?>

    <?php else : ?>
      <?php x_get_view( 'global', '_content-none' ); ?>
    <?php endif; ?>


<?php pagenavi(); ?>

Assuming that you already have the complete set of templates for properties.

Thanks!

I built the templates the way I was supposed to I believe. I got both archive and single page posts showing correctly. Here’s the current file structure.

.
    ./framework
    ./framework/views
    ./framework/views/.gitkeep
    ./framework/views/integrity
    ./framework/views/integrity/wp-single-properties.php
    ./framework/views/integrity/content-properties.php
    ./framework/views/integrity/_content-post-header-properties.php
    ./framework/views/integrity/wp-index-properties.php
    ./framework/views/global
    ./framework/views/global/_index-properties.php
    ./functions.php
    ./style.css
    ./screenshot.png
    ./single-properties.php
    ./archive-properties.php

Those were the only files required to get the look and the metadata required.

I tried adding the implode code in the file you suggested and it still pulled in the masonry X version of it as well simultaneously. And sent the footer up the right side of the page.

But the posts did show via the grid. Small and out of place, but none-the-less, there.

Here’s the entire thing in the order listed above.

<?php

// =============================================================================
// VIEWS/INTEGRITY/WP-SINGLE.PHP
// -----------------------------------------------------------------------------
// Single post output for Integrity.
// =============================================================================

$fullwidth = get_post_meta( get_the_ID(), '_x_post_layout', true );

?>

<?php get_header(); ?>
  
  <div class="x-container max width offset">
    <div class="<?php x_main_content_class(); ?>" role="main">

      <?php while ( have_posts() ) : the_post(); ?>
        <?php x_get_view( 'integrity', 'content-properties', get_post_format() ); ?>
<hr>
<div id="gallery">
<?php $propvalue = get_field( "gallery_images" );
if( $propvalue ) {
  echo $propvalue;
  }
  else {
  echo 'No Property Images Found';
  }?>
</div>
<hr>

<div class="tab">
  <button class="tablinks" onclick="openTab(event, 'tab-prop-info')">Property Information</button>
  <button class="tablinks" onclick="openTab(event, 'tab-pricing')">Pricing</button>
  <button class="tablinks" onclick="openTab(event, 'tab-booking')">Availability & Booking</button>
  <button class="tablinks" onclick="openTab(event, 'tab-review')">Reviews</button>
</div>

<!-- Property Info Tab -->
<div id="tab-prop-info" class="tabcontent">
<h6>Welcome to <?php echo get_field( "property_name");?></h6>
<?php $term_obj_list = get_the_terms( $post->ID, 'property_type' );
$terms_string = join(', ', wp_list_pluck($term_obj_list, 'name'));?>
<p>Enjoy this <?php echo $terms_string;?> property located in <?php echo get_field( "property_city" );?>, 
<?php echo get_field( "property_state");?>.  Rental weeks conveniently start on <?php echo get_field( "property_day" );?> here.  There are <?php echo get_field( "property_beds" );?> bedroom(s), <?php echo get_field( "property_baths" );?> bathroom(s), and this property will comfortably sleep <?php echo get_field( "property_sleeps" );?> people.  It is located exactly <?php echo get_field( "property_bh" );?> miles from <em>Bar Harbor, Maine.</em></p>

<!-- Pet PHP Code -->
<?php $pets = get_field( "property_pets" );
if ( $pets == "No" ) { echo '<p>Sorry, this property does not allow pets.</p>'; }
else if ( $pets == "Yes" ) { echo 'This property does allows you to bring pets.</p>'; } 
else { echo '<p>Please call us to see if this property will support your pet.</p>'; }
?>

<div class="property_amentity">
<?php $term_obj_list = get_the_terms( $post->ID, 'amentity' );
$terms_string = join(', ', wp_list_pluck($term_obj_list, 'name'));?>
<h6>Enjoy the following amentities:</h6>
<p><?php echo $terms_string;?></p></div>
</div>

<!-- Property Pricing Tab -->
<div id="tab-pricing" class="tabcontent">
<h6>Pricing Information</h6>

<?php if( get_field('property_june') ): ?>
  <p>Current pricing for June is $<strong><?php the_field('property_june'); ?></strong> per week.</p>
<?php endif; ?>
<?php if( get_field('property_july') ): ?>
  <p>Current pricing for July is $<strong><?php the_field('property_july'); ?></strong> per week.</p>
<?php endif; ?>
<?php if( get_field('property_august') ): ?>
  <p>Current pricing for August is $<strong><?php the_field('property_august'); ?></strong> per week.</p>
<?php endif; ?>
<?php if( get_field('property_september') ): ?>
  <p>Current pricing for September is $<strong><?php the_field('property_september'); ?></strong> per week.</p>
<?php endif; ?>
<?php if( get_field('property_october') ): ?>
  <p>Current pricing for October is $<strong><?php the_field('property_october'); ?></strong> per week.</p>
<?php endif; ?>

</div>

<div id="tab-booking" class="tabcontent">
  <h6>Booking Info</h6>
<!-- Booking Calendar Shit -->
<p>Here is the property's current availability.  Please notice that all rental weeks start on <?php echo get_field( "property_day" );?>.</p>
<?php $bookit = get_field( "booking_shortcode" ); 
if ( $bookit ) { echo do_shortcode($bookit); }
else { echo '<p>No booking information has been set up for this property.</p>'; }?>
</div>

<div id="tab-review" class="tabcontent">
  <h4>Reviews</h4>
  <p>Need a reviews solutions added to this after main project is complete.</p>
</div>

<script>
function openTab(evt, tabName) {
    var i, tabcontent, tablinks;
    tabcontent = document.getElementsByClassName("tabcontent");
    for (i = 0; i < tabcontent.length; i++) {
        tabcontent[i].style.display = "none";
    }
    tablinks = document.getElementsByClassName("tablinks");
    for (i = 0; i < tablinks.length; i++) {
        tablinks[i].className = tablinks[i].className.replace(" active", "");
    }
    document.getElementById(tabName).style.display = "block";
    evt.currentTarget.className += " active";
}
</script>

        <?php x_get_view( 'global', '_comments-template' ); ?>
      <?php endwhile; ?>

    </div>

    <?php if ( $fullwidth != 'on' ) : ?>
      <?php get_sidebar(); ?>
    <?php endif; ?>

  </div>

<?php get_footer(); ?>
<?php

// =============================================================================
// VIEWS/INTEGRITY/CONTENT.PHP
// -----------------------------------------------------------------------------
// Standard post output for Integrity.
// =============================================================================

?>

<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  <div class="entry-featured">
    <?php x_featured_image(); ?>
  </div>
  <div class="entry-wrap"><center>
    <?php x_get_view( 'integrity', '_content', 'post-header-properties' ); ?></center>
 <?php if ( is_single() ) : ?>
  <?php x_get_view( 'global', '_content' ); ?>
  <?php endif; ?>
    <!-- <?php x_get_view( 'global', '_content' ); ?>-->
  </div>
  <?php //x_get_view( 'integrity', '_content', 'post-footer' ); ?>
</article>




<?php

// =============================================================================
// VIEWS/INTEGRITY/_CONTENT-POST-HEADER.PHP
// -----------------------------------------------------------------------------
// Standard <header> output for various posts.
// =============================================================================

?>

<header class="entry-header">
  <?php if ( is_single() ) : ?>
  <h1 class="entry-title"><?php the_title(); ?></h1>
  <?php else : ?>
  <h2 class="entry-title">
    <a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to: "Hi"', '__x__' ), the_title_attribute( 'echo=0' ) ) ); ?>"><?php x_the_alternate_title(); ?></a>
  </h2>
  <?php endif; ?>
  <!-- Get Rid of Junk Meta <?php x_integrity_entry_meta(); ?> -->
  <div class="property_meta">
    <div class="meta">
      <h5><?php $propmeta = get_field( "property_city" );
      if( $propmeta ) { echo $propmeta; }?>, 
      <?php $propmeta = get_field( "property_state" );
      if( $propmeta ) { echo $propmeta; }?></h5>
      <p><?php $propmeta = get_field( "property_beds" );
      if( $propmeta ) { echo $propmeta; }?> Beds / 
      <?php $propmeta = get_field( "property_baths" );
      if( $propmeta ) { echo $propmeta; }?> Baths / Sleeps 
      <?php $propmeta = get_field( "property_sleeps" );
      if( $propmeta ) { echo $propmeta; }?><br>Pets:
      <?php $propmeta = get_field( "property_pets" );
      if( $propmeta ) { echo $propmeta; }?> / 
      <?php $propmeta = get_field( "property_bh" );
      if( $propmeta ) { echo $propmeta; }?> Miles to Bar Harbor</p>
    </div>
  </div>
</header>
<?php

// =============================================================================
// VIEWS/INTEGRITY/WP-INDEX.PHP
// -----------------------------------------------------------------------------
// Index page output for Integrity.
// =============================================================================

?>

<?php get_header(); ?>

  <div class="x-container max width offset">
    <div class="<?php x_main_content_class(); ?>" role="main">

      <?php x_get_view( 'global', '_index-properties' ); ?>

    </div>

    <?php get_sidebar(); ?>

  </div>

<?php get_footer(); ?>
<?php

// =============================================================================
// VIEWS/GLOBAL/_INDEX.PHP
// -----------------------------------------------------------------------------
// Includes the index output.
// =============================================================================

$stack = x_get_stack();

if ( is_home() ) :
  $style     = x_get_option( 'x_blog_style' );
  $cols      = x_get_option( 'x_blog_masonry_columns' );
  $condition = is_home() && $style == 'masonry';
elseif ( is_archive() ) :
  $style     = x_get_option( 'x_archive_style' );
  $cols      = x_get_option( 'x_archive_masonry_columns' );
  $condition = is_archive() && $style == 'masonry';
elseif ( is_search() ) :
  $condition = false;
endif;

?>

<?php if ( $condition ) : ?>

  <?php x_get_view( 'global', '_script', 'isotope-index' ); ?>

  <div id="x-iso-container" class="x-iso-container x-iso-container-posts cols-<?php echo $cols; ?>">

    <?php if ( have_posts() ) : ?>
      <?php while ( have_posts() ) : the_post(); ?>
        <?php if ( $stack != 'ethos' ) : ?>
          <?php x_get_view( $stack, 'content-properties', get_post_format() ); ?>
        <?php else : ?>
          <?php x_ethos_entry_cover( 'main-content' ); ?>
        <?php endif; ?>
      <?php endwhile; ?>
    <?php else : ?>
      <?php x_get_view( 'global', '_content-none' ); ?>
    <?php endif; ?>

  </div>

<?php else : ?>

  <?php if ( have_posts() ) : ?>
    <?php while ( have_posts() ) : the_post(); ?>
      <?php x_get_view( $stack, 'content', get_post_format() ); ?>
    <?php endwhile; ?>
  <?php else : ?>
    <?php x_get_view( 'global', '_content-none' ); ?>
  <?php endif; ?>

<?php endif; ?>

<?php pagenavi(); ?>
<?php

// =============================================================================
// FUNCTIONS.PHP
// -----------------------------------------------------------------------------
// Overwrite or add your own custom functions to Pro in this file.
// =============================================================================

// =============================================================================
// TABLE OF CONTENTS
// -----------------------------------------------------------------------------
//   01. Enqueue Parent Stylesheet
//   02. Additional Functions
// =============================================================================

// Enqueue Parent Stylesheet
// =============================================================================

add_filter( 'x_enqueue_parent_stylesheet', '__return_true' );

/*
 * Remove Permalink to text to 
 * featured image link in the blog page
*/

function x_featured_image( $cropped = '' ) {

  $stack     = x_get_stack();
  $fullwidth = ( in_array( 'x-full-width-active', get_body_class() ) ) ? true : false;

  if ( has_post_thumbnail() ) {

    if ( $cropped == 'cropped' ) {
      if ( $fullwidth ) {
        $thumb = get_the_post_thumbnail( NULL, 'entry-cropped-fullwidth', NULL );
      } else {
        $thumb = get_the_post_thumbnail( NULL, 'entry-cropped', NULL );
      }
    } else {
      if ( $fullwidth ) {
        $thumb = get_the_post_thumbnail( NULL, 'entry-fullwidth', NULL );
      } else {
        $thumb = get_the_post_thumbnail( NULL, 'entry', NULL );
      }
    }

    switch ( is_singular() ) {
      case true:
        printf( '<div class="entry-thumb">%s</div>', $thumb );
        break;
      case false:
        printf( '<a href="%1$s" class="entry-thumb" title="%2$s">%3$s</a>',
          esc_url( get_permalink() ),
          esc_attr( sprintf( __( '"%s"', '__x__' ), the_title_attribute( 'echo=0' ) ) ),
          $thumb
        );
        break;
    }

  }

}
<?php

// =============================================================================
// SINGLE.PHP
// -----------------------------------------------------------------------------
// Handles output of individual posts.
//
// Content is output based on which Stack has been selected in the Customizer.
// To view and/or edit the markup of your Stack's posts, first go to "views"
// inside the "framework" subdirectory. Once inside, find your Stack's folder
// and look for a file called "wp-single.php," where you'll be able to find the
// appropriate output.
// =============================================================================

?>

<?php x_get_view( x_get_stack(), 'wp', 'single-properties' ); ?>
<?php

// =============================================================================
// INDEX.PHP
// -----------------------------------------------------------------------------
// Handles output of pages and posts if a more specific template file isn't
// present. Must be present for theme to function properly.
//
// Content is output based on which Stack has been selected in the Customizer.
// To view and/or edit the markup of your Stack's index, first go to "views"
// inside the "framework" subdirectory. Once inside, find your Stack's folder
// and look for a file called "wp-index.php," where you'll be able to find the
// appropriate output.
// =============================================================================

?>

<?php x_get_view( x_get_stack(), 'wp', 'index-properties' ); ?>

I feel pretty good about using the theme structure the way it was designed. I like how it’s set up. It’s very customizable. So if there is a way that could yield some ESS action without screwing up anything in my current setup I’d love to give it a whirl. I was set on using it for sure but then realized it can’t filter by meta, and now its beauty became useless to me. Thanks for all the help so far. You guys are beyond great.

Hi @xlightwaverx,

You mean you wish to display those other templates within Essential Grid masonry? Or are they different issues?

Would you mind providing the URL where it sets the footer to the right side? I checked the index and single pages and I don’t see any issues. And please open a new thread for new issues so we could easily track them :slight_smile:

Though, based on the code, looks like you’re not going to ESS direction now? And you’re most and always welcome :slight_smile:

Thanks!

Yeah I guess the original data is being called somewhere else. Here’s the updated code:

<?php

// =============================================================================
// VIEWS/GLOBAL/_INDEX.PHP
// -----------------------------------------------------------------------------
// Includes the index output.
// =============================================================================

$stack = x_get_stack();

if ( is_home() ) :
  $style     = x_get_option( 'x_blog_style' );
  $cols      = x_get_option( 'x_blog_masonry_columns' );
  $condition = is_home() && $style == 'masonry';
elseif ( is_archive() ) :
  $style     = x_get_option( 'x_archive_style' );
  $cols      = x_get_option( 'x_archive_masonry_columns' );
  $condition = is_archive() && $style == 'masonry';
elseif ( is_search() ) :
  $condition = false;
endif;

?>

<?php if ( $condition ) : ?>

  <?php x_get_view( 'global', '_script', 'isotope-index' ); ?>

   <div id="x-iso-container" class="x-iso-container x-iso-container-posts cols-<?php echo $cols; ?>">

    <!-- <?php if ( have_posts() ) : ?>
      <?php while ( have_posts() ) : the_post(); ?>
        <?php if ( $stack != 'ethos' ) : ?>
          <?php x_get_view( $stack, 'content-properties', get_post_format() ); ?>
        <?php else : ?>
          <?php x_ethos_entry_cover( 'main-content' ); ?>
        <?php endif; ?>
      <?php endwhile; ?>
    <?php else : ?>
      <?php x_get_view( 'global', '_content-none' ); ?>
    <?php endif; ?> -->

<?php if ( have_posts() ) : $my_post_ids = array(); ?>
      
      <?php while ( have_posts() ) : the_post(); ?>
       <?php $my_post_ids[] = get_the_ID() ; ?>
      <?php endwhile; ?>

    <?php echo do_shortcode('[ess_grid alias="weekly_grid" posts="'.implode(',', $my_post_ids).'"]'); ?>
<?php endif;?>  

</div>

<!-- <?php else : ?>

  <?php if ( have_posts() ) : ?>
    <?php while ( have_posts() ) : the_post(); ?>
      <?php x_get_view( $stack, 'content', get_post_format() ); ?>
    <?php endwhile; ?>
  <?php else : ?>
    <?php x_get_view( 'global', '_content-none' ); ?>
  <?php endif; ?>

<?php endif; ?> -->

<?php pagenavi(); ?>

And here’s the output:

This might be a viable option for output as I believe if I wrap even this code in facetwp code, I can use essential grid with FacetWP… At least that was the original plan.

Hi @xlightwaverx

Ah, you mixed them. Have you tried just this?

<?php

// =============================================================================
// VIEWS/GLOBAL/_INDEX.PHP
// -----------------------------------------------------------------------------
// Includes the index output.
// =============================================================================

?>
    <?php if ( have_posts() ) : $my_post_ids = array(); ?>
      
      <?php while ( have_posts() ) : the_post(); ?>
       <?php $my_post_ids[] = get_the_ID() ; ?>
      <?php endwhile; ?>

    <?php echo do_shortcode('[ess_grid alias="weekly_grid" posts="'.implode(',', $my_post_ids).'"]'); ?>

    <?php else : ?>
      <?php x_get_view( 'global', '_content-none' ); ?>
    <?php endif; ?>

It doesn’t need those other codes since you’re displaying EG. It looks like that since those items are wrapped within isotope structure. You shouldn’t add it within isotope or else, it will be formatted as one of its items.

$stack = x_get_stack();

if ( is_home() ) :
  $style     = x_get_option( 'x_blog_style' );
  $cols      = x_get_option( 'x_blog_masonry_columns' );
  $condition = is_home() && $style == 'masonry';
elseif ( is_archive() ) :
  $style     = x_get_option( 'x_archive_style' );
  $cols      = x_get_option( 'x_archive_masonry_columns' );
  $condition = is_archive() && $style == 'masonry';
elseif ( is_search() ) :
  $condition = false;
endif;

?>

<?php if ( $condition ) : ?>

  <?php x_get_view( 'global', '_script', 'isotope-index' ); ?>

Thanks!

I just tried it again.

Mind you my templates are redone to the T. If archive-properties.php calls for wp-***-properties and so on until we reach _index_properties.php

I got it. I’m gonna close this and mark it as solved. Thanks for all the help. You guys truly rock.

Hi @xlightwaverx,

Happy to hear that.

Feel free to ask us again.

Thanks.