Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialPirvan Marian
14,609 PointsDisplay post on 4 collumn using Wordpress
Hi, i really try but i can't do it now... how i can display post on 4 collumn or 3? Like using boostrap grid? I try this code : <?php /**
- Template Name: Custom Template */
get_header(); ?>
<div id="primary" class="content-area"> <main id="main" class="site-main" role="main">
<article <?php post_class(); ?>>
<header class="entry-header">
<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
</header><!-- .entry-header -->
<div class="entry-content">
<?php
// The Query
$args = array(
'post_type' => 'post',
'order' => 'ASC',
'orderby' => 'title',
'posts_per_page' => 1
);
$the_query = new WP_Query( $args );
// The Loop
if ( $the_query->have_posts() ) {
echo '<ul>';
while ( $the_query->have_posts() ) {
$the_query->the_post();
echo '<li>' . get_the_title() . '</li>';
}
echo '</ul>';
} else {
// no posts found
}
/* Restore original Post Data */
wp_reset_postdata();
?>
</div>
</article>
</main><!-- .site-main -->
</div><!-- .content-area -->
<?php get_footer(); ?>
and simple way : <div class="row"> <!-- MAIN ROW START***** --> <div class="col-sm-4"> <!-- article columns --> <div class="row" style="margin-bottom: 30px;"> <?php if (have_posts()) : while (have_posts()) : the_post();?> <div class='<?php echo 'col-xs-12 col-sm-6'; ?>'> <h2><?php the_title(); ?></h2> <p><?php the_content(); ?></p> </div> <?php endwhile; endif; ?> </div> </div> <!-- article columns end -->
<div class="col-sm-4"> <!-- Sidebar Start-->
<div class="row">
<div class="col-xs-12 col-sm-12">
this is for the sidebar
</div>
</div>
</div><!-- Sidebar End -->
<div> <!-- MAIN ROW END -->
No one work, why?