WordPress Theme Development Part 9 – Page

In WordPress we can add content by post or page. In a Newspaper or Blog
every single news is a post and pages like About, Contact. These are pages.
Behind the scene both are the same thing and they store in same database table. The difference is post type. Post’s post type is post and Page’s post type is page.

Well in your new WordPress theme create a file page.php in your theme’s root folder. Just like the index.php, add your header.php and footer.php in it.Now use this code where you want to show your page contents.


<?php while ( have_posts() ) : the_post(); ?>
<h1><?php the_title();?></h1>
<div class="content">
<?php the_content(); ?>
</div>
<?php endwhile; ?>

Now go to your WordPress admin, create a new page and add the page title and page content. Click on the Permalink and you will see the page content you added. So in this way you can add several pages as much your website required.
Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *