Display Year in WP Title
-
Good day,
I create a new movie theme. I added some custom field in my “New Post”.
Screenshot: https://s32.postimg.org/i5a960u39/image.jpgI’m using this fuction code:
function movie_content(){ global $post; $details = get_post_meta( $post->ID, '_movie_site', true ); $has_data = true; if( !is_array( $details ) ) $has_data = false; add_meta_box( 'name', __( 'Movie details', '123' ), 'movie_content', ABC_MOVIE, 'normal', 'high', null );
In Admin dashboard, when i create a “New Post”, I’m using this below code for display “Year” form (view screenshot).
<tr> <th><label for="movie-site-year"><?php _e( 'Year', '' ); ?></label></th> <td> <input name="movie_site[year]" type="text" class="fullwidth" id="movie-site-year" value="<?php echo $has_data?$details['year']:''; ?>"> <small class="desc"><?php _e( 'Movie release year', '' ); ?></small> </td> </tr>
And I using this code for display “Year” in my wordpress template (example: 1997).
<?php echo $movie_site['year']; ?>
Everything work fine, I can display movie Year in my single.php template.
***
My question is, I want that “Year” appear beside my title. But i don’t know how create it.
My current Post title: Titanic.
I want something like this: Titanic (1997).Can someone help me, please!
Thanks
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Display Year in WP Title’ is closed to new replies.