Custom page template – displaying attached images
-
Hi,
I haver created a custom template (child to the twenty twelwe template)…
I want to show a two column layout, the left shall be the data used in the page text, amd the right will display all my attached pictures (that I have attached to this page).
How do I style it properly with the<li>
and the<div>
. In the example bellow I seems to get the layout ok, but I got the dots at the<li>...
//Sam<?php /** * Template Name: Object Description * Description: Object Description Page Template * @package WordPress * @subpackage Twenty_Twelve * @since Twenty Twelve 1.0 */ get_header(); ?> <div id="primary" class="site-content"> <div id="content" role="main"> <?php while ( have_posts() ) : the_post(); $args = array( 'post_type' => 'attachment', 'numberposts' => -1, 'order' => 'ASC', 'orderby' => 'title', 'post_status' => null, 'post_parent' => $post->ID ); $attachments = get_posts( $args ); if ( $attachments ) { $default_attr = array( //'src' => $src, 'class' => "attachment-post-thumbnail wp-post-image", //'alt' => trim(strip_tags( get_post_meta($attachment_id, '_wp_attachment_image_alt', true) )), ); echo '<div class="entry-page-image">'; foreach ( $attachments as $attachment ) { echo '</li> <li>'; echo wp_get_attachment_image( $attachment->ID, 'medium', false, $default_attr ); echo '</li> '; } echo '</div>'; } ?> <?php get_template_part( 'content', 'page' ); ?> <?php endwhile; // end of the loop. ?> </div><!-- #content --> </div><!-- #primary --> <?php get_sidebar( 'front' ); ?> <?php get_footer(); ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Custom page template – displaying attached images’ is closed to new replies.