Note that there are some explanatory texts on larger screens.

plurals
  1. POAdding items with the Isotope for Wordpress plugin
    text
    copied!<p>Tricky one here (I think).. I'm using the <a href="http://mintthemes.com/isotope-for-wordpress/" rel="nofollow">Isotope For Wordpress</a> plugin to pull my posts into an isotope grid. All works perfectly except I've been unable to get any of the <a href="http://isotope.metafizzy.co/docs/adding-items.html" rel="nofollow">Adding Methods</a> to work. Here is what I'm trying (with the goal of adding three new posts to the grid):</p> <pre><code>var $container = $('.mintthemes_isotopes_container'); var $items = $('&lt;div class="hentry" /&gt; &lt;div class="hentry" /&gt; &lt;div class="hentry" /&gt;'); $('#insert').click(function() { $('.mintthemes_isotopes_container').isotope( 'insert', $items ); }); $container.imagesLoaded( function(){ $container.isotope({ animationEngine: 'best available', transformsEnabled: true, itemSelector: '.hentry', masonry: { columnWidth: 1, gutterWidth: 5 }, }); </code></pre> <p>I think my problem lies in what im defining what the $items to be. The code above adds three new containers, styled correctly, but there's no content. I think i need to call the actual posts instead of the ".hentry" but I'm not sure how to do that within that .js file that the plugin provided. Here's how the posts are called in my index.php:</p> <pre><code>&lt;?php mintthemes_isotopes(); ?&gt; &lt;?php // Blog post query $linksPosts = new WP_Query(); $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts( array( 'post_type' =&gt; 'post', 'paged'=&gt;$paged, 'showposts'=&gt;3) ); if (have_posts()) : while (have_posts() ) : the_post();?&gt; &lt;div &lt;?php post_class(); ?&gt;&gt; &lt;div class=".mintthemes_isotopes_container"&gt; &lt;div class=".isotope-item"&gt; &lt;p&gt;&lt;a href="&lt;?php the_permalink(); ?&gt;" title="&lt;?php the_title();?&gt;"&gt;&lt;?php the_title();&lt;/p&gt;&lt;/a&gt; &lt;/div&gt; &lt;!-- /isotope item --&gt; &lt;/div&gt; &lt;!--/.mintthemes_isotopes_container--&gt; &lt;/div&gt; &lt;!-- /.post_class --&gt; &lt;?php endwhile; endif; ?&gt; </code></pre> <p>I can't call that php post_class(); in an external .js file right? Is there any other way I can call these posts? Any and all ideas appreciated.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload