koon0789 Posted October 24, 2014 Share Posted October 24, 2014 After days of agony, I finally figured out a way to display my blog posts masonry style. However, I now want to find out if I can make it look exactly (or close to) the static design that I had before which is this : http://pier36nyc.com/events/ How my dynamic masonry looks like right now on my localhost: http://postimg.org/image/uy5jb4zax/ This is the code for the masonry: <script> jQuery(document).ready(function($){ var $container = $('#container').masonry(); $container.imagesLoaded( function() { $container.masonry({ isFitWidth: true });; }); console.log ('JQuery Works'); }); </script> =========== <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div class="box"> <div class="holder"> <!-- this is JQuery class --> <?php if ( has_post_thumbnail() ): ?> <?php echo the_post_thumbnail(); ?> <?php else: ?> <?php echo the_content(); ?> <?php endif; ?> <div class="info"> <!-- this is JQuery class --> <p class="title"><?php the_title(); ?></p> <p class="caption"> <?php if ( has_excerpt() ) : ?> <?php the_excerpt(); ?> <?php endif; ?></p> <a href="<?php the_permalink() ?>"><input class="button1" type="button" value="VIEW EVENT" /></a> </div> </div> </div> <?php endwhile; endif; ?> =================== The way my dynamic masonry look like that (I think) is because on the Php Code, it wraps every post in an individual class, hence giving it the same width. I feel like I need to tweak the logic, such as dividing posts into two categories : 'rectangle' and 'square', so that when the code generates the masonry, it will output the blocks in different shapes depending on the random generator. Can you guys help me out with this one?My knowledge in JQuery and PHP is very basic. I'm good at HTML and CSS but still learning JQ/PHP. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.