Breaking out of Template
-
Having templates for the posts is awesome, but I just realised a limitation
1. Create multiple instances of the widget by using any builder framework.
2. Selecting for the homepage layout a template called Newsflash
3. Want to give the whole container red color
–>The color cann only be applied to list through template, not the whole container.Workaround:
Clear label, place the Header inside the template and additionally wrap a div around all (inside IF statement) so that I can apply a class to reach by CSS.Could you offer FULL template switch, so I can get the label from the template and render it ?
if ( $flexible_posts->have_posts() ): ?> <div class="newsflash" style="background-color: #FF8040"> <h4>Newsflash</h4> <ul class="dpe-flexible-posts"> <?php while ( $flexible_posts->have_posts() ) : $flexible_posts->the_post(); global $post; ?> <li id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <a href="<?php echo the_permalink(); ?>"> <?php if ( $thumbnail == true ) { // If the post has a feature image, show it if ( has_post_thumbnail() ) { the_post_thumbnail( $thumbsize ); // Else if the post has a mime type that starts with "image/" then show the image directly. } elseif ( 'image/' == substr( $post->post_mime_type, 0, 6 ) ) { echo wp_get_attachment_image( $post->ID, $thumbsize ); } } ?> <div class="title"><?php the_title(); ?></div> </a> </li> <?php endwhile; ?> </ul> </div>
thanks
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Breaking out of Template’ is closed to new replies.