Single.php
-
Can someone please help me? I am trying to get the date moved to the top under the entry title and the categories moved to the bottom.
Here is my current information in the single.php:
<?php get_header(); ?>
<?php echo ace_breadcrumb(); ?>
<?php if ( get_post_meta( $post->ID, ‘ace_wide’, true ) ) { echo ‘<section class=”section-wide” role=”main”>’; } else { echo ‘<section class=”section” role=”main”>’; } ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php get_template_part( ‘content’, get_post_format() ); ?>
<?php endwhile; else: get_template_part( ‘content’, ‘none’ ); endif; ?>
</section><!– .section –>
<?php if ( get_post_meta( $post->ID, ‘ace_wide’, true ) ) {} else { echo get_sidebar(); } ?>
<?php get_footer(); ?>
Here is my website: https://goo.gl/9mqmzz
-
I think you have “content.php” inside of your theme folder. If so, please copy and paste its content here so we can help you.
Here is the content.php: (Thank you, in advance, for your help)
<article <?php post_class( ‘article hentry’ ); ?> id=”post-<?php the_ID(); ?>” itemscope itemtype=”https://schema.org/Article”>
<?php if ( get_post_meta( $post->ID, ‘ace_title’, true ) ) {} else { ?>
<section class=”post-category”><?php the_category(‘, ‘); ?></section>
<header class=”post-header”>
<h1 class=”post-title entry-title” itemprop=”name”>” rel=”<?php esc_attr_e( ‘bookmark’,’ace’ ); ?>”><?php the_title(); ?></h1>
</header>
<?php } ?><div class=”post-content”>
<?php the_content(); ?>
<?php echo ace_get_link_pages() ?>
<?php if ( function_exists( ‘ace_post_author_bio’ ) ) { echo ace_post_author_bio(); } ?>
<section class=”post-meta”>
<time datetime=”<?php echo get_the_date( ‘Y-m-d’ ); ?>” itemprop=”datePublished” class=”updated”><?php the_time( get_option( ‘date_format’ ) ); ?></time><?php if ( function_exists( ‘ace_post_author’ ) ) { echo ace_post_author(); } ?> | <?php comments_popup_link( __( ‘0 comment’,’ace’ ), __( ‘1 Comment’,’ace’ ), __( ‘% Comments’,’ace’ ) ); ?>
</section><!– .post-meta –><footer class=”post-footer”>
<ul class=”footer-navi”>
<?php previous_post_link( ‘<li class=”previous” rel=”prev”>« %link’ ); ?>
<?php next_post_link( ‘<li class=”next” rel=”next”>%link »’ ); ?><?php if ( get_option( ‘ace_enable_related’ ) ) { get_template_part( ‘layouts/related’ ); } ?>
<p><?php the_tags( ‘Tags: ‘, ‘, ‘, ‘
‘ ); ?></p></footer><!– .post-footer –>
<?php comments_template( ‘/comments.php’,true ); ?>
</div><!– .post-content –>
</article><!– .article –>
First backup your existing code then try this:
<article <?php post_class( 'article hentry' ); ?> id="post-<?php the_ID(); ?>" itemscope itemtype="https://schema.org/Article"> <?php if ( get_post_meta( $post->ID, 'ace_title', true ) ) {} else { ?> <time datetime="<?php echo get_the_date( 'Y-m-d' ); ?>" itemprop="datePublished" class="updated"><?php the_time( get_option( 'date_format' ) ); ?></time> <header class="post-header"> <h1 class="post-title entry-title" itemprop="name">" rel="<?php esc_attr_e( 'bookmark','ace' ); ?>"><?php the_title(); ?></h1> </header> <?php } ?> <div class="post-content"> <?php the_content(); ?> <?php echo ace_get_link_pages() ?> <?php if ( function_exists( 'ace_post_author_bio' ) ) { echo ace_post_author_bio(); } ?> <section class="post-meta"> <section class="post-category"><?php the_category(', '); ?></section> <?php if ( function_exists( 'ace_post_author' ) ) { echo ace_post_author(); } ?> | <?php comments_popup_link( __( '0 comment','ace' ), __( '1 Comment','ace' ), __( '% Comments','ace' ) ); ?> </section><!-- .post-meta --> <footer class="post-footer"> <ul class="footer-navi"> <?php previous_post_link( '<li class="previous" rel="prev">? %link' ); ?> <?php next_post_link( '<li class="next" rel="next">%link ?' ); ?> <?php if ( get_option( 'ace_enable_related' ) ) { get_template_part( 'layouts/related' ); } ?> <p><?php the_tags( 'Tags: ', ', ', ' ' ); ?></p> </footer><!-- .post-footer --> <?php comments_template( '/comments.php',true ); ?> </div><!-- .post-content --> </article><!-- .article -->
Hope it helps.
So close!
Two questions:
1) When I click on the post, it shows “” REL=”BOOKMARK”>” prior to the blog post title. Any suggestions?
2) It is possible to have the stream of blog posts show the date with the categories and tags under the post?
1)
<article <?php post_class( 'article hentry' ); ?> id="post-<?php the_ID(); ?>" itemscope itemtype="https://schema.org/Article"> <?php if ( get_post_meta( $post->ID, 'ace_title', true ) ) {} else { ?> <time datetime="<?php echo get_the_date( 'Y-m-d' ); ?>" itemprop="datePublished" class="updated"><?php the_time( get_option( 'date_format' ) ); ?></time> <header class="post-header"> <h1 class="post-title entry-title" itemprop="name" rel="<?php esc_attr_e( 'bookmark','ace' ); ?>"><?php the_title(); ?></h1> </header> <?php } ?> <div class="post-content"> <?php the_content(); ?> <?php echo ace_get_link_pages() ?> <?php if ( function_exists( 'ace_post_author_bio' ) ) { echo ace_post_author_bio(); } ?> <section class="post-meta"> <section class="post-category"><?php the_category(', '); ?></section> <?php if ( function_exists( 'ace_post_author' ) ) { echo ace_post_author(); } ?> | <?php comments_popup_link( __( '0 comment','ace' ), __( '1 Comment','ace' ), __( '% Comments','ace' ) ); ?> </section><!-- .post-meta --> <footer class="post-footer"> <ul class="footer-navi"> <?php previous_post_link( '<li class="previous" rel="prev">? %link' ); ?> <?php next_post_link( '<li class="next" rel="next">%link ?' ); ?> <?php if ( get_option( 'ace_enable_related' ) ) { get_template_part( 'layouts/related' ); } ?> <p><?php the_tags( 'Tags: ', ', ', ' ' ); ?></p> </footer><!-- .post-footer --> <?php comments_template( '/comments.php',true ); ?> </div><!-- .post-content --> </article><!-- .article -->
2) Please copy and paste your “index.php”.
I cannot thank you enough for your time and expertise. Here is my index.php:
<?php get_header() ?> <?php echo ace_breadcrumb(); ?> <?php if ( get_option( 'ace_full_blog' ) ) { echo '<section class="section-wide" role="main">'; } else { echo '<section class="section" role="main">'; } ?> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <?php get_template_part( 'content', 'list' ); ?> <?php endwhile; ?> <?php echo ace_get_pagination_links(); ?> <?php else : get_template_part( 'content', 'none' ); endif; ?> </section><!-- .section --> <?php if (get_option( 'ace_full_blog' ) ) { } else { echo get_sidebar(); } ?> <?php get_footer(); ?>
Your “index.php” is pointing to another file. It seems you have a “content-list.php” inside your theme folder so please copy and paste it’s content here.
<article <?php if ( get_option( 'ace_col_blog' ) ) { echo post_class( 'article article-list hentry' ); } else { echo post_class( 'article hentry' ); }?> id="post-<?php the_ID(); ?>" itemscope itemtype="https://schema.org/Article"> <?php if ( get_option( 'ace_enable_post_thumbnail' ) ) { ?> <?php if ( has_post_thumbnail() ) { ?> <a href="<?php the_permalink() ?>"><?php the_post_thumbnail( 'post_thumb', array( 'class'=>'alignleft post-thumbnail' ) ); ?></a> <?php } ?> <?php } ?> <?php if ( get_post_meta( $post->ID, 'ace_title', true ) ) {} else { ?> <section class="post-category"><?php the_category(', '); ?></section> <header class="post-header"> <h2 class="post-title entry-title" itemprop="name"><a href="<?php the_permalink(); ?>" rel="<?php esc_attr_e( 'bookmark','ace' ); ?>"><?php the_title(); ?></a></h2> </header> <?php } ?> <div class="post-content"> <?php if ( get_option( 'ace_enable_excerpt' ) ) { echo the_excerpt(); } else { echo the_content(); } ?> <section class="post-meta"> <time datetime="<?php echo get_the_date( 'Y-m-d' ); ?>" itemprop="datePublished" class="updated"><?php the_time( get_option( 'date_format' ) ); ?></time><?php if ( function_exists( 'ace_post_author' ) ) { echo ace_post_author(); } ?> | <?php comments_popup_link( __( '0 comment','ace' ), __( '1 Comment','ace' ), __( '% Comments','ace' ) ); ?> </section><!-- .post-meta --> </div><!-- .post-content --> </article><!-- .article -->
I’m not sure about the style but this code will work for you:
<article <?php if ( get_option( 'ace_col_blog' ) ) { echo post_class( 'article article-list hentry' ); } else { echo post_class( 'article hentry' ); }?> id="post-<?php the_ID(); ?>" itemscope itemtype="https://schema.org/Article"> <?php if ( get_option( 'ace_enable_post_thumbnail' ) ) { ?> <?php if ( has_post_thumbnail() ) { ?> <a href="<?php the_permalink() ?>"><?php the_post_thumbnail( 'post_thumb', array( 'class'=>'alignleft post-thumbnail' ) ); ?></a> <?php } ?> <?php } ?> <?php if ( get_post_meta( $post->ID, 'ace_title', true ) ) {} else { ?> <header class="post-header"> <h2 class="post-title entry-title" itemprop="name"><a href="<?php the_permalink(); ?>" rel="<?php esc_attr_e( 'bookmark','ace' ); ?>"><?php the_title(); ?></a></h2> </header> <?php } ?> <div class="post-content"> <?php if ( get_option( 'ace_enable_excerpt' ) ) { echo the_excerpt(); } else { echo the_content(); } ?> <section class="post-meta"> <section class="post-category"><?php the_category(', '); ?> | </section> <time datetime="<?php echo get_the_date( 'Y-m-d' ); ?>" itemprop="datePublished" class="updated"><?php the_time( get_option( 'date_format' ) ); ?></time> <?php if ( function_exists( 'ace_post_author' ) ) { echo ace_post_author(); } ?> | <?php comments_popup_link( __( '0 comment','ace' ), __( '1 Comment','ace' ), __( '% Comments','ace' ) ); ?> <?php the_tags( ' | Tags: ', ' ? ', '' ); ?> </section><!-- .post-meta --> </div><!-- .post-content --> </article><!-- .article -->
It is perfect! Thank you so much for all of your assistance!
I have updated some things for the bottom of the content-list.php section to show both the categories (shown as “Posted in” and tags). For some reason, there is an extra space prior to the posted in. Can you please assist?
Here is the content-list.php code currently:
<article <?php if ( get_option( 'ace_col_blog' ) ) { echo post_class( 'article article-list hentry' ); } else { echo post_class( 'article hentry' ); }?> id="post-<?php the_ID(); ?>" itemscope itemtype="https://schema.org/Article"> <?php if ( get_option( 'ace_enable_post_thumbnail' ) ) { ?> <?php if ( has_post_thumbnail() ) { ?> <a href="<?php the_permalink() ?>"><?php the_post_thumbnail( 'post_thumb', array( 'class'=>'alignleft post-thumbnail' ) ); ?></a> <?php } ?> <?php } ?> <?php if ( get_post_meta( $post->ID, 'ace_title', true ) ) {} else { ?> <header class="post-header"> <h2 class="post-title entry-title" itemprop="name"><a href="<?php the_permalink(); ?>" rel="<?php esc_attr_e( 'bookmark','ace' ); ?>"><?php the_title(); ?></a></h2> <time datetime="<?php echo get_the_date( 'Y-m-d' ); ?>" itemprop="datePublished" class="updated"><?php the_time( get_option( 'date_format' ) ); ?></time> </header> <?php } ?> <div class="post-content"> <?php if ( get_option( 'ace_enable_excerpt' ) ) { echo the_excerpt(); } else { echo the_content(); } ?> <section class="post-meta"> <section class="post-category">Posted in <?php the_category( ' ' ); ?> |<?php the_tags( ' | Tags: ', ' ? ', '' ); ?></section> <section> <?php if ( function_exists( 'ace_post_author' ) ) { echo ace_post_author(); } ?> <?php comments_popup_link( __( '0 comment','ace' ), __( '1 Comment','ace' ), __( '% Comments','ace' ) ); ?></section> </section><!-- .post-meta --> </div><!-- .post-content --> </article><!-- .article -->
Try this:
<article <?php if ( get_option( 'ace_col_blog' ) ) { echo post_class( 'article article-list hentry' ); } else { echo post_class( 'article hentry' ); }?> id="post-<?php the_ID(); ?>" itemscope itemtype="https://schema.org/Article"> <?php if ( get_option( 'ace_enable_post_thumbnail' ) ) { ?> <?php if ( has_post_thumbnail() ) { ?> <a href="<?php the_permalink() ?>"><?php the_post_thumbnail( 'post_thumb', array( 'class'=>'alignleft post-thumbnail' ) ); ?></a> <?php } ?> <?php } ?> <?php if ( get_post_meta( $post->ID, 'ace_title', true ) ) {} else { ?> <header class="post-header"> <h2 class="post-title entry-title" itemprop="name"><a href="<?php the_permalink(); ?>" rel="<?php esc_attr_e( 'bookmark','ace' ); ?>"><?php the_title(); ?></a></h2> <time datetime="<?php echo get_the_date( 'Y-m-d' ); ?>" itemprop="datePublished" class="updated"><?php the_time( get_option( 'date_format' ) ); ?></time> </header> <?php } ?> <div class="post-content"> <?php if ( get_option( 'ace_enable_excerpt' ) ) { echo the_excerpt(); } else { echo the_content(); } ?> <section class="post-meta"> <section class="post-category">Posted in <?php the_category( ' ' ); ?> <?php the_tags( ' | Tags: ', ' ? ', '' ); ?> <?php if ( function_exists( 'ace_post_author' ) ) { echo ace_post_author(); } ?> <?php comments_popup_link( __( '0 comment','ace' ), __( '1 Comment','ace' ), __( '% Comments','ace' ) ); ?></section> </section><!-- .post-meta --> </div><!-- .post-content --> </article><!-- .article -->
It still seems to be indented…
- The topic ‘Single.php’ is closed to new replies.