Advertisement
alaminlink

WP Theme Development (Single Post & Archive Page)

Sep 10th, 2014
403
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.30 KB | None | 0 0
  1. single.php
  2.  
  3. <?php if(have_posts()) : ?><?php while(have_posts())  : the_post(); ?>
  4.  
  5. <?php the_title(); ?>
  6.  
  7.     <?php the_content(); ?>
  8.  
  9.    <?php comments_template( '', true ); ?>  
  10.  
  11. <?php endwhile; ?>
  12.  
  13. <?php else : ?>
  14.  
  15. <?php _e('404 Error: Not Found'); ?>
  16.  
  17. <?php endif; ?>
  18.  
  19. archive.php
  20.  
  21. for Archive & Archive Post List
  22.  
  23.     <?php if (have_posts()) : ?>
  24.  
  25.         <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
  26.  
  27.             <?php /* If this is a category archive */ if (is_category()) { ?>
  28.  
  29.                 <?php _e('Archive for the'); ?> '<?php echo single_cat_title(); ?>' <?php _e('Category'); ?>                                    
  30.  
  31.             <?php /* If this is a tag archive */  } elseif( is_tag() ) { ?>
  32.  
  33.                 <?php _e('Archive for the'); ?> <?php single_tag_title(); ?> Tag
  34.  
  35.             <?php /* If this is a daily archive */ } elseif (is_day()) { ?>
  36.  
  37.                 <?php _e('Archive for'); ?> <?php the_time('F jS, Y'); ?>    
  38.  
  39.             <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
  40.  
  41.                 <?php _e('Archive for'); ?> <?php the_time('F, Y'); ?>          
  42.  
  43.             <?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
  44.  
  45.                 <?php _e('Archive for'); ?> <?php the_time('Y'); ?>          
  46.  
  47.             <?php /* If this is a search */ } elseif (is_search()) { ?>
  48.  
  49.                 <?php _e('Search Results'); ?>                            
  50.  
  51.             <?php /* If this is an author archive */ } elseif (is_author()) { ?>
  52.  
  53.                 <?php _e('Author Archive'); ?>                                
  54.  
  55.             <?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
  56.  
  57.                 <?php _e('Blog Archives'); ?>                        
  58.  
  59.     <?php } ?>
  60.  
  61. For archive post query
  62.  
  63. <?php get_template_part( 'post-excerpt' ); // Post Excerpt (post-excerpt.php) ?>
  64.  
  65. If no post in archive or 404
  66.  
  67. <?php else : ?>
  68.  
  69. <?php _e('404 Error: Not Found'); ?>
  70.  
  71. <?php endif; ?>
  72.  
  73. 404.php
  74.  
  75. 404 Error: Not Found
  76.  
  77. Sorry, but the page you are trying to reach is unavailable or does not exist.
  78.  
  79. টিউটোরিয়াল লিংক: http://rrfoundation.net/337
  80.  
  81. সোর্স ফাইল ডাউনলোড: http://sdrv.ms/T4THqZ
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement