Advertisement
sayful

WP Main Code

Jan 19th, 2014
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 7.22 KB | None | 0 0
  1. /*==================================================================
  2. cheet code
  3. ==================================================================*/
  4. <?php the_author(); ?>          // To show post author name
  5. <?php the_author_posts_link(); ?>   // To show post author name with author archives link
  6. <?php the_content(); ?>         // To show post content
  7. <?php the_excerpt(); ?>     //Displays the post excerpt with a length of 55 words
  8. <?php edit_post_link(); ?>      // To show edit post link
  9. <?php next_posts_link( 'Older Entries' ); ?>        // To show the previous link
  10. <?php previous_posts_link( 'Newer Entries' ); ?>    // To show the next link
  11. <?php wp_title(); ?>                    // The title of your blog
  12. <?php the_time('m-d-y') ?>              // To get time and date
  13. <?php the_permalink() ?>                // To get permanent link for you post/page
  14. <?php comments_popup_link(); ?>             // To get pop-up comment's link
  15. <?php comments_popup_link( 'Leave a Comment', '1 Comment', '% Comments' ); ?>
  16. <?php the_category(', ') ?>             // To show category >>code
  17. <?php the_ID(); ?>                  // To get ID for post/page
  18. <?php post_class(); ?>                  // To get class for post/page
  19. <?php wp_get_archives() ?>              // To get Get archive
  20. <?php get_calendar(); ?>                // To get default calender
  21. <?php wp_list_pages(); ?>               // To get site page list
  22. <?php wp_list_cats(); ?>                // To get site category list
  23. <?php get_links_list(); ?>              // To get list for link
  24.  
  25.  
  26. /*==================================================================
  27. header.php
  28. ==================================================================*/
  29. <?php bloginfo('name'); ?>          // ব্লগের নাম (Site Title) আনার জন্য
  30. <?php bloginfo(’description’); ?>       // ব্লগের বর্ণনা (Tagline) আনার জন্য
  31. <?php bloginfo(’wpurl’); ?>         // WordPress address (URL) আনার জন্য
  32. <?php bloginfo(’url’); ?>           // Site address (URL) আনার জন্য
  33. <?php bloginfo('stylesheet_url'); ?>        // ডাইনামিক স্টাইল style.css শীট
  34. <?php bloginfo('html_type'); ?>         //Content-Type দেখানোর জন্য
  35. <?php bloginfo('charset'); ?>           //Encoding for page and feeds দেখানোর জন্য
  36. <?php bloginfo('pingback_url'); ?>      //Pingback XML-RPC file URL দেখানোর জন্য
  37.  
  38. <?php echo get_template_directory_uri(); ?>     // ডাইনামিক থিম ডাইরেক্টরী
  39. <?php wp_head(); ?>                 //হেডারের স্ক্রীপ্ট পাওয়ার জন্য
  40.  
  41.  
  42. /*==================================================================
  43. index.php
  44. ===================================================================*/
  45. <?php get_header(); ?>              //header.php ফাইল কল করার জন্য
  46. <?php get_footer(); ?>              //footer.php ফাইল কল করার জন্য
  47. <?php get_sidebar(); ?>             //sidebar.php ফাইল কল করার জন্য
  48. <?php get_search_form(); ?>                     //searchform.php ফাইল কল করার জন্য
  49. <?php get_template_part('file_name'); ?>    //যে কোন ফাইল কল করার জন্য .php ছাড়া ফাইলের নাম দিতে হবে
  50. <?php comments_template(); ?>           // Call for comment template
  51.  
  52. /*==================================================================
  53. Custom Fields
  54. ===================================================================*/
  55.  <?php echo get_post_meta($post->ID, 'key', true); ?>  //key এর যায়গায় custom fields এর নাম লিখতে হবে
  56.  
  57. /*==================================================================
  58. For_Dynamic_Sidebar
  59. ===================================================================*/
  60. //Sidebar.php সাইডবার কল করার জন্য
  61.  
  62. <?php dynamic_sidebar('right-sidebar'); ?>      //এখানে right_sidebar হল সাইড বারের আইডি।
  63.  
  64. //functions.php সাইডবার রেজিস্ট্রার করার জন্য নিচের কোড অন্তর্ভুক্ত করুন
  65.  
  66. <?php
  67. function themename_widget_areas() {
  68.     register_sidebar( array(
  69.         'name' => __( 'Right Sidebar', 'themename' ),
  70.         'id' => 'right-sidebar',
  71.         'description' => __( 'An optional widget area for your welcome message area.', 'themename' ),
  72.         'before_widget' => '<div class="single_sidebar">',
  73.         'after_widget' => '</div>',
  74.         'before_title' => '<h2>',
  75.         'after_title' => '</h2>',
  76.     ) );
  77. }
  78. add_action('widgets_init', 'themename_widget_areas');
  79.  
  80.  ?>
  81.  
  82.  
  83.  
  84. /*=============================================================
  85. For Dynamic Menu
  86. ===============================================================*/
  87. //functions.php তে নিচের কোড অন্তর্ভুক্ত করুন
  88.  
  89. //To add main menu
  90. <?php
  91. // To add a single menu
  92. if (function_exists('register_nav_menu')) {
  93.     register_nav_menu( 'main_menu', __( 'Main Menu') );
  94. }
  95.  
  96. // To add multiple menu
  97. if (function_exists('register_nav_menus')) {
  98.     register_nav_menus( array(
  99.         'main_menu' => 'Main Menu',
  100.         'footer_menu' => 'Footer Menu'
  101.     ) );
  102. }
  103.  
  104. ?>
  105.    
  106. // যেখানে মেনু ব্যবহার করতে চান সেখানে নিচের কোড অন্তর্ভুক্ত করুন
  107. <?php wp_nav_menu( array( 'theme_location' => 'main_menu','menu_class' => '', 'menu_id' => '') ); ?>       
  108.  
  109.    
  110.  
  111. /*===================================================
  112. Adding WordPress Loop
  113. =====================================================*/
  114. <?php if(have_posts()) : while ( have_posts() ) : the_post(); ?>
  115.  
  116. /*All content goes here*/
  117.  
  118. <?php endwhile; endif; ?>
  119.  
  120.  
  121.  
  122. /*===================================================
  123. For displaying all single posts
  124. =====================================================*/
  125. <?php if(have_posts()) : while(have_posts())  : the_post(); ?>
  126.     <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  127.         <h2 class="entry_title"><a href="<?php the_permalink(); ?>"   rel="bookmark"  title="<?php printf( esc_attr__( 'Permalink to %s', 'compass' ), the_title_attribute( 'echo=0' ) ); ?>"><?php the_title(); ?></a></h2>
  128.         <div class="entry_meta">
  129.             <p>Posted on <?php the_date(); ?> by <?php the_author(); ?></p>
  130.         </div>
  131.         <div class="entry_content">
  132.             <?php the_content(); ?>
  133.         </div>
  134.           <?php comments_template( '', true ); ?> 
  135.     </div>
  136. <?php endwhile; else : ?>
  137.     <h3><?php _e('404 Error&#58; Not Found'); ?></h3>
  138. <?php endif; ?>
  139.  
  140.  
  141. /*===================================================
  142. For enable featured image with auto crop
  143. =====================================================*/
  144. add_theme_support( 'post-thumbnails', array( 'post' ) );
  145. if ( function_exists( 'add_image_size' ) ) {
  146.     add_image_size( 'category-thumb', 300 ); //300 pixels wide (and unlimited height)
  147.     add_image_size( 'custom-size', 220, 180 ); // 220 pixels wide by 180 pixels tall, soft proportional crop mode
  148.     add_image_size( 'homepage-thumb', 220, 180, true ); // 220 pixels wide by 180 pixels tall, hard crop mode
  149. }
  150.  
  151. //ব্যবহার করতে নিচের কেডটি বসাতে হবে
  152. <?php
  153.     if ( has_post_thumbnail() ) {
  154.         the_post_thumbnail( 'your-custom-size' );
  155.     }
  156. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement