{"id":5934465,"date":"2015-03-24T10:12:34","date_gmt":"2015-03-24T10:12:34","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/overlapping-posts-isotope-bootstrap-and-wordpress\/"},"modified":"2016-08-22T18:23:48","modified_gmt":"2016-08-22T18:23:48","slug":"overlapping-posts-isotope-bootstrap-and-wordpress","status":"closed","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/overlapping-posts-isotope-bootstrap-and-wordpress\/","title":{"rendered":"Overlapping posts &#8211; Isotope, bootstrap and wordpress"},"content":{"rendered":"<p>I have searched the internet for almost 4 hours. And I cannot find a solution to my problem. <\/p>\n<p>I have got the isotope to work with both bootstrap and wordpress. The thing is that my posts overlap eachother when I refresh my site. The solution to that should be: (window).load, or image load. But when I implement them to my code, the filtering function stops working .. <\/p>\n<p>My site: <a href=\"http:\/\/laerkelyhne.dk\/portfolio\/\"><br \/>\nHeres my JS (when it works, but overlapping):<\/p>\n<pre><code>jQuery(document).ready(function ($) {\n\n\tvar $container = $(&#039;#isotope-list&#039;); \/\/The ID for the list with all the blog posts\n\n    $container.isotope({ \/\/Isotope options, &#039;item&#039; matches the class in the PHP\n\t\titemSelector : &#039;.item&#039;,\n  \t\tlayoutMode : &#039;masonry&#039;,\n\t});\n\n\t\/\/Add the class selected to the item that is clicked, and remove from the others\n\tvar $optionSets = $(&#039;#filters&#039;),\n\t$optionLinks = $optionSets.find(&#039;a&#039;);\n\n\t$optionLinks.click(function(){\n\tvar $this = $(this);\n\t\/\/ don&#039;t proceed if already selected\n\tif ( $this.hasClass(&#039;selected&#039;) ) {\n\t  return false;\n\t}\n\tvar $optionSet = $this.parents(&#039;#filters&#039;);\n\t$optionSets.find(&#039;.selected&#039;).removeClass(&#039;selected&#039;);\n\t$this.addClass(&#039;selected&#039;);\n\n\t\/\/When an item is clicked, sort the items.\n\t var selector = $(this).attr(&#039;data-filter&#039;);\n\t$container.isotope({ filter: selector });\n\n\treturn false;\n\t});\n\n});<\/code><\/pre>\n<p>Here is my mark up:<\/p>\n<pre><code>&lt;div class=&quot;container-fluid articlewrapper&quot;&gt;\n\n        &lt;section class=&quot;row&quot;&gt;\n            &lt;div class=&quot;overskrift2 text-center&quot;&gt;\n                &lt;h3&gt;Seneste projekter&lt;\/h3&gt;\n            &lt;\/div&gt;\n        &lt;\/section&gt;\n\n        &lt;section class=&quot;row&quot;&gt;\n            &lt;div class=&quot;col-lg-12 text-center&quot;&gt;\n                &lt;ul id=&quot;filters&quot;&gt;\n                    &lt;li&gt;&lt;a href=&quot;#&quot; data-filter=&quot;*&quot; class=&quot;selected&quot;&gt;Alle \/&lt;\/a&gt;&lt;\/li&gt;\n                    &lt;?php\n                        $terms = get_terms(&quot;category&quot;); \/\/ get all categories, but you can use any taxonomy\n                        $count = count($terms); \/\/How many are they?\n                        if ( $count &gt; 0 ){  \/\/If there are more than 0 terms\n                            foreach ( $terms as $term ) {  \/\/for each term:\n                                echo &quot;&lt;li&gt;&lt;a href=&#039;#&#039; data-filter=&#039;.&quot;.$term-&gt;slug.&quot;&#039;&gt;&quot; . $term-&gt;name . &quot; \/ &quot; . &quot;&lt;\/a&gt;&lt;\/li&gt;\\n&quot;;\n                                \/\/create a list item with the current term slug for sorting, and name for label\n                            }\n                        }\n                    ?&gt;\n                &lt;\/ul&gt;\n            &lt;\/div&gt;\n        &lt;\/section&gt;\n\n        &lt;section class=&quot;row&quot;&gt;\n\n            &lt;?php $the_query = new WP_Query( &#039;posts_per_page=8&#039; ); \/\/Check the WP_Query docs to see how you can limit which posts to display ?&gt;\n\n                &lt;?php if ( $the_query-&gt;have_posts() ) : ?&gt;\n\n                &lt;div id=&quot;isotope-list&quot; id=&quot;container&quot; &gt;\n                &lt;?php while ( $the_query-&gt;have_posts() ) : $the_query-&gt;the_post();\n                $termsArray = get_the_terms( $post-&gt;ID, &quot;category&quot; );  \/\/Get the terms for this particular item\n                $termsString = &quot;&quot;; \/\/initialize the string that will contain the terms\n                    foreach ( $termsArray as $term ) { \/\/ for each term\n                        $termsString .= $term-&gt;slug.&#039; &#039;; \/\/create a string that has all the slugs\n                    }\n                ?&gt; \n\n                    &lt;div class=&quot;&lt;?php echo $termsString; ?&gt; item col-xs-12 col-sm-4 col-md-3 col-lg-3&quot; onclick=&quot;location.href=&#039;&lt;?php the_permalink(); ?&gt;&#039;;&quot; style=&quot;cursor: pointer;&quot;&gt; &lt;?php \/\/ &#039;item&#039; is used as an identifier ?&gt;\n                        &lt;div data-content=&quot;&lt;?php the_title(); ?&gt;&quot; class=&quot;postthumbnail&quot;&gt;\n                            &lt;?php if ( has_post_thumbnail() ) {\n                                        $attributes = array(&#039;class&#039; =&gt; &#039;post-thumbnails img-responsive&#039;);\n                                        the_post_thumbnail(&#039;thumbs&#039;, $attributes);\n                                } ?&gt;\n                        &lt;\/div&gt;\n                    &lt;\/div&gt; &lt;!-- end item --&gt;\n\n                &lt;?php endwhile;  ?&gt;\n                &lt;\/div&gt; &lt;!-- end isotope-list --&gt;\n\n                &lt;?php endif; ?&gt;\n        &lt;\/section&gt;\n\n        &lt;section class=&quot;row&quot;&gt;\n\n            &lt;div class=&quot;buttonPad&quot;&gt;\n\n                &lt;div class=&quot;col-lg-4&quot;&gt;&lt;\/div&gt;\n\n                &lt;div class=&quot;col-lg-4 text-center&quot;&gt;\n                    &lt;a href=&quot;http:\/\/laerkelyhne.dk\/portfolio\/kontakt\/&quot; class=&quot;btn btn-success btn-lg button&quot;&gt;Se mere&lt;\/a&gt;\n                &lt;\/div&gt;\n\n                &lt;div class=&quot;col-lg-4&quot;&gt;&lt;\/div&gt;\n\n            &lt;\/div&gt;\n\n        &lt;\/section&gt;\n    &lt;\/div&gt;<\/code><\/pre>\n<p><\/a><\/p>\n","protected":false},"template":"","class_list":["post-5934465","topic","type-topic","status-closed","hentry","topic-tag-isotope","topic-tag-overlap"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/5934465","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/5934465\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=5934465"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}