How would I split 'desandro masonry' columns by categories on a responsive wordpress layout -


i have created responsive 'pinterest style' layout on wordpress blog. tiles created the'featured images' functionality on admin side. when user adds featured image blog post, 'featured image' display on home page integrated responsive masonry layout. effect on homepage gallery of tiled images act blog post teasers. images have width of 100% within respective column , height of auto, retain aspect ratio. on mobile layout single column, on tablet layout 2 columns wide , on 900px layout 3 columns wide. bssically works example http://tympanus.net/development/gridloadingeffects/index2.html 'featured images' link through post.

i have 2 categories set on blog, let's , b. within layout described above ... on desktop view columns @ 33.3% first column on left populated category , remaining 2 populated category b , on mobile column single ... layout default masonry split, display alternate categories post thumbnails scroll down.

does have idea on how achieved ... or if can achieved masonry?

here few snippets of current setup

**//footer.php**  <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/jquery.js"></script> <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/imagesloaded.pkgd.min.js"></script> <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/masonary.js"></script> <script type="text/javascript"> <script type="text/javascript"> //script initialise masonary var content = document.getelementbyid('content'); var msnry = new masonry( content ); imagesloaded( content, function() {     var msnry = new masonry( content );     console.log('all images loaded');     msnry.layout(); }); </script>  **//index.php - loop snippet** <!-- masonary content --> <div class="masonry js-masonry" id="content">                  <!-- start loop. -->                 <?php                  // if have posts                 if (have_posts()) :                  // loop through post                 while (have_posts()) : the_post(); ?>      <!-- adds thumnails loop -->     <?php if ( has_post_thumbnail() && ! post_password_required() ) : ?>         <!-- masonry item -->          <div class="item">             <!-- overlay hover effect -->             <a href="<?php the_permalink(); ?>" rel="bookmark" title="permanent link <?php the_title(); ?>">                 <span class="post-overlay clearfix">                     <!-- post title appear on hover -->                     <h2 class="overlay"><?php the_title(); ?></h2>                     <!-- post thumbnail appear in masonry grid -->                     <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(); ?></a>                     <?php endif; ?>                 </span><!--end of hover-title-->             </a>         </div><!--end of item-->          <!-- end while loop -->                 <?php endwhile;?>  </div><!--end of .masonary-->  **//style.css   - masonry css snippet** img {    max-width: 100%;    height: auto !important;  }  **//mobile** .masonry {   height: 100%;   min-height: 100%; }  .masonry .item {   position: relative;   width:  100%;   float: left;   padding: 15px; }  **//tablet** .masonry .item {         width:  50%;     }  **//desktop** .masonry .item {         width:  33%;     } 

thanks in advance :-)

you might need use isotope, has built in sorting functions use?

http://isotope.metafizzy.co/demos/sorting.html

not sure want, still lay them out out in row first. add data-attribute each post spits out number order them by.

post 1 data-order: 1 cat: post 2 data-order: 2 cat: b post 3 data-order: 3 cat: post 4 data-order: 4 cat: b 

then make them appear cat on left, b on right @ desktop, alternate on single column mobile view. quite hack, might work?


Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -