WordPress Theme Design Tutorial Part-2

WordPress Theme Design Tutorial

WordPress Theme Design: In this tutorial we show you how to callback the content to index.php file. First see the tutorial part-1.  In the previous lesson we create two files index.php and style.css. Now we work with index.php file.

Install the theme and edit index.php

Now install or active the theme that you create. Then open the index.php file by text editor. To do this accurately you can see this video for more easy the task:

Now copy the following code and paste to your index.php file.

<?php
if ( have_posts() ) :
 while ( have_posts() ) : the_post();  ?>
<h2> <?php the_title(); ?>
<?php the_excerpt(): ?>
 <?php endwhile;
else:
echo '<p>no ontent found</p>';
endif;
?>

After pasting above code to your index.php file then visit your site.  You will see the content and headlines of your site. If you have no content in your site. Please create post one or two, then see your site.

Header and footer

To showing default header write this code above previous code

<?php get_header(); ?>

Now showing default footer you need to write the following code

<?php get_footer(): ?>

Now final view of your index file looks like as follows:

<?php get_header(); ?>
<?php
if ( have_posts() ) :
 while ( have_posts() ) : the_post();  ?>
<h2> <?php the_title(); ?>
<?php the_excerpt(): ?>
 <?php endwhile;
else:
echo '<p>no ontent found</p>';
endif;
?>
<?php get_footer(): ?>

index is the main file of your site. So, you must create this file carefully. Otherwise your site may be broken or does not work. Follow me step by step and learn something about wordpress theme. WordPress is super fast CMS script for a long time. So, WordPress Theme Design tutorial can help you to become a web developer.

If you have any questions please put a comment in the comments box. Please don’t hesitate to ask me by comments.  Free WordPress Theme.

ABOUT MY TUTORIAL

This is a step by step tutorial. To learn wordpress theme development tutorial series one after another. You can follow my YouTube  Channel.



1 thought on “WordPress Theme Design Tutorial Part-2

Leave a Reply

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