How to setup single post template for wordpress

 First go to single.php page in theme folder.

Now go to page.php and copy banner area html and paste in single.php because page.php display single page and single.php display single post look similar.

So remove default the_title and the_content and add banner area html.

Now use container class from page.php in single.php to display content so add that div like below

<div class="container container--narrow page-section">
</div>

and in above div we will display content.

inside above container div write this content ->

<div class="generic-content">
    <?php the_content();  ?>
  </div>

and save check.

Now we add metabox in single  post

Copy the metabox code from page.php and paste above content in single.php.

And now instead of display blog title i will display author date and category so copy from index.php for that code and paste by replacing title.

like below complete code for metabox 

<div class="metabox metabox--position-up metabox--with-home-link">
    <p>
      <a class="metabox__blog-home-link" href="<?php echo site_url('/blog'); ?>">
        <i class="fa fa-home" aria-hidden="true"></i> Blog Home
      </a>
      <span class="metabox__main">
        Posted by <?php the_author_posts_link(); ?> on <?php the_time('F j, Y'); ?> in
        <?php echo get_the_category_list(', '); ?>
      </span>
    </p>
  </div>

and save.

Comments

Popular posts from this blog

Basics Of PHP

Creating App.js for Node Application

WordPress Full Guide For Developer