Get the posts title — wordpress
-
I have a slider with 6 featured images from 6 different post’s, from a specific category on wordpress.
What i’m trying to do is a function where i create 6/10/12 div’s (depending on how many post’s in this category i have published), and inside each div i want to show the titles of each post.
I have this so far (but isnt working!!):
HTML/PHP
global $post; $count_posts = wp_count_posts(); $published_posts = $count_posts->publish; $args = array( 'numberposts' => $published_posts, 'category' => $slidecat ); $myposts = get_posts( $args ); foreach( $myposts as $post ) : setup_postdata($post); ?> <li> <?php if ( has_post_thumbnail() ) { the_post_thumbnail(); } ?> <div class="sb-bolas"> <?php for ($zz=0; $zz<$published_posts; $zz++) { ?> <div class="bolas-grad"> <?php //echo $parent_title = get_the_title($post->post_parent); echo the_title($zz); ?> </div> <?php } ?> </div> </li> <?php endforeach;
Any ideas?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Get the posts title — wordpress’ is closed to new replies.