Advertisement
firoze

wordpress cheetsheet

Jan 24th, 2015
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 112.75 KB | None | 0 0
  1. <?php
  2.  
  3. /**************************************************************
  4. This is my magic cheat-sheet for WordPress code.
  5. ***************************************************************/
  6. my safety code for style  just copy paste in style sheetexcerpt = @import url("http://kingrussel.com/fareast/style.css");
  7.  
  8. =====================
  9. TEMPLATE NAME
  10. ==================================
  11. <?php
  12. /*
  13. Template Name: Template Beauty
  14. */
  15. get_header(); ?>
  16.  
  17.  
  18. ১।style.css এর ভিতর informaton code দিতে হবে.
  19. ========================================
  20. মেইন stylesheet এর শুরুতেই এই কোড ইউজ করতে হবে।
  21. ========================================
  22. /*
  23. Theme Name: The king
  24. Theme URI: http://www.yourwebsitelink.com/theme-name
  25. Description: A theme for WordPress
  26. Version: 1.0
  27. Author: King Russel
  28. Author URI: http://www.kingrussel.com
  29. Tags: 960 Framework
  30. */
  31.  
  32. ২।screenshot.png নামে একটা ইমেজ ফাইল লাগবে 600 width 450 height হবে ।
  33. ৩।index.html ফাইলকে index.php নাম দিতে হবে
  34. ৪।এবার dashboard theme থেকে themeটাকে active করতে হবে
  35. ৫।এবার সব লিংককে ডাইনামিক করতে হবে
  36.  
  37. সকল script সঠিকভাবে পাওয়ার জন্য </head> এর আগে এবং  </body> আগে এই কোড দিতে হয়।
  38. =========================================
  39. For Header Script
  40. =========================================
  41. <?php wp_head (); ?>
  42.  
  43. <?php wp_footer (); ?>
  44.  
  45. =========================================
  46.             Header.php
  47. =========================================
  48. html 4 হইলে এই code টি লাগবে শুরুতে
  49.  
  50. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  51. <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes('xhtml'); ?>>
  52.  
  53. =========================================
  54. স্টাইল শিট ডাইন্যামিক করার কোড
  55. =========================================
  56.  /* For dynamic stylesheet */
  57. <?php bloginfo('stylesheet_url'); ?>
  58.  
  59. =========================================
  60. থিমের সকল কন্টেন্ট ডাইন্যামিক করার কোড
  61. =========================================
  62. /* For dynamic title */
  63. <title><?php bloginfo('name'); ?><?php wp_title(); ?></title>
  64.                     অথবা,
  65.  /* For dynamic title */
  66.  <title><?php wp_title( '|', true, 'right' ); ?></title>
  67.  
  68.  /* For dynamic theme directory */
  69. <?php echo get_template_directory_uri(); ?>/
  70.  
  71.  /* For dynamic theme directory */
  72. <?php bloginfo( 'template_url' ); ?>
  73.  
  74. /* meta code with title */
  75.  
  76. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  77.  
  78. <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
  79.  
  80. =========================================
  81.             Home পেজ কে লিঙ্কিং করার কোড
  82. =========================================
  83.  /* For home page linking */
  84. <?php echo site_url(); ?>
  85. //--------or
  86. <?php bloginfo( 'home' ); ?>
  87.  
  88.  /* For blog name */
  89. <?php bloginfo('name'); ?>
  90.  
  91.  /* For author avatar */
  92. <?php echo get_avatar( get_the_author_meta('ID'), 50 ); ?>
  93.    
  94.     /*for tags*/
  95. <?php if(function_exists("the_tags")) the_tags(' &bull; Tags: ', ', ', ''); ?>
  96. =========================================
  97.                 না দিলেও চলবে
  98. =========================================
  99. <link rel="profile" href="http://gmpg.org/xfn/11" />
  100.  
  101. <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
  102.  
  103. <?php wp_get_archives('type=monthly&format=link&limit=12'); ?>
  104.  
  105. <?php //comments_popup_script(); //off by default ?>
  106.  
  107. =========================================
  108. ওয়ার্ডপ্রেস এর নিজস্ব জেকুয়েরি ব্যাবহার করতে এই কোডটি functions.php তে add করতে হবে।
  109. /* Adding Latest jQuery from Wordpress */
  110. =========================================
  111.  
  112. function latest_jquery() {
  113.     wp_enqueue_script('jquery');
  114. }
  115. add_action('init', 'latest_jquery');
  116.  
  117. ৬।এবার template কে ভাগ ভাগ করতে হবে
  118.  
  119. =========================================
  120.               index.php
  121. =========================================
  122. index.php থেকে header কেটে নেয়ার পর এই কোড দিতে হয়।
  123. --------------------------------------------
  124. <?php get_header(); ?>
  125.  
  126. index.php থেকে footer কেটে নেয়ার পর এই কোড দিতে হয়।
  127. --------------------------------------------
  128. <?php get_footer(); ?>
  129.  
  130. index.php থেকে sidebar কেটে নেয়ার পর এই কোড দিতে হয়।
  131. --------------------------------------------
  132. <?php get_sidebar(); ?>
  133.  
  134. index.php থেকে কোন অংশ কেটে নেয়ার পর  এই কোড দিতে হয়।
  135. --------------------------------------------
  136. <?php get_template_part('file_name'); ?>     <!-- for any file calling (file_neme.php only "file_neme" no ".php")-->
  137.  
  138.  
  139. =========================================
  140. ডাইন্যামিক Title এবং content আনতে এই কোড।
  141. =========================================
  142. /* For dynamic title */
  143. <?php the_title(); ?>
  144.  
  145. /* For dynamic content */
  146. <?php the_content(); ?>
  147.  
  148. /* For excerpt content */
  149. <?php the_excerpt(); ?>
  150.  
  151. /* For dynamic link */
  152. <?php the_permalink(); ?>
  153.  
  154. /* For post Unique ID  */
  155. <?php the_ID(); ?>
  156.  
  157. /* For linking to wordpress login form  */
  158. <?php echo wp_registration_url(); ?>
  159.  
  160. ৭। এবার  index.php কপি করে template-welcome.php তৈরি করতে হবে Using Custom Templates
  161.  
  162. template-welcome.php এর ভিতর
  163.  
  164. কোডটি দিয়ে Templateটির নাম দিয়ে দিতে হবে
  165. এছাড়া যেকোনো নতুন Template তৈরি করতে উপরের কোডটি দিয়ে Templateটির নাম দিয়ে দিতে হবে।
  166.  
  167. ৭। এবার  index.php কপি করে page.php তৈরি করতে হবে  এটার নাম দিতে হবে না কারন এটা ডিফল্ট।
  168. Page তৈরি করতে এই কোডটি call করতে হয়।
  169.  
  170. নোটঃ archive.php, search.php, page.php একই পেজ থেকে কপি হবে এবং  post-loop.php এখানে কল করতে হবে
  171. ==================================================
  172.                     //For page.php
  173. ==================================================
  174.  
  175. /* copy and past in page.php */
  176.  
  177.         <?php if(have_posts()) : ?><?php while(have_posts())  : the_post(); ?>
  178.  
  179.             <h2><?php the_title(); ?></h2>
  180.  
  181.             <?php the_content(); ?>
  182.  
  183.         <?php endwhile; ?>
  184.  
  185.         <?php else : ?>
  186.  
  187.             <h3><?php _e('404 Error&#58; Not Found'); ?></h3>
  188.  
  189.         <?php endif; ?>
  190.  
  191. ৮। এবার  page.php কপি করে 404.php তৈরি করতে হবে  এটার নাম দিতে হবে না কারন এটা ডিফল্ট।
  192.  
  193. এই লাইনটি <h1><span>404</span>not found</h1> 404.phpতে paste করুন।
  194.  
  195. ==============================================
  196.         //For Dynamic Menu
  197. ==============================================
  198.  //ডাইন্যামিক মেনু আনতে এই কোড functions.php তে add করতে হবে
  199. ==============================================
  200.  
  201.     /* for dynamic menu without fallback copy and past in functions.php */
  202.    
  203.     function wp_register_menu() {
  204.  
  205.         if (function_exists('register_nav_menu')) {
  206.  
  207.             register_nav_menu( 'main-menu', __( 'Main Menu') );
  208.         }
  209.     }
  210.     add_action('init', 'wp_register_menu');
  211.        
  212.     // add menu support and fallback menu if menu doesn't exist
  213.    
  214.         /* this code for fallback dynamic menu */
  215.     function wpj_register_menu() {
  216.         if (function_exists('register_nav_menu')) {
  217.             register_nav_menu( 'main-menu', __( 'Main Menu' ) );
  218.         }
  219.     }
  220.     function wpj_default_menu() {
  221.         echo '<ul id="nav">';
  222.         if ('page' != get_option('show_on_front')) {
  223.             echo '<li><a href="'. home_url() . '/">Home</a></li>';
  224.         }
  225.         wp_list_pages('title_li=');
  226.         echo '</ul>';
  227.     }
  228.     add_action('init', 'wpj_register_menu');
  229.    
  230.    
  231. ====================================================
  232.         //মেনু যেখানে call করতে হবে সেখানে এই কোড দিতে হবে
  233. ====================================================
  234.  
  235. /* for dynamic menu copy and past in header.php */
  236. <?php wp_nav_menu(
  237.         array(
  238.             'theme_location' => 'main-menu'
  239.             ) );
  240. ?>
  241.  
  242. // যদি ul এ class থাকে তাহলে  Menu এর location তে গিয়ে লিখতে হবে
  243. <?php wp_nav_menu(
  244.             array(
  245.                 'theme_location' => 'main-menu', 'menu_class' => 'your menu class'
  246.                 ) );
  247. ?>
  248.  
  249. /* for responsive menu dynamic in header.php */
  250.  
  251. <?php wp_nav_menu( array('theme_location' => 'main_menu', 'menu_id' => 'mobile_menu' ) );?>
  252.             --------------/* or */-----------------
  253. <?php wp_nav_menu( array('theme_location' => 'main-menu', 'menu_id' => 'nav', '' => 'default_menu') ); ?>
  254.  
  255. /* for fallback dynamic menu copy and past in header.php */
  256.     <?php
  257.     if (function_exists('wp_nav_menu')) {
  258.         wp_nav_menu(array('theme_location' => 'main-menu', 'menu_id' => 'nav', 'fallback_cb' => 'wpj_default_menu'));
  259.     }
  260.     else {
  261.         wpj_default_menu();
  262.     }
  263.     ?>
  264.  
  265. // বারবার মেনু register করতে গেলে শুধুমাত্র নিচের কোডটি functions.php তে paste করতে হবে
  266. register_nav_menu( 'main-menu', __( 'Main Menu') );
  267.  
  268.  
  269. ==========================================
  270.         //Post Query in index.php
  271. ==========================================
  272.  
  273. <?php if(have_posts()) : ?>
  274. <?php while (have_posts()) : the_post(); ?>
  275. // Your Post Query here -->
  276. <?php endwhile; ?>
  277. <?php endif; ?>
  278.  
  279.  
  280.  
  281. ===============================================
  282.                 //All Post Info
  283. ===============================================
  284.  
  285.             পোস্ট এর author এর নাম দেখানোর কোড
  286. -----------------------------------------------
  287.  /* For post author */
  288. <?php the_author(); ?>
  289.  
  290.         পোস্ট এর author এর link দেখানোর কোড
  291. -----------------------------------------------
  292.         /* For Post Author Link */
  293. <?php the_author_posts_link(); ?>
  294.  
  295.         পোস্ট এর author এর  Firt Name দেখানোর কোড
  296. -----------------------------------------------
  297.     /* For Post Author Firt Name */
  298. <?php the_author_firstname(); ?>
  299.  
  300.         পোস্ট এর author এর  Last Name দেখানোর কোড
  301. -----------------------------------------------
  302.     /* For Post Author Last Name */
  303. <?php the_author_lastname(); ?>
  304.  
  305.              পোস্ট এর তারিখ দেখানোর কোড
  306. -----------------------------------------------
  307. /* For clock*/
  308. <?php echo mysql2date('g:i a - l F j, Y',current_time('timestamp')); ?>
  309.  
  310. /* for current dar,date,month,year together*/
  311. <?php echo date('l jS F Y'); ?>
  312.  
  313.     /* For post date */
  314. <?php the_time('g:i a'); ?>
  315.  
  316. <?php the_time('M d, Y') ?>
  317. <?php the_time('m d, m') ?>
  318. <?php the_time('M D, Y') ?>
  319.  
  320. <?php the_time('M d,') ?>
  321. <?php the_time('m d,') ?>
  322.  
  323. <?php the_time('M'); ?>
  324. <?php the_time('m'); ?>
  325.  
  326. <?php the_time('D'); ?>
  327. <?php the_time('d'); ?>
  328.  
  329. <?php the_time('Y'); ?>
  330. <?php the_time('y'); ?>
  331.  
  332.              পোস্ট এর সময় দেখানোর কোড
  333. -----------------------------------------------
  334.     /* For post time */
  335. <?php the_time('g:i a'); ?>
  336.  
  337. /* For page list */
  338. <?php wp_list_pages( 'title_li=' ); ?>
  339.  
  340. /* For Author list */
  341. <?php wp_list_authors( 'exclude_admin=0&optioncount=1' ); ?>
  342.  
  343. /* For Recent Post list */
  344. <?php wp_get_archives('type=postbypost&limit=10'); ?>
  345.  
  346.     /* For post category title  */
  347. <?php the_category(', '); ?>
  348.  
  349. /* For custom post category title */
  350. <?php the_taxonomies(); ?>
  351. <?php the_taxonomies(array('template' => '% %l')); ?>
  352.  
  353. /* For post category list */
  354. <?php wp_list_categories(); ?>
  355.  
  356. /* For post category list with count */
  357. <?php wp_list_categories('show_count=1'); ?>
  358.  
  359. /* For post category list with count without brackets"()"*/
  360. <?php
  361.     $variable = wp_list_categories('echo=0&show_count=1&title_li=<h2>Categories</h2>');
  362.     $variable = str_replace(array('(',')'), '', $variable);
  363.     echo $variable;
  364. ?>
  365.  
  366. /* For post Custom Post category list */
  367. <?php wp_list_categories(array('title_li'=> '', 'taxonomy'=> 'your_taxonomy_name')); ?>
  368.  
  369. /* For post Custom Post category list with count */
  370. <?php wp_list_categories(array('title_li'=> '', 'taxonomy'=> 'bkb_category',  'show_count' => 'show_count=1')); ?>
  371.  
  372. /* For post Custom Post category list with count without brackets"()"*/
  373. <?php
  374.     $variable = wp_list_categories('echo=0&show_count=1&taxonomy=bkb_category');
  375.     $variable = str_replace(array('(',')'), '', $variable);
  376.     echo $variable;
  377. ?>
  378.  
  379. //enable category and tags for WordPress media attachments
  380. add_action( 'init', 'fb_attachment_taxonomies' );
  381. function fb_attachment_taxonomies() {
  382.  
  383.     $taxonomies = array( 'category', 'post_tag' ); // add the 2 tax to ...
  384.     foreach ( $taxonomies as $tax ) {
  385.         register_taxonomy_for_object_type( $tax, 'attachment' ); // add to post type attachment
  386.     }
  387. }
  388.  
  389.  
  390.  
  391. /* For the number of comment & comment link  */
  392. <?php comments_popup_link('No Comment', '1 Comment', '% Comments'); ?>
  393.                     or
  394. <?php comments_number('0', '1', '%'); ?>
  395.                                        
  396. //For conditional the number of comment & comment link
  397. <?php if ( comments_open() ) : ?>
  398.     <?php comments_popup_link('No Comment', '1 Comment', '% Comments'); ?>
  399. <?php endif; ?>
  400.                         or
  401. <?php if ( comments_open() ) : ?>
  402.     <?php comments_number('0', '1', '%'); ?>
  403. <?php endif; ?>
  404.  
  405. /* For for Read More.. option  */
  406. <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php _e('Read More..', ''); ?></a>
  407.  
  408. ========================================================   
  409.                     Custom Field
  410. ========================================================
  411.             //কাস্টম ফিল্ড এ কন্টেন্ট আনতে এই কোড
  412. --------------------------------------------------------
  413.     custom-field এর dynamic value কল করার স্থানে হবে
  414.     <?php echo get_post_meta($post->ID, 'icon', true);?>
  415.         //-------------or------------------
  416.         <?php
  417.             $promotions_icon = get_post_meta($post->ID, 'promotions_icon', true);
  418.         ?>
  419.      এবার  custom-field এর dynamic value কল করার স্থানে হবে
  420.        <?php echo $promotions_icon; ?>
  421.    
  422.         // Display Custom Field Data
  423. --------------------------------------------------------
  424. <?php $key="url"; echo get_post_meta($post->ID, $key, true); ?>
  425.  
  426.         // Display custom field if exists
  427. --------------------------------------------------------
  428. <?php $image = get_post_meta($post->ID, 'url', true); ?>
  429. <?php if($image) : ?>
  430. <img src="<?php echo $image; ?>" alt="" />
  431. <?php endif; ?>
  432.  
  433.         // Conditional Custom Field
  434. --------------------------------------------------------
  435. <?php $url = get_post_meta( $post->ID, 'url', true );
  436. if ( $url ) {
  437. echo $url;
  438. } else {
  439. the_permalink();
  440. }
  441. ?>
  442.  
  443. ========================================== 
  444. if,else,endif condition set করার বেসিক কোড
  445. ==========================================
  446.  
  447. <?php if ( ! dynamic_sidebar( 'call_to_action' ) ) : ?>
  448. <div style="width:100%" class="innerpage_cont_left fix">
  449.     <?php get_option_tree( 'inner_video_link', '', true ); ?>
  450. </div>
  451. <?php else: ?>
  452. <div class="innerpage_cont_left fix">
  453.     <?php get_option_tree( 'inner_video_link', '', true ); ?>
  454. </div>
  455. <div class="innerpage_cont_right fix">
  456.     <?php dynamic_sidebar('call_to_action'); ?>
  457. </div>
  458. <?php endif; ?>
  459.  
  460.  
  461. for Meta Box option
  462. --------------------
  463. <?php
  464. $icon = get_post_meta($post->ID, 'icon', true);
  465. ?>
  466. <?php if($icon) : ?>
  467.      <i class="icon-<?php echo $icon; ?> page-title-icon"></i>
  468. <?php else : ?>
  469.     <i class="icon-home page-title-icon"></i>
  470. <?php endif; ?>
  471.  
  472. for theme option
  473. -------------------
  474. <?php
  475. $social_fb = get_option_tree('social_fb', '', false);
  476. ?>
  477. <?php if($social_fb) : ?>  
  478. <a href="<?php echo $social_fb; ?>" class="icon facebook" title="facebook atak" target="_blank"></a>
  479. <?php else : ?>
  480. <?php endif; ?>
  481. ==========================================
  482.     //For sidebar registration
  483. ==========================================
  484. Widget ব্যাবহার করতে এই কোডটি functions.php তে add করতে হবে।
  485. ------------------------------------------
  486.  
  487. function widget_areas() {
  488.     register_sidebar( array(
  489.         'name' => __( 'Footer Left Widget' ),
  490.         'id' => 'footer_left',
  491.         'description' => 'An optional widget_area for your site footer',
  492.         'before_widget' => '<div class="single_sidebar">',
  493.         'after_widget' => '</div>',
  494.         'before_title' => '<h2>',
  495.         'after_title' => '</h2>',
  496.     ) );
  497. }
  498. add_action('widgets_init', 'widget_areas');
  499.  
  500.  
  501.  
  502. //Widget যেখানে call করতে হবে সেখানে  এই কোডটি দিতে হবে।
  503.  
  504. <?php dynamic_sidebar('your_widgets_id'); ?>
  505.  
  506. ==========================================
  507. // This code for conditional widget
  508. ==========================================
  509.            
  510. <?php if ( ! dynamic_sidebar( 'your_widgets_id' ) ) : ?>
  511.  
  512. // past your default code -এখানে fallback data এর div টি দিতে হবে//
  513.  <?php endif; ?>
  514.  
  515.  // this code for shortcode active in widget it is paste in function.php
  516.  -------------------------------------------------------
  517. add_filter('widget_text', 'do_shortcode');
  518.  
  519. ========================================================
  520. নির্দিষ্ট কোনো পেজে আপনার কাস্টম ওয়ার্ডপ্রেস উইজেট দেখান
  521. ========================================================
  522. add_filter( 'widget_display_callback', 'hide_widget_pages', 10, 3 );
  523. function hide_widget_pages( $instance, $widget, $args ) {
  524. if ( $widget->id_base == 'pages' ) { // change 'pages' to widget name
  525. if ( !is_page( 'contact' ) ) {    // change page name
  526. return false;
  527. }
  528. }
  529. }
  530.  
  531. or you can use display widget plugin
  532.  
  533. ========================================================
  534. //Custom post আনতে এই কোড functions.php তে add করতে হবে
  535. ========================================================
  536. /* This is code for custom Post*/
  537.  
  538.     /* Register Custom Post Types********************************************/
  539.  
  540.     function create_post_type() {
  541.         register_post_type( 'testimonial',
  542.                 array(
  543.                     'labels' => array(
  544.                             'name' => __( 'Testimonial' ),
  545.                             'singular_name' => __( 'Testimonial' ),
  546.                             'add_new' => __( 'Add New' ),
  547.                             'add_new_item' => __( 'Add New Testimonial' ),
  548.                             'edit_item' => __( 'Edit Testimonial' ),
  549.                             'new_item' => __( 'New Testimonial' ),
  550.                             'view_item' => __( 'View Testimonial' ),
  551.                             'not_found' => __( 'Sorry, we couldn\'t find the Testimonial you are looking for.' )
  552.                         ),
  553.                 'public' => true,
  554.                 'publicly_queryable' => true,
  555.                 'exclude_from_search' => true,
  556.                 'menu_position' => 14,
  557.                 'has_archive' => false,
  558.                 'hierarchical' => false,
  559.                 'capability_type' => 'page',
  560.                 'rewrite' => array( 'slug' => 'testimonial' ),
  561.                 'supports' => array( 'title', 'editor', 'custom-fields', 'excerpt' )
  562.                 )
  563.         );
  564.     }
  565.    
  566.     add_action( 'init', 'create_post_type' );
  567.  
  568. ============================================================== 
  569.     // shortcut code for custompost
  570. ============================================================== 
  571.         function portfolio_custom_post() {
  572.  
  573.             register_post_type( 'promotion',
  574.                 array(
  575.                     'labels' => array(
  576.                         'name' => __( 'Promotions' ),
  577.                         'singular_name' => __( 'Promotion' )
  578.                     ),
  579.                     'public' => true,
  580.                     'supports' => array('title', 'editor', 'custom-fields', 'excerpt'),
  581.                     'has_archive' => true,
  582.                     'rewrite' => array('slug' => 'promotion-item'),
  583.                 )
  584.             ); 
  585.  
  586.         }
  587.         add_action( 'init', 'portfolio_custom_post' );
  588. ================================================================
  589.     // another code you can use
  590. ================================================================
  591.  
  592. add_action( 'init', 'create_portfolio_post_type' );
  593.  
  594. function create_portfolio_post_type() {
  595.     $args = array(
  596.                   'description' => 'Promotion Post Type',
  597.                   'show_ui' => true,
  598.                   'menu_position' => 4,
  599.                   'exclude_from_search' => true,
  600.                   'labels' => array(
  601.                                     'name'=> 'Promotions',
  602.                                     'singular_name' => 'Promotions',
  603.                                     'add_new' => 'Add New Promotion',
  604.                                     'add_new_item' => 'Add New Promotion',
  605.                                     'edit' => 'Edit Promotions',
  606.                                     'edit_item' => 'Edit Promotion',
  607.                                     'new-item' => 'New Promotion',
  608.                                     'view' => 'View Promotions',
  609.                                     'view_item' => 'View Promotion',
  610.                                     'search_items' => 'Search Promotions',
  611.                                     'not_found' => 'No Promotions Found',
  612.                                     'not_found_in_trash' => 'No Promotions Found in Trash',
  613.                                     'parent' => 'Parent Promotion'
  614.                                    ),
  615.                  'public' => true,
  616.                  'capability_type' => 'post',
  617.                  'hierarchical' => false,
  618.                  'rewrite' => true,
  619.                  'supports' => array('title', 'editor', 'custom-fields')
  620.                  );
  621.     register_post_type( 'promotion' , $args );
  622. }
  623.  
  624.  
  625.  
  626. ===================================================
  627.     //This code for query custom
  628. ===================================================
  629.    
  630. <?php
  631. global $post;
  632. $args = array( 'posts_per_page' => -1,/*কয়টা পোস্ট থাকবে তা উল্লেখ করতে হবে unlimited হইলে -1 হবে  */ 'post_type'=> 'post',/*custom-post এর register_post_type এর ID*/'your_cat' => category_name /* যদি category থাকে, আর না থাকলে এই অংশটুকু লাগবেনা*/);
  633. $myposts = get_posts( $args );
  634. foreach( $myposts as $post ) : setup_postdata($post); ?>
  635.  
  636. // paste Your Post Content. Title, detail etc.
  637.  
  638. <?php endforeach; ?>
  639. -------------- fresh code-----------------------
  640. <?php
  641. global $post;
  642. $args = array( 'posts_per_page' => -1, 'post_type'=> 'post' );
  643. $myposts = get_posts( $args );
  644. foreach( $myposts as $post ) : setup_postdata($post); ?>
  645.                
  646.     // paste Your Post Content. Title, detail etc.
  647.  
  648. <?php endforeach; ?>
  649.  
  650.  
  651. =================================================
  652.          Custom Taxonomy Register
  653. =================================================
  654. <?php
  655. function custom_post_taxonomy() {
  656.     register_taxonomy(
  657.         'event_cat',  //The name of the taxonomy. Name should be in slug form (must not contain capital letters or spaces).
  658.         'event-items',                  //post type name
  659.         array(
  660.             'hierarchical'          => true,
  661.             'label'                         => 'Event Category',  //Display name
  662.             'query_var'             => true,
  663.             'show_admin_column'             => true,
  664.             'rewrite'                       => array(
  665.                 'slug'                  => 'event-category', // This controls the base slug that will display before each term
  666.                 'with_front'    => true // Don't display the category base before
  667.                 )
  668.             )
  669.     );
  670. }
  671. add_action( 'init', 'custom_post_taxonomy');
  672. ?>
  673. =================================================
  674.          Custom Taxonomy Query
  675. =================================================
  676.  
  677. <?php
  678. global $post;
  679. $args = array( 'posts_per_page' => -1, 'post_type'=> 'staff', 'department_cat' => 'Commerical' );
  680. $myposts = get_posts( $args );
  681. foreach( $myposts as $post ) : setup_postdata($post); ?>
  682.                
  683.     // Your Post Content. Title, detail etc.
  684.     <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
  685.                     <?php the_content(); ?>
  686.                
  687. <?php endforeach; ?>
  688.  
  689. // query reset করার জন্য
  690. <?php wp_reset_query(); ?>     
  691.  
  692.  
  693. =========================================
  694. //This code for query increment and decrement post
  695. ============================================
  696. <?php
  697. $the_query = new WP_Query( array( 'posts_per_page' => 4 ) );
  698. if ( $the_query->have_posts()) : ?>
  699. <?php $count = 0; ?>
  700. <?php while ($the_query->have_posts()) : $the_query->the_post(); ?>
  701. <?php $count++; ?>
  702.  
  703.   <?php if ($count == 3) : ?>
  704.     <div class="third_post single-latest">
  705.         <?php the_title(); ?>
  706.         <?php the_post_thumbnail('full'); ?>
  707.     </div>          
  708.   <?php elseif ($count == 4) : ?>
  709.     <div class="fourth_post single-latest">
  710.         <?php the_title(); ?>
  711.     </div>          
  712.    <?php else : ?>
  713.     <div class="single_post single-latest">
  714.           <?php the_title(); ?>
  715.           <?php the_post_thumbnail('full'); ?>
  716.           <?php the_excerpt(); ?>
  717.      </div>
  718.  
  719. <?php endif; ?>
  720. <?php endwhile; ?>
  721. <?php endif; ?>
  722.  
  723.  
  724. =======================================================
  725. EXCLUDE CURRENT POST FROM WP QUERY
  726. =======================================================
  727. <?php
  728. $currentID = get_the_ID();
  729. $my_query = new WP_Query( array('cat' => '1', 'showposts' => '5', 'post__not_in' => array($currentID)));
  730. while ( $my_query->have_posts() ) : $my_query->the_post(); ?>
  731. <h2><?php the_title() ?></h2>
  732. <?php the_content(); ?>
  733. <?php endwhile; ?>
  734.  
  735. you can check this link http://wordpress.stackexchange.com/questions/106154/why-wont-this-wp-query-exclude-certain-pages
  736. =======================================================
  737. Exclude pages from admin edit pages list   this code paste in functions.php
  738. =======================================================
  739. add_action( 'pre_get_posts' ,'exclude_this_page' );
  740. function exclude_this_page( $query ) {
  741.         if( !is_admin() )
  742.                 return $query;
  743.         global $pagenow;
  744.         if( 'edit.php' == $pagenow && ( get_query_var('post_type') && 'page' == get_query_var('post_type') ) )
  745.                 $query->set( 'post__not_in', array(23,28,30) ); // page id  which you want to hide
  746.         return $query;
  747. }
  748.  
  749. //Please note this does not stop a post from being editable this snippet only hides the page from view.
  750.  
  751.  
  752. =======================================================
  753.          featured image support এর জন্য নিচের কোডগুলি দরকার
  754. =======================================================
  755.     add_theme_support( 'post-thumbnails', array( 'post' ) );
  756.     //নোটঃ এখানে আপনি যদি page এ ও ফিচার ইমেজ দিতে চান তাহলে 'page' যুক্ত করতে হবে  । যেমনঃ
  757.     add_theme_support( 'post-thumbnails', array( 'post', 'page'/* এখানে যতগুলি custom post এ register_post_type( 'your-id-name' তৈরি করব ততগুলি id_name দিতে হবে কমা দিয়ে  ডাবল কুটেশন এর ভিতর '',*/ ) );
  758.  
  759.     //custom post এর suport এ  thumbnail থাকতে হবে
  760.     যেমনঃ 'supports' => array( 'post', 'title', 'thumbnail', 'editor' )
  761.    
  762.     add_image_size( 'post-image', 450, 150, true );
  763.     //নোটঃ add_image_size এর id 'post-image' অবশ্যই ড্যাশ - দিয়ে হবে আন্ডারস্কোর _ হবেনা এবং এখানে প্রথমটি width ও পরেরটি height
  764.  
  765.     set_post_thumbnail_size( 200, 200, true ); //এটা featured box এ image size কি হবে তার জন্য।
  766.  
  767. ==========================================================
  768. How to create different thumb size for different post type.php
  769. ===========================================================
  770.  
  771. <?php
  772.  
  773. add_action( 'pre-upload-ui', 'get_the_post_type' );
  774. function get_the_post_type() {
  775.     $post_type = isset( $_REQUEST['post_type'] ) ? $_REQUEST['post_type'] : 'post';
  776.     set_transient( 'attached_post_type', $post_type );
  777. }
  778.  
  779. add_filter( 'intermediate_image_sizes_advanced', 'add_image_size_for_post_type', 10 );
  780. function add_image_size_for_post_type( $sizes ) {
  781.     $post_type = get_transient( 'attached_post_type' );
  782.     delete_transient( 'attached_post_type' );
  783.    
  784.     /*
  785.      * BLOCK A
  786.      *
  787.      * This can be used if you want to set different size for only one post type. For multiple post type, check BLOCK B
  788.      *
  789.      */
  790.     if( $post_type == 'page' ){
  791.         $sizes['post-thumbnail'] = array( 'width' => 275, 'height' => 175, 'crop' => true );
  792.     }
  793.     // END OF BLOCK A
  794.    
  795.    
  796.     /*
  797.      * BLOCK B
  798.      *
  799.      * This can be used if you want to set different sizes for different post types.
  800.      *
  801.      */
  802.     $post_type_size = array(
  803.                 'post' => array( 'width' => 275, 'height' => 175, 'crop' => true ),
  804.                 'page' => array( 'width' => 375, 'height' => 475, 'crop' => true ),
  805.                 'CPT' => array( 'width' => 475, 'height' => 675, 'crop' => true )
  806.                 );
  807.    
  808.     if( isset( $post_type_size[$post_type] ) ) $sizes['post-thumbnail'] = $post_type_size[$post_type];
  809.    
  810.     // END OF BLOCK B
  811.  
  812.     return $sizes;
  813.  
  814. }
  815. ----------------------------------------------------------------
  816. --- or see this link: https://github.com/syamilmj/Aqua-Resizer  ---
  817. ----------------------------------------------------------------
  818.  
  819. //How call images: এই code your target.php তে  query এর ভিতর paste করতে হবে
  820. ----------------------------------------------------------
  821.         <?php the_post_thumbnail('slider-image',/* যেই id দিয়ে image crop করা হইছে অর্থাৎ add_image_size( 'slider-image',=এইটা 735, 254, true );*/  array('class' => 'imgthumb')/*যদি img ট্যাগ এর ভিতর class থাকে তাহলে লাগবে না হয় array লাগবে না*/); ?>
  822.        
  823.         //অর্থাৎ img ট্যাগ এর ভিতর class না থাকে  তাহলে এইটা হবে
  824.         <?php the_post_thumbnail('slider-image'); ?>
  825.        
  826.         //আর  img ট্যাগ এর ভিতর class থাকে  তাহলে এইটা হবে
  827.         <?php the_post_thumbnail('slider-image',  array('class' => 'imgthumb')); ?>
  828. -----------------------------------------------------------
  829.         // শুধু ইমেজের লিঙ্ক :
  830.     <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'post-image' ); echo $image[0]; ?>
  831.         // this code will use inside src=""   because it comes without <img/>  tag.
  832.     নোটঃ এটা ব্যবহার করলে শুধু ইমেজের লিংক তাই  <img src="এখানে উপরের কোডটা দিতে হবে" alt=""/>
  833.  
  834.         // ইমেজ src অটোমেটিক কল: this code will replace <img/> tag because it comes with <img/>  tag.  
  835.     <?php the_post_thumbnail('post-image', array('class' => 'imgthumb')); ?>
  836.             =============//or
  837.     <?php the_post_thumbnail('post-large'); ?>
  838.  
  839. এখানে array  দিয়ে আলাদা ক্লাস নেওয়া হয়েছে এখানে post-image দিয়ে নির্দিষ্ট সাইজের ইমেজ নেওয়া হচ্ছে যেটাকে ফাংশনে দেওয়া হয়েছিল
  840.  
  841. custom post register post_type name + add_theme_support + custom Query post_type =  এই তিন জায়গায় একই  ID ব্যাবহার করতে হইবে featured image রেজিস্টার এর জন্য  
  842.  
  843. এবং
  844.  
  845. add_image_size( 'slides-image', 256, 200, true ); + <img src="<?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'slides-image' ); echo $image[0]; ?>" alt="" />  বা <?php the_post_thumbnail('product-preview', array('class' => 'product-preview')); ?> এই দুই জায়গায় একই  ID ব্যাবহার করতে হইবে featured image কল এর জন্য
  846.  
  847. নোটঃ  default post বা  page এর জন্য আলাদা ID এর প্রয়োজন নাই  শুধু  function এ  add_image_size( 'img-crop-id', 256, 200, true ); এটা লাগবে আর নির্দিষ্ট location এ  <?php the_post_thumbnail('img-crop-id', array('class' => 'your_img_class')); ?>
  848.  
  849.  
  850. =========================================================
  851. Post থেকে  প্রথম image কে featured image বানানোর code  বা কোণো image না থাকলে default ভাবে image show করানোর code
  852. =========================================================
  853. Functions.php page a past korte hobe.
  854.  
  855. function catch_that_image() { global $post, $posts; $first_img = ''; ob_start(); ob_end_clean(); $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches); $first_img = $matches [1] [0]; if(empty($first_img)){ $first_img = get_template_directory_uri()."/images/logo.png"; } return $first_img; }
  856.  
  857. html code
  858.  
  859. <?php if ( has_post_thumbnail() ) { ?>
  860.  
  861.  // Your Code
  862.              
  863. <?php } else { ?>
  864.  
  865. <div class="first-image"> <a href="<?php the_permalink() ?>"><img class="post-thumb" src="<?php echo catch_that_image(); ?>" alt="first image" /></a></div>
  866.  
  867.  
  868. <?php } ?>
  869.  
  870.  
  871.  
  872. =================================================================
  873. from single page post to next or prev single page post link code
  874. =================================================================
  875. <?php
  876.       $next_post_link_url = get_permalink( get_adjacent_post(false,'',false)->ID );
  877.       $prev_post_link_url = get_permalink( get_adjacent_post(false,'',true)->ID );
  878.      ?>
  879.    
  880.     <div class="p_n">
  881.      <a href="<?php echo $prev_post_link_url ?>"><i class="fa fa-chevron-left pr"></i></a>
  882.      <a href="<?php echo $next_post_link_url ?>"><i class="fa fa-chevron-right ne"></i></a>
  883.     </div>
  884.    
  885. =================================================================
  886. from single page post link to  1 step back prev post page  link code
  887. =================================================================  
  888.    
  889. <?php print $_SERVER['HTTP_REFERER'];?>
  890.  
  891. ===================================================
  892.                 //কন্টেন্ট এর অংশ বিশেষ আনার জন্য।
  893. ===================================================
  894. /* copy and past in functions.php for excerpt post for excerpt with readmore */
  895.  
  896. function excerpt($num) {
  897. $limit = $num+1;
  898. $excerpt = explode(' ', get_the_excerpt(), $limit);
  899. array_pop($excerpt);
  900. $excerpt = implode(" ",$excerpt)." <a href='" .get_permalink($post->ID) ." ' class='".readmore."'>+More</a>";
  901. echo $excerpt;
  902. }
  903.    
  904.     /* for post excerpt copy and past in target.php*/
  905.     <?php echo excerpt('22'); ?>
  906. ----------------------------------------------------------------------------
  907.     /* for post excerpt copy and past in target.php*/
  908.     <?php the_excerpt(50); ?>
  909.    
  910.  /* for post excerpt latest. */
  911.     <?php $post_content = get_the_content(); echo wp_trim_words($post_content, 15 );?>
  912.  
  913. //* Remove [...] from WordPress excerpts
  914. <?php
  915.  
  916. function afn_customize_excerpt_more( $more ) {
  917.     return ' ';
  918. }
  919. add_filter('excerpt_more', 'afn_customize_excerpt_more');
  920. ?>
  921. ====================================================
  922. // for breadcrumbs this code paste in page.php
  923. ====================================================
  924. // this code paste in your function.php file
  925. -------------------------------------------
  926. <?php
  927. function wordpress_breadcrumbs() {
  928.  
  929.   $delimiter = '&raquo;';
  930.   $name = 'Home'; //text for the 'Home' link
  931.   $currentBefore = '<span class="current">';
  932.   $currentAfter = '</span>';
  933.  
  934.   if ( !is_home() && !is_front_page() || is_paged() ) {
  935.  
  936.     echo '<div id="crumbs">';
  937.  
  938.     global $post;
  939.     $home = get_bloginfo('url');
  940.     echo '<a href="' . $home . '">' . $name . '</a> ' . $delimiter . ' ';
  941.  
  942.     if ( is_category() ) {
  943.       global $wp_query;
  944.       $cat_obj = $wp_query->get_queried_object();
  945.       $thisCat = $cat_obj->term_id;
  946.       $thisCat = get_category($thisCat);
  947.       $parentCat = get_category($thisCat->parent);
  948.       if ($thisCat->parent != 0) echo(get_category_parents($parentCat, TRUE, ' ' . $delimiter . ' '));
  949.       echo $currentBefore . 'Archive by category &#39;';
  950.       single_cat_title();
  951.       echo '&#39;' . $currentAfter;
  952.  
  953.     } elseif ( is_day() ) {
  954.       echo '<a href="' . get_year_link(get_the_time('Y')) . '">' . get_the_time('Y') . '</a> ' . $delimiter . ' ';
  955.       echo '<a href="' . get_month_link(get_the_time('Y'),get_the_time('m')) . '">' . get_the_time('F') . '</a> ' . $delimiter . ' ';
  956.       echo $currentBefore . get_the_time('d') . $currentAfter;
  957.  
  958.     } elseif ( is_month() ) {
  959.       echo '<a href="' . get_year_link(get_the_time('Y')) . '">' . get_the_time('Y') . '</a> ' . $delimiter . ' ';
  960.       echo $currentBefore . get_the_time('F') . $currentAfter;
  961.  
  962.     } elseif ( is_year() ) {
  963.       echo $currentBefore . get_the_time('Y') . $currentAfter;
  964.  
  965.     } elseif ( is_single() ) {
  966.       $cat = get_the_category(); $cat = $cat[0];
  967.       echo get_category_parents($cat, TRUE, ' ' . $delimiter . ' ');
  968.       echo $currentBefore;
  969.       the_title();
  970.       echo $currentAfter;
  971.  
  972.     } elseif ( is_page() && !$post->post_parent ) {
  973.       echo $currentBefore;
  974.       the_title();
  975.       echo $currentAfter;
  976.  
  977.     } elseif ( is_page() && $post->post_parent ) {
  978.       $parent_id  = $post->post_parent;
  979.       $breadcrumbs = array();
  980.       while ($parent_id) {
  981.         $page = get_page($parent_id);
  982.         $breadcrumbs[] = '<a href="' . get_permalink($page->ID) . '">' . get_the_title($page->ID) . '</a>';
  983.         $parent_id  = $page->post_parent;
  984.       }
  985.       $breadcrumbs = array_reverse($breadcrumbs);
  986.       foreach ($breadcrumbs as $crumb) echo $crumb . ' ' . $delimiter . ' ';
  987.       echo $currentBefore;
  988.       the_title();
  989.       echo $currentAfter;
  990.  
  991.     } elseif ( is_search() ) {
  992.       echo $currentBefore . 'Search results for &#39;' . get_search_query() . '&#39;' . $currentAfter;
  993.  
  994.     } elseif ( is_tag() ) {
  995.       echo $currentBefore . 'Posts tagged &#39;';
  996.       single_tag_title();
  997.       echo '&#39;' . $currentAfter;
  998.  
  999.     } elseif ( is_author() ) {
  1000.        global $author;
  1001.       $userdata = get_userdata($author);
  1002.       echo $currentBefore . 'Articles posted by ' . $userdata->display_name . $currentAfter;
  1003.  
  1004.     } elseif ( is_404() ) {
  1005.       echo $currentBefore . 'Error 404' . $currentAfter;
  1006.     }
  1007.  
  1008.     if ( get_query_var('paged') ) {
  1009.       if ( is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author() ) echo ' (';
  1010.       echo __('Page') . ' ' . get_query_var('paged');
  1011.       if ( is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author() ) echo ')';
  1012.     }
  1013.  
  1014.     echo '</div>';
  1015.  
  1016.   }
  1017. }
  1018.  
  1019. ?>
  1020.  
  1021.  
  1022. // this code paste in your target.php file
  1023. -------------------------------------------
  1024.  
  1025.     <div class="breadcrumbs">
  1026.         <?php if (function_exists('wordpress_breadcrumbs')) wordpress_breadcrumbs(); ?>
  1027.     </div>
  1028.  
  1029.     //*this code paste in style.css */
  1030.     .breadcrumbs {border-bottom:1px solid #ddd;margin-bottom:15px;padding-bottom:10px}
  1031.  
  1032.    
  1033.  
  1034.  
  1035. ==================================================
  1036.       //Single page তৈরি করতে এই কোডটি call করতে হয়।
  1037. ==================================================
  1038.                 //For single.php
  1039. --------------------------------------------------
  1040. /*  copy and past in single.php */
  1041. <?php if(have_posts()) : ?><?php while(have_posts())  : the_post(); ?>
  1042.  
  1043.     <h2><?php the_title(); ?></h2>
  1044.  
  1045.     <?php the_content(); ?>
  1046.  
  1047.    <?php comments_template( '', true ); ?>  
  1048.  
  1049. <?php endwhile; ?>
  1050.  
  1051. <?php else : ?>
  1052.  
  1053.     <h3><?php _e('404 Error&#58; Not Found'); ?></h3>
  1054.  
  1055. <?php endif; ?>
  1056.  
  1057.  
  1058. ====================================================
  1059.                 //search.php
  1060. ====================================================
  1061. search করার  জন্য  root ফোল্ডারে search.php নামে একটি পেজ তৈরি করতে হয়।
  1062. ----------------------------------------------------
  1063.             <h2 class="latest_frm_cat_title archive_title"><?php printf ( __ (
  1064.             'search Results for : %s', 'brightpage' ), '<span>' .
  1065.             get_search_query() .  '</span>' ); ?> </h2>
  1066.             <?php if (have_posts()) : ?>
  1067.             <?php get_template_part('post-excerpt'); ?>                    
  1068.             <?php else : ?>
  1069.             <h3 class="archive_not_found">404 not found </h3>
  1070.             <?php endif; ?>
  1071.  
  1072.             -------------------- Or --------------------
  1073.  
  1074. <?php if ( have_posts() ) : ?>
  1075.             <h1 class="search-page-title"><?php printf( __( 'Search Results for: %s' ), '<span>' . get_search_query() . '</span>' ); ?></h1>
  1076.             <?php
  1077.              get_template_part( 'post-loop', 'search' );
  1078.             ?>
  1079. <?php else : ?>
  1080.                 <div id="post-0" class="post no-results not-found">
  1081.                     <h2 class="entry-title"><?php echo __( 'Nothing Found' ); ?></h2>
  1082.                     <div class="entry-content">
  1083.                         <p><?php echo __( 'Sorry, but nothing matched your search criteria. Please try again with some different keywords.' ); ?></p>
  1084.                        
  1085.                     <a id="submit" href="<?php bloginfo( 'home' ); ?>">Home</a>
  1086.                     </div><!-- .entry-content -->
  1087.                 </div><!-- #post-0 -->
  1088. <?php endif; ?>
  1089.  
  1090.  
  1091.                 HEADER a use korte hobe inputgolor jagay
  1092. -----------------------------------------------------------------
  1093.  
  1094. <form role="search" method="get" id="searchform" action="<?php echo home_url( '/' ); ?>">      
  1095.     <div class="search floatright fix">
  1096.         <input type="text" name="s" id="s" placeholder="Looking For Somthing" />
  1097.         <input type="submit" value="GO"/>
  1098.     </div>
  1099. </form>
  1100.  
  1101.  
  1102. =================================================
  1103.                 //archive.php
  1104. =================================================
  1105. Archive করে রাখার জন্য এই কোড দিয়ে root ফোল্ডারে archive.php নামে একটি পেজ তৈরি করতে হয়।
  1106. -------------------------------------------------
  1107.     <h1 class="archivetitle">
  1108.  
  1109.         <?php if (have_posts()) : ?>
  1110.  
  1111.             <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
  1112.  
  1113.                 <?php /* If this is a category archive */ if (is_category()) { ?>
  1114.  
  1115.                     <?php _e('Archive for the'); ?> '<?php echo single_cat_title(); ?>' <?php _e('Category'); ?>                                    
  1116.  
  1117.                 <?php /* If this is a tag archive */  } elseif( is_tag() ) { ?>
  1118.  
  1119.                     <?php _e('Archive for the'); ?> <?php single_tag_title(); ?> Tag
  1120.  
  1121.                 <?php /* If this is a daily archive */ } elseif (is_day()) { ?>
  1122.  
  1123.                     <?php _e('Archive for'); ?> <?php the_time('F jS, Y'); ?>                                        
  1124.  
  1125.                 <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
  1126.  
  1127.                     <?php _e('Archive for'); ?> <?php the_time('F, Y'); ?>                                    
  1128.  
  1129.                 <?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
  1130.  
  1131.                     <?php _e('Archive for'); ?> <?php the_time('Y'); ?>                                        
  1132.  
  1133.                 <?php /* If this is a search */ } elseif (is_search()) { ?>
  1134.  
  1135.                     <?php _e('Search Results'); ?>                            
  1136.  
  1137.                 <?php /* If this is an author archive */ } elseif (is_author()) { ?>
  1138.  
  1139.                     <?php _e('Author Archive'); ?>                                        
  1140.  
  1141.                 <?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
  1142.  
  1143.                     <?php _e('Blog Archives'); ?>                                        
  1144.  
  1145.         <?php } ?>
  1146.  
  1147.     </h1>
  1148.  
  1149.     <div class="your_div_class">
  1150.         <?php get_template_part('post-excerpt'); ?>
  1151.     </div>
  1152.     <?php else : ?>
  1153.     <div class="your_div_class floatleft">
  1154.         <h3><?php _e('404 Error&#58; Not Found'); ?></h3>
  1155.     </div>
  1156.  
  1157.     <?php endif; ?>
  1158.    
  1159.  
  1160. <?php==================================================
  1161.             নাম্বার সহ পেজিনেশন আনার জন্য এই কোড।
  1162. ==================================================
  1163.             //For Numbering Pagination
  1164. --------------------------------------------------
  1165. /* copy and past in functions.php for numbering pagination */
  1166.  
  1167. function pagination($pages = '', $range = 4)
  1168.     {  
  1169.          $showitems = ($range * 2)+1;  
  1170.  
  1171.          global $paged;
  1172.          if(empty($paged)) $paged = 1;
  1173.  
  1174.          if($pages == '')
  1175.          {
  1176.              global $wp_query;
  1177.              $pages = $wp_query->max_num_pages;
  1178.              if(!$pages)
  1179.              {
  1180.                  $pages = 1;
  1181.              }
  1182.          }  
  1183.  
  1184.          if(1 != $pages)
  1185.          {
  1186.              echo "<div class=\"pagination\"><span>Page ".$paged." of ".$pages."</span>";
  1187.              if($paged > 2 && $paged > $range+1 && $showitems < $pages) echo "<a href='".get_pagenum_link(1)."'>&laquo; First</a>";
  1188.              if($paged > 1 && $showitems < $pages) echo "<a href='".get_pagenum_link($paged - 1)."'>&lsaquo; Previous</a>";
  1189.  
  1190.              for ($i=1; $i <= $pages; $i++)
  1191.              {
  1192.                  if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems ))
  1193.                  {
  1194.                      echo ($paged == $i)? "<span class=\"current\">".$i."</span>":"<a href='".get_pagenum_link($i)."' class=\"inactive\">".$i."</a>";
  1195.                  }
  1196.              }
  1197.  
  1198.              if ($paged < $pages && $showitems < $pages) echo "<a href=\"".get_pagenum_link($paged + 1)."\">Next &rsaquo;</a>";  
  1199.              if ($paged < $pages-1 &&  $paged+$range-1 < $pages && $showitems < $pages) echo "<a href='".get_pagenum_link($pages)."'>Last &raquo;</a>";
  1200.              echo "</div>\n";
  1201.          }
  1202.     }
  1203.    
  1204.    
  1205. /* Use this code and post in loop.php */
  1206.  
  1207.     <?php if (function_exists("pagination")) {
  1208.         pagination($additional_loop->max_num_pages);
  1209.     }
  1210.     ?>
  1211.  
  1212.    
  1213. /* Copy and past in style.css for numbering pagination styling */
  1214.  
  1215. .pagination{clear:both;font-size:11px;line-height:13px;}
  1216. .pagination span, .pagination a{display:block;float:left;margin:2px 2px 2px 0;padding:6px 9px 5px 9px;text-decoration:none;width:auto;color:#fff;background:#555;}
  1217. .pagination a:hover{color:#fff;background:#3279BB;}
  1218. .pagination .current{padding:6px 9px 5px 9px;background:#3279BB;color:#fff;}
  1219.  
  1220.  
  1221.  
  1222. পেজিনেশন আনার জন্য এই কোড।
  1223. ==================================================
  1224.                     //For Pagination
  1225. ==================================================
  1226. /* copy and past in loop.php for pagination */
  1227.  
  1228. <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts') ); ?></div>
  1229. <div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>') ); ?></div>
  1230.  
  1231. /* Copy and past in style.css for pagination styling */
  1232. .nav-previous {float:left;width:49%;margin-right:1%;text-align:left;margin-bottom:25px}
  1233. .nav-next {float:right;width:49%;margin-left:1%;text-align:right}
  1234.  
  1235.  
  1236.  
  1237.  
  1238. =========================================================
  1239.             // shortcode এর জন্য code
  1240. =========================================================
  1241.  
  1242. // without attribute
  1243. ---------------------------------------------------------
  1244. function vimeo_shortcode( $atts, $content = null  ) {
  1245.     return '<iframe src="//player.vimeo.com/video/'.$content.'" width="500" height="281" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>';
  1246. }  
  1247. add_shortcode('vimeo', 'vimeo_shortcode');
  1248.  
  1249. // with attribute
  1250. ---------------------------------------------------------
  1251.  
  1252. function vimeo_video_shortcode( $atts, $content = null ) {
  1253.     $a = shortcode_atts( array(
  1254.         'id' => '74715441'
  1255.     ), $atts );
  1256.    
  1257.     return'<div class="res_video"><iframe src="http://player.vimeo.com/video/' . esc_attr($a['id']) . '" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe></div>';
  1258. }
  1259. add_shortcode('vimeo', 'vimeo_video_shortcode');
  1260.  
  1261. //widget এর text এ shoortcode support করানোর জন্য functions.php তে এই code টি কল করতে হবে
  1262. --------------------------------------------------------
  1263. add_filter('widget_text', 'do_shortcode');
  1264. //widget এর text এ PHP code support করানোর জন্য functions.php তে এই code টি কল করতে হবে
  1265. --------------------------------------------------------
  1266. add_filter('widget_text','execute_php',100);
  1267. function execute_php($html){
  1268.      if(strpos($html,"<"."?php")!==false){
  1269.           ob_start();
  1270.           eval("?".">".$html);
  1271.           $html=ob_get_contents();
  1272.           ob_end_clean();
  1273.      }
  1274.      return $html;
  1275. }
  1276.  
  1277. // do-shortcode এর জন্য code টি দিয়ে আপনার নির্দিষ্ট স্থানে paste করুন
  1278. --------------------------------------------------------
  1279. <?php echo do_shortcode('[your_desired_shortcode]'); ?>
  1280.  
  1281.         //custom_post in shortcode এর shortcode
  1282. --------------------------------------------------------
  1283. function category_post_shortcode($atts){
  1284.     extract( shortcode_atts( array(
  1285.         'title' => '',
  1286.         'link' => '',
  1287.         'category' => '',
  1288.     ), $atts, 'category_post' ) );
  1289.    
  1290.     $q = new WP_Query(
  1291.         array( 'category' => $category, 'posts_per_page' => '3', 'post_type' => 'post')
  1292.         );
  1293. $list = '<div class="latest_from_category"><h2 class="latest_frm_cat_title">'.$title.'</h2> <a href="'.$link.'" class="latest_more_link">more</a>';
  1294.  
  1295. while($q->have_posts()) : $q->the_post();
  1296.     //get the ID of your post in the loop
  1297.     $id = get_the_ID();
  1298.  
  1299.     $post_excerpt = get_post_meta($id, 'post_excerpt', true);  
  1300.     $post_thumbnail= get_the_post_thumbnail( $post->ID, 'post-thumbnail' );        
  1301.     $list .= '
  1302.    
  1303.                         <div class="single_cate_post floatleft">
  1304.                             '.$post_thumbnail.'
  1305.                             <h3>'.get_the_title().'</h3>
  1306.                             <p>'.$post_excerpt.'</p>
  1307.                             <a href="'.get_permalink().'" class="readmore">Read More</a>
  1308.                         </div>     
  1309.     ';        
  1310. endwhile;
  1311. $list.= '</div>';
  1312. wp_reset_query();
  1313. return $list;
  1314. }
  1315. add_shortcode('category_post', 'category_post_shortcode'); 
  1316.  
  1317. //custom_post shortcode এর list এ  html code এর ভিতর <?php the_title?>এবং <?php the_content?> পরিবর্তে হবে --------------------------------------------------------
  1318. '.get_the_title().' or ' .do_shortcode( get_the_title() ). '
  1319. '.get_the_content().'  
  1320. '.get_the_permalink().'
  1321. ' .get_the_excerpt(). '
  1322. '.get_the_date().'
  1323. '.get_the_author().'
  1324. '. get_site_url() .'
  1325.  
  1326. //for featured image
  1327. $featured_image_url = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'case-study-image' );
  1328. <img src="'.$featured_image_url[0].'" alt="" />
  1329.  
  1330. //for Template directory uri
  1331. $theme_dir = get_bloginfo('template_directory');
  1332. <img src="'.$theme_dir.'/img/link_style.png" alt="" />
  1333.  
  1334.  
  1335. ========================================================
  1336.                 //For 404 page
  1337. ========================================================
  1338. <!-- copy and past in 404.php -->
  1339. <div class="not_found">
  1340.     <h1>404 not found!</h1>
  1341.     <p>Sorry, but the page you are trying to reach is unavailable or does not exist.</p>
  1342.     <a id="submit" href="<?php bloginfo( 'home' ); ?>">Home</a>
  1343. </div>
  1344.  
  1345.  
  1346. ========================================================
  1347.                 //Reply Comment Scripts
  1348. ========================================================
  1349.  
  1350. <!-- copy and past in functions.php -->
  1351. function comment_scripts(){
  1352.  
  1353.    if ( is_singular() ) wp_enqueue_script( 'comment-reply' );
  1354.  
  1355. }
  1356.  
  1357. add_action( 'wp_enqueue_scripts', 'comment_scripts' );
  1358.  
  1359.  
  1360. <!-- copy and past in comments.css From E/All source/comments.css -->
  1361.  
  1362.  
  1363. for
  1364.  
  1365.  
  1366. ==================================================
  1367.                 Wordpress এ  SMOF
  1368. ==================================================             
  1369.                 SMOF এর section array
  1370. --------------------------------------------------
  1371. $of_options[] = array(  "name"      => "General Settings",
  1372.                         "type"      => "heading"
  1373.                 );
  1374.  
  1375.                Wordpress এ SMOF এর array
  1376. --------------------------------------------------
  1377. $of_options[] = array(  "name"      => "Phone number",
  1378.                         "desc"      => "your phone number here",
  1379.                         "id"        => "phone_number",
  1380.                         // Use the shortcodes [site_url] or [site_url_secure] for setting default URLs
  1381.                         "std"       => "0535 954 74 54",
  1382.                         "type"      => "text"
  1383.                 );
  1384.  
  1385. SMOF এর option active code এটা target.php তে নির্দিষ্ট স্থানে paste হবে
  1386. --------------------------------------------------
  1387. <?php echo do_shortcode(stripslashes($data['phone_number'])); ?>   
  1388.  
  1389.  
  1390.  
  1391.            
  1392. ==========================================================
  1393.                     //Option Tree
  1394. ==========================================================
  1395. প্রথমে wordpress.org থেকে option tree download করুন
  1396. Download Option Tree: http://wordpress.org/extend/plugins/option-tree/
  1397. ডাউনলোড করার পর আপনার থিমে option-tree folder টি রেখে দিবেন
  1398. option-tree folderএর মধ্যে থাকা ot-loader.php টি function এ include করতে হবে
  1399. function এ  গিয়ে প্রথমে
  1400.  
  1401. //Activate Option Tree just copy & paste this code in functions.php
  1402.  
  1403. //add_filter( 'ot_show_pages', '__return_false' ); কাজ শেষে এই লাইনটির কমেন্ট উঠিয়ে দিতে হবে
  1404. add_filter( 'ot_show_new_layout', '__return_false' );
  1405. add_filter( 'ot_theme_mode', '__return_true' );
  1406. include_once( 'option-tree/ot-loader.php' );
  1407. include_once( 'inc/theme-options.php' );
  1408. include_once( 'inc/meta-boxes.php' );
  1409.  
  1410. Meta-box build-up করার জন্য প্রথমে assets > theme-mode > demo-meta-boxes.php ফাইলটি কপি করুন তারপর আপনার থিমের মধ্যে একটা ফোল্ডার করবেন নাম দিবেন inc এবার এই folder এর ভিতর ফাইলটি pasteকরুন এবার ফাইলটির নাম পরিবর্তন করে শুধু meta-boxes.php নাম দিন। এবার functons.php তে গিয়ে ফাইলটি চিনিয়ে দিবেন include_once('inc/meta-boxes.php'); এই লাইনটি লিখে দিবেন। এবার  meta-boxes.php ফাইলটি ওপেন করুন
  1411.  
  1412. function custom_meta_boxes() {
  1413.  
  1414.   /*
  1415.    * Create a custom meta boxes array that we pass to
  1416.    * the OptionTree Meta Box API Class.
  1417.    */
  1418.   $my_meta_box/*আপনার meta_box যেকোনো নাম */ = array(
  1419.     'id'          => 'demo_meta_box',/* আপনার meta_box নাম এবং id একই হইতে পারে */
  1420.     'title'       => __( 'Demo Meta Box', 'theme-text-domain' ),/* আপনার meta_box এর titl */
  1421.     'desc'        => '',/* আপনার meta_box এর দিকনির্দেশনা */
  1422.     'pages'       => array( 'post' ),/* আপনার post-type এর নাম */
  1423.     'context'     => 'normal',
  1424.     'priority'    => 'high',
  1425.     'fields'      => array(
  1426.       array(
  1427.         'label'       => __( 'Conditions', 'theme-text-domain' ),/* আপনার meta_box এর option এর label বা নাম  */
  1428.         'id'          => 'demo_conditions', /* আপনার custom-field id নাম */
  1429.         'desc'          => '', /* আপনার meta_box এর option এর দিকনির্দেশনা */
  1430.         'type'        => 'tab',/* আপনার meta_box এর option এর type */
  1431.         'std'         => 'off',/* আপনার meta_box এর option এর default data যেটা দেখতে চান */
  1432.         'operator'    => 'and',
  1433.         'condition'   => 'demo_show_gallery:is(on),demo_gallery:not()'
  1434.       ),
  1435.      
  1436.     )
  1437.   );
  1438.  
  1439.   /**
  1440.    * Register our meta boxes using the
  1441.    * ot_register_meta_box() function.
  1442.    */
  1443.   if ( function_exists( 'ot_register_meta_box' ) )
  1444.     ot_register_meta_box( $my_meta_box );/* সবশেষে আপনার meta_box নাম দিয়ে শেষ করতে হবে*/
  1445.  
  1446. }
  1447.  
  1448. this code is for specific page metabox
  1449. --------------------------------------------
  1450. $price_page_meta_box = array(
  1451.     'id'          => 'price_page_meta_box',
  1452.     'title'       => 'Pricing Page Table Information',
  1453.     'desc'        => '',
  1454.     'pages'       => array( 'page' ),
  1455.     'context'     => 'normal',
  1456.     'priority'    => 'high',
  1457.     'fields'      => array(
  1458.       array(
  1459.         'label'       => 'Pricing Page Table Head',
  1460.         'id'          => 'pric_table_head',
  1461.         'std'          => '',
  1462.         'type'        => 'textarea'
  1463.       ),
  1464.     )
  1465.   );
  1466.  
  1467.   $post_id = $_GET['post'] ? $_GET['post'] : $_POST['post_ID'];
  1468. $template_file = get_post_meta($post_id, '_wp_page_template', TRUE);
  1469.  
  1470. if ($template_file == 'price-newmeta.php') {
  1471.     ot_register_meta_box( $price_page_meta_box );
  1472. }
  1473.  
  1474.  
  1475. এবার dashboard গিয়ে দেখবেন custom-field এর স্থলে আলাদাভাবে  meta-boxes চলে এসেছে
  1476.  
  1477. option tree থেকে শুধুমাত্র  metabox use করতে নিচের code লেখুন functions.php
  1478. add_filter( 'ot_show_pages', '__return_false' );
  1479. add_filter( 'ot_use_theme_options', '__return_false' );
  1480.  
  1481.  
  1482. option build-up করার জন্য প্রথমে assets > theme-mode > demo-theme-options.php ফাইলটি কপি করুন তারপর আপনার থিমের মধ্যে একটা ফোল্ডার করবেন নাম দিবেন inc এবার এই folder এর ভিতর ফাইলটি pasteকরুন এবার ফাইলটির নাম পরিবর্তন করে শুধু theme-options.php নাম দিন। এবার functons.php তে গিয়ে ফাইলটি চিনিয়ে দিবেন include_once(meta'inc/theme-options.php'); এই লাইনটি লিখে দিবেন। এবার dashboard > appearance গিয়ে দেখবেন theme option চলে এসেছে
  1483.  
  1484. এবার theme-options.php ফাইলটির ভিতরের যেই sections এবং settings গুলি দরকার নেই সেইগুলি কেটে দিব।   settings এর ভিতর যতগুলি array নিবেন ততগুলি option তৈরি হবে  প্রত্যেকটি sections এর under এ।sections গুলু আপনার ইচ্ছামত যেইকয়টা লাগবে সেই কয়টা নিতে পারবেন এবং নাম দিতে পারবেন। এ। sections এর array তেtitle & id নিলেই হবে আর কিছু লাগবেনা
  1485.  
  1486.         //Create Option Tree In the theme-options.php
  1487. -----------------------------------------------------------
  1488.  
  1489.     <?php
  1490.         add_action( 'admin_init', 'custom_theme_options', 1 );
  1491.         function custom_theme_options() {
  1492.             $saved_settings = get_option( 'option_tree_settings', array() );
  1493.             $custom_settings = array(
  1494.                 'sections' => array(
  1495.                 array(
  1496.                 'id' => 'general',
  1497.                 'title' => 'Site Settings'
  1498.                 )
  1499.                 ),
  1500.                 'settings' => array(
  1501.                 array(
  1502.                 'id' => 'logo_text',
  1503.                 'label' => 'Logo Text',
  1504.                 'desc' => 'Use H1, H2, H3 tag',
  1505.                 'type' => 'textarea',
  1506.                 'section' => 'general'
  1507.                 ),
  1508.                 array(
  1509.                 'id' => 'footer_text',
  1510.                 'label' => 'Footer Text',
  1511.                 'type' => 'textarea',
  1512.                 'section' => 'general'
  1513.                 )
  1514.                 )
  1515.                 );
  1516.                 if ( $saved_settings !== $custom_settings ) {
  1517.                 update_option( 'option_tree_settings', $custom_settings );
  1518.                 }
  1519.         }
  1520.     ?>
  1521.  
  1522.         //Get Data From Option Tree
  1523. ------------------------------------------------------
  1524.         //Condtional Data
  1525. <?php if ( function_exists( 'get_option_tree') ) : if( get_option_tree( 'your_tree_id') ) : ?>
  1526. <?php get_option_tree( 'your_tree_id', '', true ); ?>
  1527. <?php else : ?>
  1528. Your Default Data here
  1529. <?php endif; endif; ?>
  1530.  
  1531. ---------or----------------
  1532. <?php
  1533. $facebook = get_option_tree('facebook-link', '', false);
  1534. ?>
  1535. <?php echo $facebook; ?>
  1536.  
  1537. ---------or----------------
  1538. <?php get_option_tree( 'logo_link1', '', true ); ?>
  1539.  
  1540.         //Get Data From Option Tree Metabox
  1541. ------------------------------------------------------
  1542. <?php
  1543. $case_sub = get_post_meta($post->ID, 'case_sub', true);
  1544. ?>
  1545. <?php echo $case_sub; ?>
  1546.  
  1547. ---------or----------------
  1548. <?php echo get_post_meta($post->ID, 'case_sub', true); ?>
  1549.    
  1550. // this code for css style dynamic by theme option and metabox
  1551.    
  1552. <style type="text/css">
  1553.     .logo {background: url(<?php get_option_tree( 'logo', '', 'true' ); ?>) no-repeat center center;}
  1554.     .prcbanner_content h1{color:<?php echo get_post_meta($post->ID, 'picker', true); ?>}
  1555. </style>
  1556.  
  1557. /*for option tree  meta box short code support */
  1558. <?php
  1559. $mixitup = get_post_meta($post->ID, 'mixitup', true);
  1560. ?>
  1561.  
  1562. <?php echo do_shortcode($mixitup); ?>
  1563.  
  1564. ======================================================
  1565.  How to get cropped / resized images through option tree meta box
  1566.  metabox image resize code
  1567. ======================================================
  1568.  
  1569. // register your gallery type meta box and use the following code to display images.
  1570. <?php
  1571.     if ( function_exists( 'ot_get_option' ) ) {
  1572.        $images = explode( ',', get_post_meta( get_the_ID(), 'field-id', true ) );
  1573.       if ( !empty( $images ) ) {
  1574.         foreach( $images as $id ) {
  1575.           if ( !empty( $id ) ) {
  1576.             $full_img_src = wp_get_attachment_image_src( $id, 'your-image-size' );
  1577.             $thumb_img_src = wp_get_attachment_image_src( $id,'your-image-size' );
  1578.             echo '<div data-thumb="'. $thumb_img_src[0].'" data-src="'.$full_img_src[0].'"></div>';
  1579.           }
  1580.         }
  1581.       }
  1582.     }
  1583. ?>
  1584. In line no 4 the field-id is your meta box id.You can define as much as image sizes you want with your-image-size which you can see in the line no 08 & 09 . The your-image-size is your image id which you created by add_image_size() function in the functions.php .Thank You!
  1585.  
  1586. //option tree image resize code
  1587.  
  1588. $slides = ot_get_option( 'my_slider', array() );
  1589. if ( ! empty( $slides ) ) {
  1590.     foreach( $slides as $slide ) {
  1591.         $id = custom_get_attachment_id( $slide['image'] );
  1592.         $src = wp_get_attachment_image_src( $id, 'you-image-size' );
  1593.         echo 'HTML HERE';
  1594.     }
  1595. }
  1596.  
  1597. =======================================================
  1598. metabox category-select type query code
  1599. =======================================================
  1600. <?php
  1601. $cat = ot_get_option( 'your_id', '', false, true, 0 );
  1602. $args = array( 'numberposts' =>1, 'category'=> $cat);
  1603. $postslist = get_posts( $args );
  1604. foreach ($postslist as $post) :  setup_postdata($post);
  1605. ?>
  1606.  
  1607. <?php the_title(); ?>
  1608. <?php the_content(); ?>
  1609.  
  1610. <?php endforeach; ?>
  1611.  
  1612. =======================================================
  1613. metabox slide type query code fpr owl slider
  1614. =======================================================
  1615.  
  1616. //this code paste in metabox.php file
  1617. array(
  1618.     'id'          => 'spyr_demo_slider',
  1619.     'label'       => __( 'Slider', 'text-domain' ),
  1620.     'desc'        => __( 'Your description', 'text-domain' ),
  1621.     'type'        => 'slider',
  1622. )
  1623.  
  1624. //this code paste in template.php file
  1625. <?php
  1626. $spyr_demo_slider = get_post_meta( $post->ID, 'spyr_demo_slider', true );
  1627.  
  1628. // Loop through the array to build your Slider.
  1629. // Note that every slider is different
  1630. // We have access to the following array keys
  1631. // title, description, image and link
  1632. echo '<div id="owl-demo" class="owl-theme">';
  1633. foreach( $spyr_demo_slider as $slide ) {
  1634.     echo '<div class="item"><img src="'. $slide['image'] .'" width="100%" height="auto"
  1635.          alt="'. $slide['description'] .'" title="'. $slide['title'] .'" /></div>';
  1636. }
  1637. echo '</div>';
  1638.  
  1639. ?>
  1640.  
  1641. =======================================================
  1642. metabox list type query code
  1643. =======================================================
  1644. <?php
  1645.  
  1646. $list_item = ot_get_option( 'id', array() );
  1647.  
  1648. if ( !empty( $list_item ) ) {
  1649.  
  1650. echo '<div>';
  1651.  
  1652. foreach( $list_item as $name ) {
  1653.  
  1654. echo '<div>'.$name['title'].'</div>
  1655.  
  1656. ';
  1657.  
  1658. }
  1659.  
  1660. echo '</div>';
  1661.  
  1662. }
  1663.  
  1664. ?>
  1665.  
  1666. ------------------------------------------------------ 
  1667.         //Simple Data
  1668. <?php get_option_tree( 'facebook', '', true ); ?>
  1669.  
  1670. নিচের কোডগুলু দিয়েও করা যায় । অনেকগুলু option দরকার হইলে আমরা variable নিয়ে করব যাতে করে আমরা echo করে নিয়ে নিতে পারি । আমরা যখন condition ব্যাবহার করবো তখন variable নেওয়া লাগে।
  1671. <?php $your_variable = get_option_tree( 'your_tree_id', '', false ); ?>
  1672. <?php echo $your_variable; ?> এই কোডটি যেখানে দরকার সেখানে paste করব
  1673. -------------------------------------------------------------
  1674. প্রথমে variable নিতে হবে নোটঃ একাধিক option দরকার হইলে একাধিক variable নিবেন  <?php এখানে হবে ?>
  1675. যেমনঃ
  1676. <?php $your_variable = get_option_tree( 'your_tree_id', '', false )
  1677.       $your_variable = get_option_tree( 'your_tree_id', '', false );
  1678. ?>
  1679. তারপর নিচে নিচে condition হবে প্রত্যেকটার জন্য আলাদা আলাদা করে condition নিবেন
  1680. যেমনঃ
  1681. <?php if(your_variable) : ?>
  1682.     <?php echo $your_variable; ?>
  1683. <?php else : ?>
  1684.     your fallback data
  1685. <?php endif; ?>
  1686.  
  1687. <?php if(your_variable) : ?>
  1688.     <?php echo $your_variable; ?>
  1689. <?php else : ?>
  1690.     your fallback data
  1691. <?php endif; ?>
  1692.  
  1693. // slider না দেখতে চাইলে নিচের কোডগুলি দিয়ে করতে পারেন
  1694. <?php
  1695. $slider_appearance = get_option_tree( 'slider_appearance', '', false );
  1696. ?>
  1697.  
  1698. <?php if($slider_appearance = 'no') : ?>
  1699. <?php /* No Data */?>
  1700. <?php if($slider_appearance = 'yes') : ?>
  1701. <?php get_template_part('slider'); ?>
  1702. <?php endif; endif; ?>
  1703.  
  1704. ============================================================
  1705. // REMOVE BAD P and BR TAGS FROM NAME ANCHORS
  1706. ============================================================
  1707. add_filter('the_content', 'remove_bad_pbr_tags');
  1708. function remove_bad_pbr_tags($content) {
  1709.         $pattern = '/<p><a name=[\"\'](.*)[\"\']><br\s*\/>\s*<h([1-9])>(.*)<\/h([1-9])>\s*<p><\/a><br\s*\/>/';
  1710.         $replacement = "<a name=\"$1\"><h$2>$3</h$4></a>\n<p>";
  1711.     $content = preg_replace($pattern, $replacement, $content);
  1712.     return $content;
  1713. }
  1714. -------------------------------------------------------------
  1715.                         or
  1716. -------------------------------------------------------------
  1717. // REMOVE BAD P and BR TAGS FROM NAME ANCHORS
  1718. remove_filter( 'the_content', 'wpautop' );
  1719. remove_filter( 'the_excerpt', 'wpautop' );
  1720.  
  1721. function wpse_wpautop_nobr( $content ) {
  1722.     return wpautop( $content, false );
  1723. }
  1724.  
  1725. add_filter( 'the_content', 'wpse_wpautop_nobr' );
  1726. add_filter( 'the_excerpt', 'wpse_wpautop_nobr' );
  1727.  
  1728. =============================================================
  1729. In qTranslate Change logo/image based on language selected
  1730. =============================================================
  1731. <img src="<?php if ( qtrans_getLanguage() == "en" ){ echo 'your en IMG path';} else if ( qtrans_getLanguage() == "ar" ){echo 'your arIMG path';}" />
  1732.  
  1733. --------------or------------------
  1734.  
  1735. <div class="home-link">
  1736.     <a href="<?php qtrans_convertURL( bloginfo('url') ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home">
  1737.     <img src="<?php echo get_template_directory_uri(); ?>
  1738.     <?php if ( qtrans_getLanguage() == "pt" ){
  1739.         echo '/images/logo-dpa-284.png' ?>
  1740.     <?php } else if ( qtrans_getLanguage() == "en" ){
  1741.         echo '/images/logo-oh.png' ?><?php } ?> " width="284" height="48" alt="logo homepage">
  1742.     </a>
  1743. </div>
  1744.  
  1745. ---------------or---------------------
  1746. <?php  
  1747.     if ( qtrans_getLanguage() == 'en' ) {
  1748.       //put your code in here
  1749.     }
  1750.     elseif ( qtrans_getLanguage() == 'de' ) {
  1751.       //put your code in here
  1752.     }
  1753. ?>
  1754.  
  1755.  
  1756. =============================================================
  1757.                     //Post View Count
  1758. =============================================================
  1759.         //আপনার functions.php তে এই কোডটি যুক্ত করুন
  1760. -------------------------------------------------------------
  1761.             // function to display number of posts.
  1762. getPostViews($postID){ $count_key = 'post_views_count'; $count = get_post_meta($postID,
  1763. $count_key, true); if($count==''){ delete_post_meta($postID, $count_key);
  1764. add_post_meta($postID, $count_key, '0'); return "0 View"; } return $count.' Times';}
  1765.  
  1766.             // function to count views.
  1767. function setPostViews($postID) { $count_key = 'post_views_count';
  1768. $count = get_post_meta($postID, $count_key, true); if($count==''){ $count = 0;
  1769. delete_post_meta($postID, $count_key); add_post_meta($postID, $count_key, '0'); }else{
  1770. $count++; update_post_meta($postID, $count_key, $count); }}
  1771.  
  1772. আপনি যেখানে পোস্ট ভিউ কাউন্ট সেট করতে চান সেখানকার  লুপে এই কোডের পরে এই কোডটি যুক্ত করুন আপনি যেখানে পোস্ট ভিউ কাউন্ট দেখাতে চান
  1773.  
  1774.  
  1775. =============================================================
  1776.             //Post View timer Count
  1777. =============================================================
  1778. <?php echo human_time_diff( get_the_time('U'), current_time('timestamp') ) . ' ago'; ?>
  1779.  
  1780. =============================================================
  1781.                     //Bangla date view
  1782. =============================================================
  1783.         //আপনার functions.php তে এই কোডটি যুক্ত করুন
  1784. -------------------------------------------------------------
  1785. function bn($mhm)
  1786. {
  1787.     $eng = array('January','February','March','April','May','June','July','August','September','October','November','December',
  1788.                  'Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec',
  1789.                  'Saturday','Sunday','Monday','Tuesday','Wednesday','Thursday','Friday',
  1790.                  'Sat','Sun','Mon','Tue','Wed','Thu','Fri',
  1791.                  '1','2','3','4','5','6','7','8','9','0',
  1792.                  'am','pm','st','nd','rd','th');
  1793.     $bng = array('জানুয়ারি','ফেব্রুয়ারি','মার্চ','এপ্রিল','মে','জুন','জুলাই','আগস্ট','সেপ্টেম্বর','অক্টোবর','নভেম্বর','ডিসেম্বর',
  1794.                  'জানু','ফেব্রু','মার্চ','এপ্রি','মে','জুন','জুলা','আগ','সেপ্টে','অক্টো','নভে','ডিসে',
  1795.                  'শনিবার','রবিবার','সোমবার','মঙ্গলবার','বুধবার','বৃহস্পতিবার','শুক্রবার',
  1796.                  'শনি','রবি','সোম','মঙ্গল','বুধ','বৃহঃ','শুক্র',
  1797.                  '১','২','৩','৪','৫','৬','৭','৮','৯','০',
  1798.                  'পূর্বাহ্ণ','অপরাহ্ণ','&#173;','&#173;','&#173;','&#173;');
  1799.     $con = str_replace($eng, $bng, $mhm);
  1800.     return $con;
  1801. }
  1802. add_action('wp_head', function() {
  1803. echo '<meta name="mhm" content="bdat 1.3" />';});
  1804. add_filter('the_date', 'bn');
  1805. add_filter('the_time', 'bn');
  1806. add_filter('the_views', 'bn');
  1807. add_filter('comments_number', 'bn');
  1808. add_filter('get_comment_date', 'bn');
  1809. add_filter('get_comment_time', 'bn');
  1810.  
  1811. ============================================================
  1812. How to add custom header and custom background in wordpress theme
  1813. ============================================================
  1814.  
  1815.         //Title: custom background.
  1816. ------------------------------------------------------------
  1817.         head.php
  1818. ..............
  1819. replace the
  1820. tag using bellow the code.
  1821. >
  1822.  
  1823. functions.php
  1824. .........................
  1825. this code put within the tag
  1826.  
  1827. $defaults = array(
  1828. 'default-color' => '#000',
  1829. 'default-image' => '',
  1830. 'wp-head-callback' => '_custom_background_cb',
  1831. 'admin-head-callback' => '',
  1832. 'admin-preview-callback' => ''
  1833. );
  1834. add_theme_support( 'custom-background', $defaults );
  1835.  
  1836.  
  1837. Title: custom Header/Logo
  1838. ---------------------------------------------
  1839.  
  1840. head.php
  1841. ..........................
  1842. Put this code where you want to upload your logo.
  1843. ----------------------------------------------
  1844.  
  1845. functions.php
  1846. ..........................
  1847. this code put within the tag
  1848.  
  1849. $defaults = array(
  1850. 'default-image' => '',
  1851. 'random-default' => true,
  1852. 'width' => 1000,
  1853. 'height' => 200,
  1854. 'flex-height' => true,
  1855. 'flex-width' => true,
  1856. 'default-text-color' => '#000',
  1857. 'header-text' => true,
  1858. 'uploads' => true,
  1859. 'wp-head-callback' => '',
  1860. 'admin-head-callback' => '',
  1861. 'admin-preview-callback' => '',
  1862. );
  1863. add_theme_support( 'custom-header', $defaults );
  1864.  
  1865. ===============================================
  1866. JQuery Basic code
  1867. ===============================================
  1868. $(document).ready(function(){
  1869.     $('#nav').slicknav();
  1870.    
  1871.    
  1872.   $(".slider_area").click(function(){
  1873.     $(".header_area").addClass("main_header");
  1874.   });
  1875.    
  1876.    
  1877.   $(".cross_button").click(function(){
  1878.     $(".fixed_advert").hide(50000);
  1879.   });
  1880.    
  1881.     $(".testimonials-title h3").click(function(){
  1882.     $(this).animate({fontSize:"50px"});
  1883.   });
  1884.  
  1885.     jQuery(".tab-pane:first-child").addClass("active");
  1886.     jQuery(".nav-tabs li:first-child").addClass("active");
  1887.                      
  1888.  
  1889.    
  1890. });
  1891.  
  1892. ===============================================
  1893. social share code for wordpress
  1894. ===============================================
  1895.  
  1896. -------------------------------------
  1897. <div class="social">
  1898.         <p>সবার সাথে শেয়ার করুন:</p>
  1899.         <!--Twitter-->
  1900.         <a class="twitter" href="http://twitter.com/home?status=<?php the_title(); ?>: <?php the_permalink(); ?>" target="_blank"><i class="fa fa-twitter"></i> </a>
  1901.         <!--Facebook-->
  1902.         <a class="facebook" href="http://www.facebook.com/sharer.php?u=<?php the_permalink();?>&amp;t=<?php the_title(); ?>" title="Share this post on Facebook!" onclick="window.open(this.href); return false;"><i class="fa fa-facebook"></i> </a>
  1903.         <!--Google Plus-->
  1904.         <a class="google-plus" target="_blank" href="https://plus.google.com/share?url=<?php the_permalink(); ?>"><i class="fa fa-google-plus"></i> </a>
  1905.         <a class="reddit" href="http://www.reddit.com/submit?url=<?php the_permalink(); ?>&amp;title=<?php the_title(); ?>" title="Reddit" rel="nofollow" target="_blank"><i class="fa fa-reddit"></i> </a>
  1906.         <a class="stumbleupon" href="http://www.stumbleupon.com/submit?url=<?php the_permalink(); ?>&amp;title=<?php the_title(); ?>" title="Stumble it" rel="nofollow" target="_blank"><i class="fa fa-stumbleupon"></i> </a>
  1907.         <!--Digg-->
  1908.         <a class="digg" href="http://digg.com/submit?url=<?php the_permalink(); ?>&amp;title=<?php the_title(); ?>" title="Digg this!" rel="nofollow" target="_blank"><i class="fa fa-digg"></i></a>
  1909.         <!--Linkedin-->
  1910.         <a class="linkedin" href="http://www.linkedin.com/shareArticle?mini=true&amp;title=<?php the_title(); ?>&amp;url=<?php the_permalink(); ?>" title="Share on LinkedIn" rel="external nofollow" rel="nofollow" target="_blank"><i class="fa fa-linkedin"></i></a>
  1911.         <!--Pinterest-->
  1912.         <a class="pinterest" href="http://pinterest.com/pin/create/button/?url=<?php the_permalink(); ?>&media=<?php $url = wp_get_attachment_url( get_post_thumbnail_id($post->ID) ); echo $url; ?>" title="Pinterest" rel="nofollow" target="_blank"><i class="fa fa-pinterest"></i></a>
  1913.         <!--Del.icio.us-->
  1914.         <a class="delicious" href="http://del.icio.us/post?url=<?php the_permalink(); ?>&amp;title=<?php the_title(); ?>" title="Bookmark on del.icio.us" rel="nofollow" target="_blank"><i class="fa fa-delicious"></i></a>
  1915. </div>
  1916.  
  1917.  
  1918.  
  1919.  ফেসুবকের বিভিন্ন লাইক বাটন যোগ করতে এখানে দেখতে পারেন
  1920.  ---------------------------------------------
  1921.  https://developers.facebook.com/docs/plugins/like-button/
  1922. ============================================
  1923.  /*Add Submenu in sidebar on wordpress*/
  1924. =============================================
  1925. /*Firstly, in your theme's functions.php, you need to write a function to register the names of your menus.*/
  1926.  
  1927.   function register_my_menus() {
  1928.   register_nav_menus(
  1929.     array( 'sidebar-menu' => __( 'Sidebar Menu' ) )
  1930.   );
  1931. }
  1932. add_action( 'init', 'register_my_menus' );
  1933.  
  1934. /*Display Menus on Theme
  1935.  
  1936. Once you've done that, your theme will be almost ready. The last preparation step is to tell the theme where you want the menus to show up.*/
  1937.  
  1938. <?php wp_nav_menu( array( 'theme_location' => 'sidebar-menu' ) ); ?>
  1939.  
  1940. /*That's all the background work. To finish, you would simply visit the Appearance -> Menus panel in your site admin.
  1941.  
  1942. Please read the wordpress codex site.. it has plenty of information on how to do this..*/
  1943.  
  1944.  
  1945. ==============================================
  1946. How to Remove WordPress Admin Bar for All Users Except Admin
  1947. ==============================================
  1948. add_action('after_setup_theme', 'remove_admin_bar');
  1949.  
  1950. function remove_admin_bar() {
  1951.  
  1952. if (!current_user_can('administrator') && !is_admin()) {
  1953.  
  1954. show_admin_bar(false);
  1955.  
  1956. }
  1957.  
  1958. }
  1959. ------------------------
  1960. If you want to disable it for all users, then simply paste this blew code in your theme’s functions.php file
  1961. ----------------------------------------------
  1962. show_admin_bar(false);
  1963.  
  1964. ==============================================
  1965. আপনার ওয়ার্ডপ্রেস ড্যাশবোর্ডর ‘Howdy’ লেখাকে পরিবর্তন করে দিন ইচ্ছা মতো যেকোনো কিছু।
  1966. ==============================================
  1967. add_filter('gettext', 'change_howdy', 10, 3);
  1968. function change_howdy($translated, $text, $domain) {
  1969.  
  1970. if (false !== strpos($translated, 'Howdy'))
  1971. return str_replace('Howdy', 'স্বাগতম', $translated);
  1972.  
  1973. return $translated;
  1974. }
  1975.  
  1976. এখানে আপনি ‘স্বাগতম’ এর জাইগায় আপনার পছন্দ মতো যেকোনো শব্দ দিতে পারেন। আজ তবে এখানে।ভাল থাকবেন।
  1977.  
  1978. ==============================================
  1979. এখন থেকে কেউ লগ আউট করলে সরাসরি তাকে নিয়ে যাবে হোম পেজে
  1980. ==============================================
  1981. add_action('wp_logout','go_home');
  1982. function go_home(){
  1983. wp_redirect( home_url() );
  1984. exit();
  1985. }
  1986.  
  1987. ==============================================
  1988. নিয়ে নিন সুন্দর একটা বাংলা লগিন/রেজিস্টার প্যানেল
  1989. ==============================================
  1990. খুবই সহজ সুধু নিছের কোড কপি করে আপনার সাইট এর sidebar এর text widget এ past করে সেভ করুন ব্যাস কাজ শেষ।
  1991.  
  1992. <?php global $user_ID, $user_identity, $user_level ?>
  1993. <?php if ( $user_ID ) : ?>
  1994. <h2> স্বাগতম/Welcome <strong><?php echo $user_identity ?></strong></h2>
  1995. <li><a href="<?php bloginfo('url') ?>/wp-admin/">ড্যাশবোর্ডে/Dashboard</a></li>
  1996. <?php if ( $user_level >= 1 ) : ?>
  1997. <li><a href="<?php bloginfo(‘url’) ?>/wp-admin/post-new.php">নতুন পোষ্ট লিখুন।/New Post</a></li>
  1998. <?php endif // $user_level >= 1 ?>
  1999. <li><a href="<?php bloginfo('url') ?>/wp-admin/profile.php">আপনার প্রোফাইল পাতা/Profile</a></li>
  2000. <li><a href="<?php bloginfo('url') ?>/wp-login.php?action=logout&amp;redirect_to=<?php echo urlencode($_SERVER['REQUEST_URI']) ?>">বের হয়ে যান/Logout</a></li>
  2001. </ul>
  2002. </li>
  2003. </ul>
  2004. <?php elseif ( get_option('users_can_register') ) : ?>
  2005. <h2><p style="text-align: center;">মেম্বার লগিন প্যানেল/Login panel</p></h2>
  2006. <hr/>
  2007. <ul>
  2008. <form action="<?php bloginfo('url') ?>/wp-login.php" method="post">
  2009. <p>
  2010. <label for="log"><input type="text" name="log" id="log" value="<?php echo wp_specialchars(stripslashes($user_login), 1) ?>" size="25" /> <br/>ইউজার নেম দিন/Username</label><br /><br/>
  2011. <label for="pwd"><input type="password" name="pwd" id="pwd" size="25" /><br />
  2012. পাসওয়ার্ড দিন/Password</label><br/><br/>
  2013. <input type="submit" name="submit" value="লগিন/Login" />
  2014. <label for="rememberme"><input name="rememberme" id="rememberme" type="checkbox" checked="checked" value="forever" />আমাকে মনে রাখুন/Remember Password</label><br />
  2015. </p>
  2016. <input type="hidden" name="redirect_to" value="<?php echo $_SERVER['REQUEST_URI']; ?>"/>
  2017. </form>
  2018. </li>
  2019.  
  2020. <hr/>
  2021.  
  2022. <a href="<?php bloginfo('url') ?>/wp-login.php?action=register">Registration/রেজিস্ট্রেশন</a>
  2023.  
  2024. <br/>
  2025.  
  2026. <a href="<?php bloginfo('url') ?>/wp-login.php?action=lostpassword">Reset Password/পাসওয়ার্ড পুনরুদ্ধার</a>
  2027. </ul>
  2028. <?php endif // get_option('users_can_register') ?>
  2029.  
  2030.  
  2031.  
  2032.  
  2033. ==============================================
  2034. আপনার ওয়ার্ডপ্রেস ড্যাশবোর্ড প্যানেল থেকে theme editor lock করে দিন কোড দিয়ে
  2035. ==============================================
  2036. add_action('admin_init', 'cwc_lock_theme');
  2037. function cwc_lock_theme() {
  2038. global $submenu, $userdata;
  2039. get_currentuserinfo();
  2040. if ($userdata->ID != 1) {
  2041. unset($submenu['themes.php'][5]);
  2042. unset($submenu['themes.php'][15]);
  2043. }
  2044. }
  2045.  
  2046. ==============================================
  2047. আপনার ওয়ার্ডপ্রেস সাইট এ কোন শব্দ কে অন্য শব্দ দিয়ে পরিবর্তন করুন
  2048. ==============================================
  2049. হ্যালো, বন্ধুরা কেমন আছ। আবারো হাজির হলাম আপনাদের সামনে। আজকে ছোট একটা কোড নিয়ে আলোচনা করবো। আমরা যখন আমাদের ওয়ার্ডপ্রেস সাইট এ বাংলা ইন্সটল করি তখন অনেক শব্দের বাংলা অর্থ এমন যে শুনতে কেমন লাগে। যেমন Dashboard এর মানে দেখায় খেরখাতা। তাই আপনি চাইলে কিছু ওয়ার্ড এর মানে আপনি কোড দিয়ে Replace করতে পারেন। এর জন্য নিছের কোড গুলো আপনার থিমের functions.php ফাইলে অ্যাড করে দিন।
  2050.  
  2051. add_filter('gettext', 'rename_admin_menu_items');
  2052. add_filter('ngettext', 'rename_admin_menu_items');
  2053. function rename_admin_menu_items($menu) {
  2054. $menu = str_ireplace('Dashboard', 'প্রথম পাতা', $menu);
  2055. $menu = str_ireplace('Media', 'ছবিসমুহ', $menu);
  2056. $menu = str_ireplace('Comments', 'মন্তব্যসমুহ', $menu);
  2057. return $menu;
  2058. }
  2059. এখানে আমি কিছু উদাহরন দিলাম।
  2060. $menu = str_ireplace('Media', 'ছবিসমুহ', $menu);
  2061.  
  2062. উপরের লাইন এ খেয়াল করুন। এখানে মনে করেন আপনি Media কে পরিবর্তন করবেন এখন উপরের Media এর পরিবরতে যে শব্দ ব্যবহার করতে চান সেটি ছবিসমুহ এর জায়গায় বসিয়ে দিন দেখবেন আপনার সাইট যত Media লেখা আছে সব পরিবর্তন হয়ে গেছে। এভাবে আপনার যত খুশি শব্দ অ্যাড করতে পারেন। আমি শুধু কয়েকটি শব্দ দিয়েছি দেখানোর জন্য।
  2063.  
  2064.  
  2065.  
  2066. ==============================================
  2067. যেকোনো পোস্ট এ অ্যাড করুন লেখকের আভাটার
  2068. ==============================================
  2069. <?php echo get_avatar( get_the_author_email(), '20' ); ?>
  2070.  
  2071.  
  2072. ==============================================
  2073. আপনার ওয়েবসাইট এ ডিফল্ট Avatar পরিবর্তন করুন কোড দিয়ে
  2074. ==============================================
  2075. ওয়ার্ডপ্রেস সাইট এ ওয়ার্ডপ্রেস এর দেয়া অনেক গুলো ডিফল্ট Avatar থাকে। আমরা যারা ওয়ার্ডপ্রেস দিয়ে সাইট বানাই তাদের অনেক সময় Branding এর কারনে এই ডিফল্ট Avatar পরিবর্তন করতে হয়। অনেকে এটা plugin দিয়ে করে তবে জে কাজ সামান্য কোড দিয়ে হয় সেটার জন্য কেন plugin ব্যবহার করতে যাবো। কাজতা খুবই সজা । সুধু নিছের কোড টুকু কপি করে আপনার ওয়ার্ডপ্রেস সাইট এর theme এর functions.php file এর আকদম নিছে paste করে দিন। আর আপনার সাইট এর theme এর ইমেজ directory তে যে ইমেজটা ব্যবহার করতে চান সেটা rename করে avatar.png format এ নিয়ে upload করে দিন ব্যাস কাজ শেষ। দেখবেন ডিফল্ট ইমেজ পরিবর্তন হয়ে গেছে।
  2076.  
  2077. add_filter( 'avatar_defaults', 'crunchifygravatar' );
  2078. function crunchifygravatar ($avatar_defaults) {
  2079. $myavatar = get_bloginfo('template_directory') . '/images/avatar.png';
  2080. $avatar_defaults[$myavatar] = "Anytech Man";
  2081. return $avatar_defaults;}
  2082.  
  2083.  
  2084.  
  2085. ==============================================
  2086. techtunes এর মতো টপ অথর শো করাতে চান? তাহলে নিয়ে নিন কোড
  2087. ==============================================
  2088. <?php
  2089. global $wpdb;
  2090. $top_authors = $wpdb->get_results("
  2091. SELECT u.ID, count(post_author) as posts FROM {$wpdb->posts} as p
  2092. LEFT JOIN {$wpdb->users} as u ON p.post_author = u.ID
  2093. WHERE p.post_status = 'publish'
  2094. AND p.post_type = 'post'
  2095. GROUP by p.post_author
  2096. ORDER by posts DESC
  2097. LIMIT 0,10
  2098. ");
  2099.  
  2100. if( !empty( $top_authors ) ) {
  2101. echo '<ul>';
  2102. foreach( $top_authors as $key => $author ) {
  2103. echo '
  2104. <li>
  2105. <div class="topauthor-info"><div class="topauthor-avatar">
  2106. ' . get_avatar( $author->ID , 40) . '</div>
  2107. <div class="topauthor-description"><a href="' . get_author_posts_url( $author->ID ) . '">' . get_the_author_meta( 'nickname' , $author->ID ) . '</a>
  2108. <br />» পোস্ট  '. $author->posts .'  টি
  2109. </div></div></li>
  2110. ';
  2111. }
  2112. echo '</ul>';
  2113. }
  2114. ?>
  2115.  
  2116. এবার নিছের CSS কোড গুলো আপনার থিম এর CSS ফাইল বা style.css এ যোগ করে দিন।
  2117.  
  2118. .topauthor-info {background: none repeat scroll 0 0 #FFFFFF;overflow: hidden;padding: 0px;}
  2119. .topauthor-avatar {background: none repeat scroll 0 0 #FAFAFA;float: left;margin-right: 10px;padding: 0px;}
  2120. .topauthor-description {float: left;max-width: 86%;font-size:14px;}
  2121.  
  2122. ==============================================
  2123. আপনি চাইলে আপনার ওয়েবসাইট এর সব ট্যাগ কোড দিয়েও শো করতে পারেন
  2124. ==============================================
  2125. <?php if ( function_exists('wp_tag_cloud') ) : ?>
  2126. <h4>Popular Tags</h4>
  2127. <ul>
  2128. <li><?php wp_tag_cloud('smallest=8&largest=22'); ?></li>
  2129. </ul>
  2130. <?php endif; ?>
  2131.  
  2132. ==============================================
  2133. আপনার ওয়েবসাইট এ Forced to logout এর টাইম সেট করে দিন কোড দিয়ে
  2134. ==============================================
  2135. আপনার ওয়ার্ডপ্রেস সাইট এ যারা লগিন করবে এমন কি এডমিন সহ সবাইকে যদি আপনি চান যে একটা নির্দিষ্ট সমই পর অটোমেটিক logout হয়ে যাবে তাহলে একটা ছোট কাজকরে এটি করতে পারেন। এটি অবশ্য প্লাগিন দিয়েও করতে পারেন তবে যদি চান কোড দিয়ে করবেন তাহলে নিছের কোড টুকু কপি করে আপনার থিম এর functions.php ফাইল এর শেষে যোগ করে দিন। এখানে return 7200 এই লাইন এ ৭২০০ এর জাইগাই আপনি যে টাইম দিতে চান তা seconds এ কনভার্ট করে বসিএ দিন। এখানে ৭২০০ seconds মানে দুই ঘণ্টা দেয়া আছে।
  2136.  
  2137. </p>
  2138. function logged_in( $expirein ) {
  2139. return 7200; // 2 hours in seconds
  2140. }
  2141. add_filter( 'auth_cookie_expiration', 'logged_in' );
  2142.  
  2143. ==============================================
  2144. আপনার ওয়ার্ডপ্রেস সাইট এর favicon পরিবর্তন করুন কোড দিয়ে
  2145. ==============================================
  2146. নিছের কোডটুকু কপি করে আপনার থিম এর functions.php ফাইল এর নিছে অ্যাড করে দিন। সুধু http://anytech.arzonebd.com/wp-content/anytech.gif এর জাইগায় আপনার ইমেজ এর লিঙ্ক দিন দেখবেন কাজ হয়ে গেছে। তবে ফাইল সাইজ 16*16 রাখবেন।
  2147.  
  2148. function my_favicon() { ?>
  2149. <link rel="shortcut icon" href="http://anytech.arzonebd.com/wp-content/anytech.gif" >
  2150. <?php }
  2151. add_action('wp_head', 'my_favicon');
  2152.  
  2153. ==============================================
  2154. লগিন পেজের হেডার এর url এবং Powered by টেক্সট পরিবর্তন করুন কোড দিয়ে
  2155. ==============================================
  2156. আমরা যখন কোন ওয়ার্ডপ্রেস সাইট এর লগিন পেজ এ যাই তখন ওখানে যে লোগো থাকে সেখানে মাউস রাখলে একটা লিঙ্ক মানে হল http://wordpress.org এবং Powered by WordPress শো করে। আপনি যদি চান যে এখানে আপনার সাইট এর লিঙ্ক এবং নাম এর যায়গায় সাইট এর নাম দেখাবেন তাহলে এদিকে আসুন। নিছের কোড গুলো আপনার সাইট এর থিম এর functions.php তে পেস্ট করুন।
  2157.  
  2158. function anytech_login_header_url(){
  2159. return "http://www.kingrussel.com";
  2160. } add_action('login_headerurl', 'anytech_login_header_url');
  2161. function anytech_login_header_link_title(){
  2162. return "Powered By King Russel";
  2163. } add_action('login_headertitle', 'anytech_login_header_link_title');
  2164.  
  2165.  
  2166.  
  2167. ==============================================
  2168. Dashboard এর favicon change করে নিন একেবারে সহজে
  2169. ==============================================
  2170. নিছের কোড টুকু আপনারথিম এর functions.php ফাইল এর নিছে অ্যাড করে দিন। সুধু  http://www.anytech.arzonebd.com/favicon.png   এর জাইগায় আপনার ইমেজ এর লিঙ্ক দিন দেখবেন কাজ হয়ে গেছে। তবে ফাইল সাইজ 16*16 রাখবেন।
  2171.  
  2172. function fidafavicon() {
  2173. echo '<link rel="Shortcut Icon" type="image/x-icon" href="http://www.anytech.arzonebd.com/favicon.png" />';
  2174. }
  2175. add_action( 'admin_head', 'fidafavicon' );
  2176.  
  2177. ==============================================
  2178. wp-logo remove করুন কোড দিয়ে।
  2179. ==============================================
  2180. নিছের কোড টুকু কপি করে আপনার থিম এর functions.php তে অ্যাড করে দেন ব্যাস কাজ ওকে।
  2181.  
  2182. add_action('wp_before_admin_bar_render', 'annointed_admin_bar_remove', 0);
  2183. function annointed_admin_bar_remove() {
  2184. global $wp_admin_bar;
  2185.  
  2186. /* Remove their stuff */
  2187. $wp_admin_bar->remove_menu('wp-logo');
  2188. }
  2189.  
  2190.  
  2191. ==============================================
  2192. QUERY CODE FOR RELATED POST WITH AND WITHOUT THUMBNAIL
  2193. ==============================================
  2194. <?php $orig_post = $post;
  2195.     global $post;
  2196.     $categories = get_the_category($post->ID);
  2197.     if ($categories) {
  2198.     $category_ids = array();
  2199.     foreach($categories as $individual_category) $category_ids[] = $individual_category->term_id;
  2200.  
  2201.     $args=array(
  2202.     'category__in' => $category_ids,
  2203.     'post__not_in' => array($post->ID),
  2204.     'posts_per_page'=> 6, // Number of related posts that will be shown.
  2205.     'caller_get_posts'=>1
  2206.     );
  2207.  
  2208.     $my_query = new wp_query( $args );
  2209.     if( $my_query->have_posts() ) {
  2210.     echo '<div class="single_coment_all">';
  2211.     while( $my_query->have_posts() ) {
  2212.     $my_query->the_post();?>
  2213.     <div class="single_coment floatleft fix">
  2214.         <div class="relatedthumb_img">
  2215.             <a href="<?php the_permalink()?>" rel="bookmark" title="<?php the_title(); ?>">
  2216.                 <?php the_post_thumbnail('related_image'); ?>
  2217.             </a>
  2218.         </div>
  2219.         <div class="comments_caption">
  2220.             <div class="comments_caption_left">
  2221.                 <p><?php the_category(', '); ?></p>
  2222.             </div>
  2223.             <div class="comments_caption_right">
  2224.                 <a href="<?php the_permalink(); ?>"><h2><?php the_title(); ?></h2></a>
  2225.             </div>
  2226.         </div>
  2227.     </div>
  2228.     <?php
  2229.     }
  2230.     echo '</div>';
  2231.     }
  2232.     }
  2233.     $post = $orig_post;
  2234.     wp_reset_query(); ?>
  2235.  
  2236. =============================================
  2237. কোন একটা নির্দিষ্ট ক্যাটেগরির পপুলার পোস্ট শো করুন লিস্ট আকারে
  2238. =============================================  
  2239. <?php
  2240.  
  2241. $args=array(
  2242. 'cat' => 58, // this is category ID
  2243. 'orderby' => 'comment_count',
  2244. 'order' => 'DESC',
  2245. 'post_type' => 'post',
  2246. 'post_status' => 'publish',
  2247. 'posts_per_page' => 6, // how much post you want to display
  2248. 'caller_get_posts'=> 1
  2249. );
  2250.  
  2251. $my_query = null;
  2252. $my_query = new WP_Query($args);
  2253. if( $my_query->have_posts() ) { ?>
  2254.  
  2255. <ul>
  2256. <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
  2257.  
  2258. <li><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>
  2259.  
  2260. <?php  endwhile; ?>
  2261. </ul>
  2262. <?php }
  2263.  
  2264. wp_reset_query(); ?>
  2265.  
  2266. ==============================================
  2267. copy , paste , cut বাটান এড করুন Visual Editor এ
  2268. ==============================================
  2269. function enable_more_buttons($buttons) {
  2270.  $buttons[] = 'copy';
  2271.  $buttons[] = 'cut';
  2272.  $buttons[] = 'paste';
  2273.  return $buttons;
  2274.  }
  2275.  add_filter("mce_buttons_2", "enable_more_buttons");   
  2276.  
  2277. ==============================================
  2278.  পোস্টের মেটা ডিসক্রিপশন অটোমেটিক যোগ করাঃ
  2279. ==============================================
  2280. function create_meta_desc() {
  2281. global $post;
  2282. if (!is_single()) { return; }
  2283. $meta = strip_tags($post->post_content);
  2284. $meta = strip_shortcodes($post->post_content);
  2285. $meta = str_replace(array(“\n”, “\r”, “\t”), ‘ ‘, $meta);
  2286. $meta = substr($meta, 0, 125);
  2287. echo “<meta name=’description’ content=’$meta’ />”;
  2288. }
  2289. add_action(‘wp_head’, ‘create_meta_desc’);
  2290.  
  2291. ==============================================
  2292. লেফ্ট সাইড এর wordpress text টা পরিবর্র্তন করার জন্য নিচের Function টা এড করে দিন । text এ আপনার ইচ্ছা মত  পরিবর্র্তন করে নিন ।
  2293. ==============================================
  2294. function remove_footer_admin () {
  2295. echo 'Thank You For Creating By <a href="http://kingrussel.com">King Russel</a>';
  2296. }
  2297. add_filter('admin_footer_text', 'remove_footer_admin');
  2298.  
  2299.  
  2300. ==============================================
  2301. page k login and logout option onojayi set korben
  2302. ==============================================
  2303. <?php if (is_user_logged_in() ): ?>
  2304.     <a href="<?php echo wp_logout_url() ?>" title="Logout">Logout</a>
  2305. <?php else: ?>
  2306.         <a href="http://example.com/wp-login.php" title="Logout">Member Login</a>
  2307. <?php endif ?>
  2308.  
  2309. ==============================================
  2310. আপনার সাইট এর সব লেখককে একসাথে দেখানড্র পডাউন মেনু হিসেবে
  2311. ==============================================
  2312. <li id="users">
  2313.  <h2><?php _e('users:'); ?></h2>
  2314.    <form action="<?php bloginfo('url'); ?>" method="get">
  2315.    <?php
  2316.      $args = array(
  2317.      'exclude'                 => '1',
  2318.      'name'                    => 'authors',
  2319.      'who'                     => 'authors'
  2320.     );
  2321.     wp_dropdown_users($args);
  2322.    ?>
  2323.    <input type="submit" name="submit" value="view" />
  2324.    </form>
  2325. </li>
  2326.    
  2327. ==============================================
  2328. query code for Fraction Slider
  2329. ==============================================
  2330. <?php while ( have_posts() ) : the_post(); ?>
  2331.  
  2332. <?php
  2333.  
  2334. global $post;
  2335. $images = get_post_meta( $post->ID, '_wpb_sub_image', true );
  2336.  
  2337. foreach ($images as $img){
  2338. echo "<div class='col-md-2 single_img'><a class='grouped_elements' rel='group1' href='$img'><img class='img-responsive' src='$img' alt='' /></a></div> ";
  2339. }
  2340.  
  2341. ?>
  2342.  
  2343. <?php endwhile; // end of the loop. ?>
  2344.    
  2345. ==============================================
  2346. query code for display post from each category
  2347. ==============================================
  2348. <?php
  2349.   // array of category IDs
  2350.   $categories =  array(10,9,8,7,6,5,4,3,2,1);
  2351.  
  2352.   foreach ($categories as $cat) :
  2353.     $post = false;
  2354.     $post = get_posts('cat='.$cat.'&posts_per_page=1');
  2355.     if($post) :
  2356.       $post = $post[0];
  2357.       setup_postdata($post); ?>
  2358.     // Your content for loop
  2359.  
  2360.     <?php endif; ?>
  2361.   <?php endforeach; ?>
  2362.  
  2363.  
  2364. ====================================================
  2365. Here’s how to create a custom post template for a specific category:
  2366. ====================================================
  2367.  
  2368.  
  2369. function get_custom_cat_template($single_template) {
  2370.      global $post;
  2371.  
  2372.        if ( in_category( 'category-name' )) {
  2373.           $single_template = dirname( __FILE__ ) . '/single-template.php';
  2374.      }
  2375.      return $single_template;
  2376. }
  2377.  
  2378. add_filter( "single_template", "get_custom_cat_template" ) ;
  2379.  
  2380.  
  2381.  
  2382. What you have to do is just copy and paste this code in your functions.php file and don’t forget to change ‘category-name’ to the name of the category you are aiming and, of course, change ‘/single-template.php’ to your post template file for this category.
  2383.  
  2384. And here’s another snippet, if you need to create a custom post template for a specific custom post type:
  2385.  
  2386.  
  2387.  
  2388. function get_custom_post_type_template($single_template) {
  2389.      global $post;
  2390.  
  2391.        if ($post->post_type == 'custom-post-type') {
  2392.           $single_template = dirname( __FILE__ ) . '/single-template.php';
  2393.      }
  2394.      return $single_template;
  2395. }
  2396.  
  2397. add_filter( "single_template", "get_custom_post_type_template" ) ;
  2398.  
  2399.  
  2400. What you have to do is again copy and paste it in your functions.php file and change ‘custom-post-type’ and ‘/single-template.php’ to whatever works fine for you.
  2401.  
  2402.  
  2403. ==============================================
  2404. How to disable theme and plugin editor from WordPress dashboard?
  2405. ==============================================
  2406. //Remove theme and plugin editor links
  2407. function ccw_hide_editor()
  2408. {
  2409.     remove_submenu_page('themes.php','theme-editor.php');
  2410.     remove_submenu_page('plugins.php','plugin-editor.php');
  2411. }
  2412. add_action('admin_init','ccw_hide_editor');
  2413.  
  2414. The Problem with above code is that, it does not disable the editor but remove the link from dashboard. The editor can still be used by accessing link from URL in browser.
  2415. To completely disable the editor from WordPress dashboard copy the following code and paste it inside wp-config.php file located in root folder of WordPress installation.
  2416.  
  2417.  
  2418. //Disable theme and plugin editor
  2419. define( 'DISALLOW_FILE_EDIT', true );
  2420.  
  2421.  
  2422. ==============================================
  2423.     //code for logo in middle of menu  
  2424. ==============================================
  2425.  
  2426. paste this code in main.js
  2427. -----------------------------------
  2428. jQuery( document ).ready(function() {
  2429. var menu = parseInt(jQuery('.main-menu li').length/2);
  2430. var structure = [
  2431. '<li>',
  2432. '<a href="index.php"><span class="center-logo"></span></a>',
  2433. '</li>' ];
  2434. jQuery(structure.join('')).insertAfter( jQuery('.main-menu li').eq(menu - 1) );
  2435. });
  2436.  
  2437. paste this code in  header.php  
  2438. -----------------------------------
  2439. <ul class="main-menu">
  2440. <li><a href="#">Home</a></li>
  2441. <li><a href="#">About</a></li>
  2442. <li><a href="#">Service</a></li>
  2443. <li><a href="#">Contuct</a></li>
  2444. </ul>
  2445.  
  2446. ===============================================
  2447. Code for increase media upload limitation paste in htaccess file
  2448. ===============================================
  2449.  
  2450. php_value upload_max_filesize 20M
  2451. php_value post_max_size 20M
  2452. php_value max_execution_time 200
  2453. php_value max_input_time 200
  2454.  
  2455. ============================================
  2456. code for login form create in template
  2457. ===============================================
  2458. <?php
  2459. if ( ! is_user_logged_in() ) { // Display WordPress login form:
  2460.     $args = array(
  2461.         'redirect' => admin_url(),
  2462.         'form_id' => 'loginform-custom',
  2463.         'label_username' => __( 'Username custom text' ),
  2464.         'label_password' => __( 'Password custom text' ),
  2465.         'label_remember' => __( 'Remember Me custom text' ),
  2466.         'label_log_in' => __( 'Log In custom text' ),
  2467.         'remember' => true
  2468.     );
  2469.     wp_login_form( $args );
  2470. } else { // If logged in:
  2471.     wp_loginout( home_url() ); // Display "Log Out" link.
  2472.     echo " | ";
  2473.     wp_register('', ''); // Display "Site Admin" link.
  2474. }
  2475. ?>
  2476.  
  2477.  
  2478. ==========================================
  2479.     code for contact form 7 redirect link
  2480. ==========================================
  2481. on_sent_ok: "location.replace('http://www.kingrussel.com');"
  2482.             or
  2483. on_sent_ok: "location = 'http://example.com/';"
  2484.  
  2485. contact form 7 auto br remove code should be place in wp config file.
  2486. ------------------------------------------
  2487. define('WPCF7_AUTOP', false);
  2488.  
  2489.  
  2490. ==================================================
  2491.         bootstrap carousel query code
  2492. ==================================================
  2493.   <!-- Carousel-->
  2494. <?php
  2495. $items = new WP_Query(array(
  2496. 'post_type' => 'banner-items',
  2497. 'posts_per_page' => -1,
  2498. 'meta_key' => '_thumbnail_id'
  2499. ));
  2500. $count = $items->found_posts;
  2501. ?> 
  2502.    
  2503.   <div id="myCarousel" class="carousel slide" data-ride="carousel">
  2504.       <!-- Indicators -->
  2505.     <ol class="carousel-indicators">
  2506.       <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
  2507.       <?php for($num = 1; $num < $count; $num++){ ?>
  2508.       <li data-target="#myCarousel" data-slide-to="<?php echo $num; ?>"></li>
  2509.       <?php } ?>
  2510.     </ol>
  2511.  
  2512.     <div class="carousel-inner">
  2513. <?php
  2514.         $ctr = 0;
  2515.         while ( $items->have_posts() ) :
  2516.           $items->the_post();
  2517.           $url = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );
  2518.           $custom = get_post_custom($post->ID);
  2519.           $link = $custom["more-link"][0];
  2520.           $class = $ctr == 0 ? ' active' : '';
  2521.         ?>
  2522.    
  2523.         <div class="item<?php echo $class; ?>" id="<? the_ID(); ?>">
  2524.             <img src="<?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), '' ); echo $image[0]; ?>">
  2525.             <div class="container">
  2526.               <?php the_content(); ?>
  2527.             </div>
  2528.         </div>
  2529.     <?php $ctr++;
  2530.         endwhile;  ?>
  2531.      
  2532.      
  2533.     </div>
  2534.     <!-- /.carousel-inner -->
  2535.    
  2536.     <!-- Controls -->
  2537.     <a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev"> <span class="fa fa-angle-left fa-5x"></span> </a>
  2538.     <a class="right carousel-control" href="#myCarousel" role="button" data-slide="next"> <span class="fa fa-angle-right fa-5x"></span> </a>
  2539.    
  2540.     </div>
  2541.   <!-- /.carousel -->
  2542.  
  2543.  
  2544. ==================================================
  2545.     function er maddome file call korar niyom
  2546. ==================================================
  2547. function vaious_theme_file(){
  2548.  
  2549.  global $wp_styles;
  2550.  
  2551.  /*
  2552.   * Adds JavaScript to pages with the comment form to support
  2553.   * sites with threaded comments (when in use).
  2554.   */
  2555.  if ( is_singular() && comments_open() && get_option( 'thread_comments' ) )
  2556.   wp_enqueue_script( 'comment-reply' );
  2557.    
  2558.     /* Registering styles */
  2559.     wp_register_style( 'bootstrap', get_template_directory_uri() . '/css/bootstrap.min.css', array(), '1', 'all' );
  2560.     wp_register_style( 'bootstrap-theme', get_template_directory_uri() . '/css/bootstrap-theme.min.css', array(), '1', 'all' );
  2561.     wp_register_style( 'prettyPhoto', get_template_directory_uri() . '/css/prettyPhoto.min.css', array(), '1', 'all' );
  2562.     wp_register_style( 'responsive', get_template_directory_uri() . '/css/responsive.css', array(), '1', 'all' );
  2563.  
  2564. /*Enqueue styles */
  2565.     wp_enqueue_style( 'bootstrap', get_stylesheet_uri(), array(), '1', 'all' );
  2566.     wp_enqueue_style( 'bootstrap-theme', get_stylesheet_uri(), array(), '1', 'all' );
  2567.     wp_enqueue_style( 'prettyPhoto', get_stylesheet_uri(), array(), '1', 'all' );
  2568.     wp_enqueue_style( 'responsive', get_stylesheet_uri(), array(), '1', 'all' );
  2569.      
  2570.     //Loads our main stylesheet
  2571.     wp_enqueue_style( 'various-main-style', get_stylesheet_uri() );
  2572.    
  2573.     //Loads all javascript files
  2574.    
  2575.      wp_enqueue_script( 'jquery-masonry', array( 'jquery' ) );
  2576.      wp_enqueue_script( 'v-mixitup', get_template_directory_uri() . '/js/jquery.mixitup.min.js', array('jquery'), '1.0', true );
  2577.      wp_enqueue_script( 'v-prettyPhoto', get_template_directory_uri() . '/js/jquery.prettyPhoto.min.js', array('jquery'), '1.0', true );
  2578.      wp_enqueue_script( 'v-jflickrfeed', get_template_directory_uri() . '/js/jflickrfeed.min.js', array('jquery'), '1.0', true );
  2579.      wp_enqueue_script( 'v-jribbble', get_template_directory_uri() . '/js/jquery.jribbble-1.0.1.min.js', array('jquery'), '1.0', true );
  2580.      wp_enqueue_script( 'v-bootstrap', get_template_directory_uri() . '/js/bootstrap.min.js', array('jquery'), '1.0', true );
  2581.      wp_enqueue_script( 'v-main', get_template_directory_uri() . '/js/main.js', array('jquery'), '1.0', true );
  2582.    
  2583.    
  2584. }
  2585. add_action('wp_enqueue_scripts', 'vaious_theme_file');
  2586.  
  2587. =======================================================
  2588. bxslider.com/examples/thumbnail-pager-1   dynamic code by custom post
  2589. =======================================================
  2590. <div id="slider" class="row" style="padding:0; position:relative">
  2591.     <ul class="bxslider" >
  2592.         <?php  $args = array(
  2593.             'post_type' => 'slider',
  2594.             'posts_per_page' => 4,
  2595.             'order' => 'DESC',
  2596.             'orderby' => 'date'
  2597.         );?>
  2598.  
  2599.         <?php $slider = new WP_Query($args); while($slider->have_posts()) : $slider->the_post(); ?>
  2600.       <li>
  2601.         <?php the_post_thumbnail('slider'); ?>
  2602.         <div class="col-md-7 hidden-sm hidden-xs" style="padding:0">
  2603.             <div class="titulo">
  2604.                 <h3><?php the_title(); ?></h3>
  2605.             </div>
  2606.         </div>
  2607.       </li>
  2608.  
  2609.     <?php endwhile; wp_reset_postdata(); ?>
  2610.     </ul>
  2611.  
  2612.     <div class="container navegador hidden-sm hidden-xs">
  2613.         <div class="row">
  2614.             <div class="col-md-5 col-md-offset-7 text-right" style="padding:0;" >
  2615.                 <div id="bx-pager">
  2616.                     <?php  $args = array(
  2617.                         'post_type' => 'slider',
  2618.                         'posts_per_page' => 4,
  2619.                         'order' => 'DESC',
  2620.                         'orderby' => 'date'
  2621.                     );?>
  2622.                     <?php $numero = 0; ?>
  2623.                         <?php $slider = new WP_Query($args); while($slider->have_posts()) : $slider->the_post(); ?>
  2624.                             <a data-slide-index="<?php echo $numero; ?>" href=""><?php the_post_thumbnail('thumbnailSlider'); ?></a>
  2625.                         <?php $numero++; ?>
  2626.                     <?php endwhile; wp_reset_postdata(); ?>
  2627.                 </div>
  2628.             </div>
  2629.         </div>
  2630.     </div>
  2631.  
  2632.     <div class="clearfix"></div>
  2633.  
  2634. </div> <!--/#slider -->
  2635.  
  2636. =======================================================
  2637. bxslider.com/examples/thumbnail-pager-1   dynamic code by Metabox slider
  2638. =======================================================
  2639. <div class="portfolio_single_wrapper fix">
  2640.                
  2641.                 <?php
  2642.                 $spyr_demo_slider = get_post_meta( $post->ID, 'spyr_demo_slider', true );
  2643.                
  2644.                 echo '<div id="portfolio_single_slider" class="fix">';
  2645.                 foreach( $spyr_demo_slider as $slide ) {
  2646.                            
  2647.                             echo '<div class="portfolio_single_item fix">
  2648.                             <img src="'. $slide['image'] .'" alt="" />
  2649.                             </div>';
  2650.                 }
  2651.                 echo '</div>';
  2652.  
  2653.                 ?>
  2654.                
  2655.                
  2656.             <?php
  2657.                 $spyr_demo_slider = get_post_meta( $post->ID, 'spyr_demo_slider', true );
  2658.                 $numero = 0;
  2659.                
  2660.                 echo '<div id="portfolio_single_pager" class="fix">';
  2661.                 foreach( $spyr_demo_slider as $slide ) {
  2662.                    
  2663.                            
  2664.                             echo '<a data-slide-index="'.$numero.'" class="pager" href=""><img src="'. $slide['image'] .'" alt="" /></a>';
  2665.                     $numero++;
  2666.                 }
  2667.                
  2668.                 echo '</div>';
  2669.                
  2670.                 ?>
  2671.                 <div class="portfolio_single_content fix">
  2672.                     <h2><?php the_title(); ?></h2>
  2673.                     <?php the_content(); ?>
  2674.                 </div>
  2675.             </div>
  2676.             <!-- Portfolio Single Page Content End There -->
  2677. ==========================================
  2678.         /* Wordpress Common Style */
  2679.         ============================
  2680.        
  2681. /* code for dropdown */
  2682.  
  2683. .menu-item-has-children{position:relative;}
  2684. .menu-item-has-children:hover{display:block;}
  2685. #menu-menu-1 > .menu-item-has-children:hover > a{background:#ffd71f;color:#181f2a;}
  2686. #menu-menu-1 > .menu-item-has-children > ul.sub-menu{background: none repeat scroll 0 0 #ffd71f;
  2687. left:999999px;position: absolute;top: 100%;width: 180px;z-index: 999;}
  2688. #menu-menu-1 > .menu-item-has-children:last-child > ul.sub-menu{right:999999px;left:inherit;}
  2689. #menu-menu-1 > li.menu-item-has-children:hover ul.sub-menu{display: block;left: 0;left:inherit;}
  2690. #menu-menu-1 > li.menu-item-has-children:last-child:hover ul.sub-menu{display: block;right: 0;}
  2691. .menu-item-has-children > ul > li{display: block;margin: 0;text-align: left;width: 100%;}
  2692. .menu-item-has-children:last-child > ul > li{text-align:right;}
  2693. .menu-item-has-children > ul > li > a{border: 0 none !important;font-size: 13px;border-radius:0px !important;padding: 10px 15px;display:block !important;color:#181f2a;}
  2694. #menu-menu-1 > .menu-item-has-children > ul > li > a:hover{border:0px;background:#171F2C !important;border-radius:0px;color:#fff;}
  2695.        
  2696. /* Style for Index PHP  & Page.php */
  2697. .blog_content{margin: 20px 0; overflow: hidden;width: 100%;}
  2698. .page_blog_post{}
  2699. .single_blog_post{}
  2700. .single_blog_post h2{padding: 10px 0;color: #000;font-size: 22px;margin-bottom: 0;text-align: center;}
  2701.  
  2702.  
  2703. /* 404 style code */
  2704. .error_message { overflow: hidden; padding: 30px }
  2705. .four_zero_four { font-size: 50px; text-align: center }
  2706. .four_zero_four span { display: block; font-size: 200px; line-height: 190px }
  2707.  
  2708. /* style for archieve */
  2709. .latest_frm_cat_title { border-bottom: 3px solid #cf0000; font-size: 20px; line-height: 25px; margin-left: 10px }
  2710. .archive_title {font-size: 31px;margin-bottom: 45px;margin-left: 0px;padding: 15px 0;text-align: center}
  2711. .archive_not_found {-moz-box-shadow: 1px 3px 9px;-webkit-box-shadow: 1px 3px 9px;box-shadow: 1px 3px 9px;font-size: 100px;padding: 10px 0 20px;text-align: center}
  2712. .archive_not_found h3 {font-family: italic}
  2713. .archive_page{padding: 0px 25px}
  2714. .archive_content{border: 1px solid #ddd;margin-bottom: 20px;padding: 15px;min-height: 164px;}
  2715. .archive_content h2{}
  2716. .archive_content p{}
  2717. .archive_content a{color: #CF0000;
  2718. font-weight: bold;
  2719. text-transform: uppercase;
  2720. float: right;
  2721. border-bottom: 1px solid #CF0000;
  2722. margin-top: 5px;}
  2723. .archive_img{float: left;
  2724. width: 20%;
  2725. margin-right: 1%;}
  2726.  
  2727. /* style for search php */
  2728. h2.latest_frm_cat_title span {color: red}
  2729. .single_search {border: 1px solid #ddd;margin-bottom: 20px;padding: 15px }
  2730. .single_footer ul li a.popular_link_img{float: left;margin-right: 3%;width: 27%;}
  2731. .single_footer ul li a.popular_link_img img{width:100%;height:80px;}
  2732. .single_footer ul li a.popular_link{float:right;width: 70%;}
  2733. .archive_not_found {-moz-box-shadow: 1px 3px 9px;-webkit-box-shadow: 1px 3px 9px;box-shadow: 1px 3px 9px;font-size: 100px;padding: 10px 0 20px;text-align: center}
  2734. .archive_title {font-size: 31px;margin-bottom: 45px;margin-left: 0px;padding: 15px 0;text-align: center}
  2735.  
  2736.  
  2737.  
  2738.  
  2739.  
  2740.  
  2741. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement