Title: custom fields problem
Last modified: August 19, 2016

---

# custom fields problem

 *  [sambkk](https://wordpress.org/support/users/sambkk/)
 * (@sambkk)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/custom-fields-problem-1/)
 * Hi
    can anyone help me with an issue regarding custom fields.
 * I have a file about.php called from sidebar.
    Here is the code:
 *     ```
       <!--about-->
        	<div id="about">
           <?php query_posts('pagename=about'); ?> 
   
           <?php while (have_posts()) : the_post(); $myphoto = get_post_meta($post->ID, "myphoto", TRUE); $mydesc = get_post_meta($post->ID, "mydesc", TRUE); ?>
   
           <h3>About Me</h3>
         	<a href="<?php the_permalink() ?>"><img src="<?php echo $myphoto; ?>" alt="<?php bloginfo('blogname'); ?>" title="<?php bloginfo('blogname'); ?>" /></a><span><?php echo $mydesc ;?></span>
         	</div><!--about-end-->      
   
       	<?php endwhile; ?>
       ```
   
 * the custom fields keys are written directly in the file. I got these instructions
   from a tutorial.
 * I cant figure out what I need to add into the custom fields to get the content
   to display.
    So far I uploaded an image using the media library, then I created
   a post, then I added a custom field name “mydesc” and entered the permalink url
   to the new post as the value for the custom field. I then added another custom
   field,name “myphoto” and entered the url to that image as the value (directly
   pasted in both cases). The about.php code is present on every page but the content
   isnt showing. can anyone give some advice?

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [tjeastmond](https://wordpress.org/support/users/tjeastmond/)
 * (@tjeastmond)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/custom-fields-problem-1/#post-1063209)
 * Give this a shot
 *     ```
       <!--about-->
       <div id="about">
       	<?php
       		$page = get_page_by_title('about');
       		$myphoto = get_post_meta($page->ID, 'myphoto', TRUE);
       		$mydesc = get_post_meta($page->ID, 'mydesc', TRUE);
       	?>
       	<h3>About Me</h3>
       	<a href="<?php echo get_permalink($page->ID) ?>"><img src="<?= $myphoto; ?>" alt="<?php bloginfo('blogname'); ?>" title="<?php bloginfo('blogname'); ?>" /></a>
       	<span><?= $mydesc ;?></span>
       </div>
       <!--about-end-->
       ```
   
 *  Thread Starter [sambkk](https://wordpress.org/support/users/sambkk/)
 * (@sambkk)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/custom-fields-problem-1/#post-1063228)
 * Hi
    thank you for the advice.
 * unfortunately I didnt work, i got a parse error.
 * I can get the image to display ok by coding the image path in directly
 * but I still have no idea how t get this to work as its supposed to 🙁
 *  [tjeastmond](https://wordpress.org/support/users/tjeastmond/)
 * (@tjeastmond)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/custom-fields-problem-1/#post-1063239)
 * Can you post a link for me to see?
 *  Thread Starter [sambkk](https://wordpress.org/support/users/sambkk/)
 * (@sambkk)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/custom-fields-problem-1/#post-1063247)
 * Hi
    I really appreciate you trying to help me. unfortunately the build is on 
   my local machine. here is a link to the tutorial I was following: [Word press tutorial](http://themetation.com/2008/07/17/how-to-create-wordpress-themes-from-scratch-part-3a/)
   It just leaves a few issues open, otherwise I found it ver helpful. Anyway my
   about.php is from there, Thanks again.
 *  Thread Starter [sambkk](https://wordpress.org/support/users/sambkk/)
 * (@sambkk)
 * [17 years, 1 month ago](https://wordpress.org/support/topic/custom-fields-problem-1/#post-1063352)
 * thanks for the help tjeasmond
    I figured it out by myself, just took a little
   studying about what custom fields are

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘custom fields problem’ is closed to new replies.

## Tags

 * [custom fields](https://wordpress.org/support/topic-tag/custom-fields/)

 * 5 replies
 * 2 participants
 * Last reply from: [sambkk](https://wordpress.org/support/users/sambkk/)
 * Last activity: [17 years, 1 month ago](https://wordpress.org/support/topic/custom-fields-problem-1/#post-1063352)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
