• uncommonpear

    (@uncommonpear)


    I’m using the Hueman theme and the Cornerstone section plug-in and everything is perfect, except for one thing that my lack of coding skills is making very challenging.

    Hueman’s main index page displays posts in a grid format. I like this and would like it to display on Hueman’s child menu pages as well, listing all items in “section” as created with Cornerstone.

    I can get the material for the section to display using code from Hueman’s content.php template, but I can’t get it to present it in a grid.

    I suspect it has something to do with the way the “the loop” is with cornerstone. If anyone can help with this adaptation, I would be most grateful.

    To be specific,

    In hueman, this code generates the grid:

    <?php if ( have_posts() ) : ?>
    
    	<div class="post-list group">
    		<?php $i = 1; echo '<div class="post-row">'; while ( have_posts() ): the_post(); ?>
    		<?php get_template_part('content'); ?>
    		<?php if($i % 2 == 0) { echo '</div><div class="post-row">'; } $i++; endwhile; echo '</div>'; ?>
    		</div><!--/.post-list-->
    
    	<?php get_template_part('inc/pagination'); ?>
    
    <?php endif; ?>

    However, cornerstone relies on the following lines to start and end the loop:

    <?php if ( cnr_have_children() ) : while ( cnr_have_children() ) : cnr_next_child(); ?>
    
    <?php endwhile; endif; ?>

    Again, if I use this block of code from content.php between the two lines above, I can get a list of posts from a given section to appear, but I cannot get the grid layout.

    <div class="post-thumbnail">
    			<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
    				<?php if ( has_post_thumbnail() ): ?>
    					<?php the_post_thumbnail('thumb-medium'); ?>
    				<?php elseif ( ot_get_option('placeholder') != 'off' ): ?>
    					<img src="<?php echo get_template_directory_uri(); ?>/img/thumb-medium.png" alt="<?php the_title(); ?>" />
    				<?php endif; ?>
    				<?php if ( has_post_format('video') && !is_sticky() ) echo'<span class="thumb-icon"><i class="fa fa-play"></i></span>'; ?>
    				<?php if ( has_post_format('audio') && !is_sticky() ) echo'<span class="thumb-icon"><i class="fa fa-volume-up"></i></span>'; ?>
    				<?php if ( is_sticky() ) echo'<span class="thumb-icon"><i class="fa fa-star"></i></span>'; ?>
    			</a>
    			<?php if ( comments_open() && ( ot_get_option( 'comment-count' ) != 'off' ) ): ?>
    				<a class="post-comments" href="<?php comments_link(); ?>"><span><i class="fa fa-comments-o"></i><?php comments_number( '0', '1', '%' ); ?></span></a>
    			<?php endif; ?>
    		</div><!--/.post-thumbnail-->
    
    		<div class="post-meta group">
    			<p class="post-category"><?php the_category(' / '); ?></p>
    			<p class="post-date"><?php the_time('j M, Y'); ?></p>
    		</div><!--/.post-meta-->
    
    		<h2 class="post-title">
    			<a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a>
    		</h2><!--/.post-title-->
    
    		<?php if (ot_get_option('excerpt-length') != '0'): ?>
    		<div class="entry excerpt">
    			<?php the_excerpt(); ?>
    		</div><!--/.entry-->
    		<?php endif; ?>

    If anyone can help with adapting the code from the Hueman main index page to play well with cornerstone’s loop, I would be very grateful.

    Thanks!

  • The topic ‘Hueman Theme & Cornerstone Plug-in’ is closed to new replies.