• Jon

    (@jonpaulwade)


    Hi

    I just created a test post and some custom fields in Twenty Eleven.
    The custom fields do not align with the rest of the post – they are positoned off to the left.

    http://www.naturaltherapists.co.uk/?p=4

    In single.php I edited so that it has:

    <?php get_template_part( 'content', 'single' ); ?>
    
    <?php the_meta(); ?>
    
    <?php comments_template( '', true ); ?>

    Why does it appear to the left? How can I fix this?

    Many thanks

    Jon.

    PS I have also been looking at creating custom post types for this (the is the next stage) but even though I have read tutorials etc. I seem to be failing. I created a single-listings.php with

    /**
     * Template Name: Listings
     *
     * Selectable from a dropdown menu on the edit page screen.
     */

    In the header, but it does not appear in the posts admin area. So any pointers here would be greatly appreciated too.

    HANG ON

    I just activated Twenty Twelve, thought that might work better…. will update if it does in a minute.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Jon

    (@jonpaulwade)

    OK, Using Twenty Twelve with;

    ?php while ( have_posts() ) : the_post(); ?>
    
    <?php the_meta(); ?>
    
    <?php get_template_part( 'content', get_post_format() ); ?>

    The custom fields appear at the top, and in another format.

    If I do:

    <?php while ( have_posts() ) : the_post(); ?>
    
    <?php get_template_part( 'content', get_post_format() ); ?>
    
    <?php the_meta(); ?>

    it appears after the “This entry was posted ….” part. I want them inside the actual content area.

    Googling…. failing to work this one out!

    Thread Starter Jon

    (@jonpaulwade)

    Latest

    Have not solved the problem, but found a way to list each custom field seperately, so I can format it better later (ignore the br’s for now!)

    But, still in the wrong place, below the publish details:

    <?php while ( have_posts() ) : the_post(); ?>
    
    <?php get_template_part( 'content', get_post_format() ); ?>
    
    Address: <?php echo get_post_meta($post->ID, "Address", true); ?>   <br /><br />
    Email: <?php echo get_post_meta($post->ID, "Email", true); ?>       <br /><br />
    Tel: <?php echo get_post_meta($post->ID, "Telephone", true); ?>      <br /><br />
    Website: <?php echo get_post_meta($post->ID, "Website", true); ?><br /><br />
    Thread Starter Jon

    (@jonpaulwade)

    Woo hoo!

    Edited content.php in Twenty-Twelve

    <div class="entry-content">
    			<?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentytwelve' ) ); ?>
    
          Address: <?php echo get_post_meta($post->ID, "Address", true); ?>   <br /><br />
    Email: <?php echo get_post_meta($post->ID, "Email", true); ?>       <br /><br />
    Tel: <?php echo get_post_meta($post->ID, "Telephone", true); ?>      <br /><br />
    Website: <?php echo get_post_meta($post->ID, "Website", true); ?><br /><br /> 
    
    			<?php wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'twentytwelve' ), 'after' => '</div>' ) ); ?>
    		</div><!-- .entry-content -->

    Now I just need to work out how to create a custom post style in Twenty Twelve, so posts without the fields won’t have the Address: etc on them.

    Unless there is a way to say “if custom field then add ….. and if not, leave blank …. ”

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom Field Position in Twenty Eleven’ is closed to new replies.