Split post into two columns... Image left /Text & meta right (6 posts)

  1. Mark Boyce
    Posted 6 years ago #

    Anyone have any idea about splitting the_content? What I want to do is split each post into 2 columns and have a an image on one side, and then the , title, text (or exerpt) and meta on the other. A bit like:


    All I've managed to find so far is information on splitting pages not posts.


  2. ejk82
    Posted 6 years ago #

    I could also use some help on this one.

  3. sensecall
    Posted 6 years ago #

    I'm no wordpress expert but I've managed to achieve this by using custom fields on the post.

    Have a look at this link - its really helpful.

    Hope that helps.

  4. kevinlanteri
    Posted 6 years ago #

    hey Mark,

    a simple way to do so it's to get the first image attached to your post with a function :

    function get_first_attachment() {
    	global $post;
    	$id = $post->ID;
    	$attachments = get_children( array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'DESC', 'orderby' => 'menu_order ASC') );
    	$tpl = get_bloginfo('template_url');
    	$nothing = $tpl.'/nothing.jpg';
    	if ( empty($attachments) )
    		return $nothing;
    		foreach ( $attachments as $id => $attachment )
    			$link = wp_get_attachment_url($id);
    		return $link;

    paste this in your function.php template file, then simply create your html template page with it:

    <!-- put this inside the loops -->
    <div class="alignleft"><img src="<?php echo get_first_attachment(); ?>" width="150" height="150"></div>
    <div class="alignright">
    <!-- your title, text and meta goes here -->

    that is the principle...it took the first attachment linked to your post (no need to put it on the post body, just upload it and keep it in the gallery) and return it separatly.

    a simpler way to do so is to use Press75 Simple Post Thumbnails plugin

    First gives you more control, second ask you less mind effort,

    up to you, cheers,


  5. dylancoyne
    Posted 5 years ago #

    Hi KL,

    This is just what I was looking for, thanks. I have tried several plugins, as you suggested in your post, but had issues with upgrading WP and the RSS feeds.

    Which leads me onto my question...

    How do I output the first image's url using your method so it is parsed into the CDATA for my RSS feed?



  6. wob
    Posted 5 years ago #

    I want something like this aswell. The code that kevinlanteri supplied works flawless. However, I would also like the possibility to add video (from vimeo or such) and most importantly, this portfolio plugin:

    I messed around some, but I don't really know PHP so couldn't get it to work. Maybe there is some easier way to fix this? Anyone?

    I realize this is kind of a big request, but all help is appreciated

Topic Closed

This topic has been closed to new replies.

About this Topic