Custom WordPress Layout for Short Post Site

WordPress is one of the most popular CMS in the world, and we can change the website style by choosing different theme. Furthermore, we can make some change based on wordpress theme and get a personalized website layout. Today I’ll guide you through the process of creating a unique WordPress Layout. Just a few change of code will make your wordpress website more appealing.

This custome wordpress layout effect: The first post appear in full content, and the following posts are output in excerpt. This wordpress layout is especially appropriate for short post webiste, and the effect of advertisement is pretty good. custom-wordpress-layout-for-short-post-site
1. Open your index.php or home.php, find the following code:

  1. <?php if (have_posts()) : while (have_posts()) : the_post(); ?>  

2. Add the following line before the previous code:

  1. <?php $postcnt = 1; ?>  

3. Find the following code

  1. <?php the_content(); ?>  

Change it to

  1. <?php if ($postcnt == 1) : ?>   
  2. <?php the_content(); ?>   
  3. // A great advertisement position   
  4. <?php else : ?>   
  5. <?php the_excerpt(); ?>   
  6. <?php endif$postcnt++; ?>  

Upload the modified file to you website and it is done. Using this method, you can customzie your category list page or search result page. Just change the corresponding codes in category.php or search.php files, you can get a unique wordpress layout.

Leave a Reply

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