Link to home
Start Free TrialLog in
Avatar of phillystyle123
phillystyle123Flag for United States of America

asked on

WordPress - edit the_content to move date and author below post title

I need a way to edit "the_content" and add the date and author under the title in my single posts.  I've tried adding a couple of filters to my functions.php file but I can't figure out how to separate out the Title, the rest of the post content and add the date and author in between.

I need:

Title
Date | Author
Content (without title)

Here's my content-single.php code:  (Link to sample post)

<?php
/**
 * Theme: Flat Bootstrap
 * 
 * The template used for displaying a single article (blog post) with sidebar
 *
 * @package flat-bootstrap
 */
?>

<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

	<?php if ( is_single () ) : ?>
		<?php get_template_part( 'content', 'post-header' ); ?>
	<?php endif; ?>
	
	<div class="entry-content">
		<?php the_content(); ?>
		
		<?php // Show the categories and tags ?>
		<?php if ( is_single () ) : ?>
			<?php get_template_part( 'content', 'post-footer' ); ?>
		<?php endif; ?>

		<?php // If multiple pages, display next/previous page links ?>
		<?php get_template_part( 'content', 'page-nav' ); ?>
		
	</div><!-- .entry-content -->

	<?php //get_template_part( 'content', 'post-nav' ); ?>

</article><!-- #post-## -->

Open in new window

Avatar of eemit
eemit
Flag of Germany image

You should check what is in the file:
content-post-header.php
Avatar of phillystyle123

ASKER

content-post-header.php is output above the_content in content-single.php and it contains the meta info I want to output below the post title. How do I move this meta info into the_content instead of above it.

<?php if ( is_single () ) : ?>
		<?php get_template_part( 'content', 'post-header' ); ?>
	<?php endif; ?>
	
	<div class="entry-content">
		<?php the_content(); ?>

Open in new window

phillystyle123,
first of all, make always changes only in a child theme.
Read in WordPress codex about child themes.
Let me try this theme and I'll post back.
I am using a child theme. Please let me know if you find anything. Thanks.
ASKER CERTIFIED SOLUTION
Avatar of eemit
eemit
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Although this isn't really the answer to the question, the question itself is misleading. "the_content" doesn't include the post title. The post title (in this particular theme) is in header.php.

What's going on here is that the author of this particular post added the title in the content so it looks like the title is appearing below the meta info (date, author).  I removed the post title from header.php so that's why the post title above the meta info is missing. Your screen shot led me to activate my parent theme which led to this revelation.

Thanks for the help!