WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Displaying a Custom Field in a Page

[Resolved] Displaying a Custom Field in a Page

  • Hi

    I have this but it is not working as I assume because it is not in the loop? Help?

    <?php
    /*
    Template Name: Whatever
    */
    ?>
    
    <html>
    <head>
    <title>Demo Template</title>
    
    <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>">
    
    </head>
    
    <body>
    
    <div id="wrapper">
    
    	<div id="photo">
    
    		<img src="HannahDeCanchoGREEN.jpg" alt="Klematis" width="300" height="446" />
    
    	</div>
    
    	<div id="textblock">
    
    		<p> <?php the_meta(); ?> </p>
    
    	</div>
    </div>
Viewing 6 replies - 1 through 6 (of 6 total)
  • put it in the loop

    what just the

    <p> <?php the_meta(); ?> </p>

    bit??

    got it!!

    <?php if (have_posts()) : ?>
                   		<?php while (have_posts()) : the_post(); ?>
                   			<!-- do stuff ... -->
    				<?php the_meta(); ?>
    				<?php the_time('l, F jS, Y') ?>
    
                   		<?php endwhile; ?>
    		<?php endif; ?>

    excellent thanks!

    how do i remove the name of the custom field from displaying?

    i use: Get Custom Field Values

    here is what some of my code looks like:

    <?php query_posts('category_name=board-of-directors&order=asc');
         	while (have_posts()) : the_post();
        	$do_not_duplicate = $post->ID; ?>
        	<div>
    		<h3><?php the_title(); ?> <span><?php echo c2c_get_custom('boardTitle'); ?></span></h3>
    		<p><?php the_content() ?></p>
    	</div>
    <?php endwhile; ?>

    this loops thru my board of directors, displays their Name (title) their Title on the board (boardTitle as a custom field), and their bio (content)

    hope this helps

    Yes it did!

    I did this

    <?php if (have_posts()) : ?>
                   		<?php while (have_posts()) : the_post(); ?>
                   			<!-- do stuff ... -->
    
    				<p> <?php echo get_post_meta($post->ID, 'TextBox', true) ?> </p>
    				<p> <?php echo get_post_meta($post->ID, 'TextBox2', true) ?> </p>
    				<p> <?php echo get_post_meta($post->ID, 'TextBox3', true) ?> </p>
    				<p> <?php echo get_post_meta($post->ID, 'TextBox4', true) ?> </p>
    				<p> <?php the_time('l, F jS, Y') ?> </p>
    
                   		<?php endwhile; ?>
    		<?php endif; ?>
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Resolved] Displaying a Custom Field in a Page’ is closed to new replies.
Skip to toolbar