Title: Updating old template
Last modified: August 19, 2016

---

# Updating old template

 *  Resolved [delitfrancais](https://wordpress.org/support/users/delitfrancais/)
 * (@delitfrancais)
 * [16 years, 7 months ago](https://wordpress.org/support/topic/updating-old-template/)
 * I updated a WordPress installation (from 2.3 or 2.3.1) to the actual version (
   2.8.4). When I updated, the template stop working properly.
 * I am not the one who programmed the initial template and I would need some help
   to make the template work again.
 * First, I need to include some data from the custom fields in the page.
    For example,
   I have a custom field names “author”. In the old template, the code to display
   the field in the page was `<?php the_meta_author(); ?>`. I tought that I would
   have to use the new function “get_post_meta”, but I can’t figure how to say “
   actual post” instead of a specific post id. I also look at “get_post_custom_values”
   but I dont want an array of valuse, but a single value.
 * This is only my first problem.

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

 *  [MichaelH](https://wordpress.org/support/users/michaelh/)
 * (@michaelh)
 * [16 years, 7 months ago](https://wordpress.org/support/topic/updating-old-template/#post-1237946)
 * Not sure what you mean by
 * >  how to say “actual post” instead of a specific post id.
 * But [get_post_meta()](http://codex.wordpress.org/Function_Reference/get_post_meta)
   seems to be a valid approach.
 *  Thread Starter [delitfrancais](https://wordpress.org/support/users/delitfrancais/)
 * (@delitfrancais)
 * [16 years, 7 months ago](https://wordpress.org/support/topic/updating-old-template/#post-1238049)
 * I want to display the custum field in the single page. So, the code will go in“
   single.php”
 * The code “get_post_meta” use tree parameters. 1. $post_id 2. $key 3. $single
 * For example, I have 2 post with the metadata “author”
    The value of the key for
   post #1 is “Paul” and for post #2 “Edward”.
 * If I add the line `<?php echo get_post_meta(1, 'author', true); ?>` in the file“
   single.php”, then, I will always get “Paul” as the author, because the cose is
   looking for the key author in the post #1.
 * What I want is, if I look at the page 1, I got “Paul” and for the page 2, I got“
   Edward”. So, for “$post_id” I don’t want to put a number, but I want the function
   that is used in “get_post_custom_values”. The “Default” value for “$post_id is“
   Current post”. And… if I write “current post” instead of a number, it did not
   work…
 * Is it more clear…?
 *  [MichaelH](https://wordpress.org/support/users/michaelh/)
 * (@michaelh)
 * [16 years, 7 months ago](https://wordpress.org/support/topic/updating-old-template/#post-1238078)
 * This should work:
 *     ```
       <?php echo get_post_meta($post->ID, 'author', true); ?>
       ```
   
 *  Thread Starter [delitfrancais](https://wordpress.org/support/users/delitfrancais/)
 * (@delitfrancais)
 * [16 years, 7 months ago](https://wordpress.org/support/topic/updating-old-template/#post-1238137)
 * I did work, thanks.
 *  Thread Starter [delitfrancais](https://wordpress.org/support/users/delitfrancais/)
 * (@delitfrancais)
 * [16 years, 7 months ago](https://wordpress.org/support/topic/updating-old-template/#post-1238198)
 * Next “problem”
 * We have a specific code for the page “index.php”. The code give the title and
   excerpt for each article published in the last issue (it’s a student paper website).
   
   What we actualy do is that we create a “summary” page that is displayed (it contain
   mostly nothing but metadata).
 * I changed the page “single.php” in order to display the summary with the script
   of “single2.php” and all the other with “single1.php”, however, the code of “
   index.php”, if pasted in “single2.php” will still display the last issue and 
   not the content of the “summary” we are looking at.
 * The actual code is the following :
 *     ```
       <?php get_header(); ?>
   
       <?php global $post; $myposts = get_posts('numberposts=1&offset=0&category=6'); foreach($myposts as $post) : setup_postdata($post); $jouredition = get_the_time('j.m.Y'); ?>
   
       <p>Édition du  <?php the_time('j F Y') ?></p>
   
       <p>Éditorial</span><br />
       <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a><br />
       <?php the_excerpt(); ?></p>
       <?php endforeach; ?>
   
       <p>Société
       <?php global $post; $myposts = get_posts('category=5'); foreach($myposts as $post) : setup_postdata($post); $jourpub = get_the_time('j.m.Y'); ?>
       <?php if ($jourpub == $jouredition) : ?>
       <br />
       <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a><br />
       <?php the_excerpt(); ?></p>
       <?php endif; ?>
       <?php endforeach; ?>
   
       <?php get_footer(); ?>
       ```
   
 * This code invoque the articles in the “Éditorial” and “Société” section, but 
   not from the issue we are lookink for, but for the last published.
 * Note, the is some french in it.
    Édition du = Edition of the (date) jouredition
   = day of edition jourpub = day of publication (I think) Éditorial and Société
   = Editorial and Society (these are some of the sections in the paper).
 * You can ask questions if it’s not clear.

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

The topic ‘Updating old template’ is closed to new replies.

## Tags

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

 * 5 replies
 * 2 participants
 * Last reply from: [delitfrancais](https://wordpress.org/support/users/delitfrancais/)
 * Last activity: [16 years, 7 months ago](https://wordpress.org/support/topic/updating-old-template/#post-1238198)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
