admin管理员组文章数量:1130349
I'm sorry if this is a already asked Question but i'm trying to get my custom post types displayed in grid like this:
<div class="row>
<div class="col-md-4>
/* Start the Loop */
while (have_posts()) : the_post();
get_template_part('template-parts/post/content', get_post_format());
endwhile; // End of the loop.
</div>
</div
that mean i would like to Display every post in a div with the class col-md-4
I'm sorry if this is a already asked Question but i'm trying to get my custom post types displayed in grid like this:
<div class="row>
<div class="col-md-4>
/* Start the Loop */
while (have_posts()) : the_post();
get_template_part('template-parts/post/content', get_post_format());
endwhile; // End of the loop.
</div>
</div
that mean i would like to Display every post in a div with the class col-md-4
Share Improve this question edited Oct 31, 2018 at 20:06 MisterLA asked Oct 31, 2018 at 19:47 MisterLAMisterLA 52 bronze badges2 Answers
Reset to default 0You'll want to move the row/columns inside the loop to do this. Perhaps even inside the template part. Seeing as I don't know what's in there, I'd suggest this: (notice I corrected your missing " at the end of div classes and added php start/stop)
<div class="row">
<?php
/* Start the Loop */
while (have_posts()) : the_post();
echo '<div class="col-md-4">';
get_template_part('template-parts/post/content', get_post_format());
echo '</div>';
endwhile; // End of the loop.
?>
</div>
this is fine if there are only 4 items in your row. or your system handles row calculations for you. If it doesn't you'll need to move the row call into the loop as well and add item count and then if statements for the 1st and every 4th item after that.
The Thing is that i was trying to Display only the thumb and the title of the post inside the thumb with a "got to this Portfolio" button.
Something like this:
<div class="portfolio">
<div class="row">
<?php
$args = array( 'post_type' => 'portfolio', 'posts_per_page' => 10 );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
echo '<div class="col-md-4">';
the_title();
//here the thumb
//Here the "Go to Portfolio" Button
echo '</div>';
endwhile;
?>
</div>
</div>
I'm sorry if this is a already asked Question but i'm trying to get my custom post types displayed in grid like this:
<div class="row>
<div class="col-md-4>
/* Start the Loop */
while (have_posts()) : the_post();
get_template_part('template-parts/post/content', get_post_format());
endwhile; // End of the loop.
</div>
</div
that mean i would like to Display every post in a div with the class col-md-4
I'm sorry if this is a already asked Question but i'm trying to get my custom post types displayed in grid like this:
<div class="row>
<div class="col-md-4>
/* Start the Loop */
while (have_posts()) : the_post();
get_template_part('template-parts/post/content', get_post_format());
endwhile; // End of the loop.
</div>
</div
that mean i would like to Display every post in a div with the class col-md-4
Share Improve this question edited Oct 31, 2018 at 20:06 MisterLA asked Oct 31, 2018 at 19:47 MisterLAMisterLA 52 bronze badges2 Answers
Reset to default 0You'll want to move the row/columns inside the loop to do this. Perhaps even inside the template part. Seeing as I don't know what's in there, I'd suggest this: (notice I corrected your missing " at the end of div classes and added php start/stop)
<div class="row">
<?php
/* Start the Loop */
while (have_posts()) : the_post();
echo '<div class="col-md-4">';
get_template_part('template-parts/post/content', get_post_format());
echo '</div>';
endwhile; // End of the loop.
?>
</div>
this is fine if there are only 4 items in your row. or your system handles row calculations for you. If it doesn't you'll need to move the row call into the loop as well and add item count and then if statements for the 1st and every 4th item after that.
The Thing is that i was trying to Display only the thumb and the title of the post inside the thumb with a "got to this Portfolio" button.
Something like this:
<div class="portfolio">
<div class="row">
<?php
$args = array( 'post_type' => 'portfolio', 'posts_per_page' => 10 );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
echo '<div class="col-md-4">';
the_title();
//here the thumb
//Here the "Go to Portfolio" Button
echo '</div>';
endwhile;
?>
</div>
</div>
本文标签: Display Custom Post Type in divs
版权声明:本文标题:Display Custom Post Type in divs 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749214137a2333875.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论