azad_rpi

Important Codes

May 28th, 2014
367
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 39.25 KB | None | 0 0
  1. <------ For Supporting To wordpeess Server------>
  2. /*
  3. Theme Name:
  4. Description: Wordpress theme
  5. Theme URI: http://www.azadbd.com
  6. Version:1.0
  7. Author URI: http://www.azadbd.com
  8. Author: Alberuni Azad.
  9. */
  10. <--------------------------------------------->
  11.  
  12.  
  13. /*------ For declearing HTML 4.01 version------*/
  14. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  15. /**---------------------------------------------**/
  16.  
  17.  
  18. /*------ For declearing HTML 4.01 version------*/
  19. <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes('xhtml'); ?>>
  20. /**---------------------------------------------**/
  21.  
  22. /*------ For declearing title in head section------*/
  23. <title><?php bloginfo('name'); ?> <?php wp_title(); ?></title>
  24. /**---------------------------------------------**/
  25.  
  26. /*------ For declearing meta in head section------*/
  27. <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
  28. /**---------------------------------------------**/
  29.  
  30.  
  31. /*------ For declearing pingback------*/
  32. <link rel="profile" href="http://gmpg.org/xfn/11" />
  33. <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
  34. /**---------------------------------------------**/
  35.  
  36.  
  37. /*------ For bring header script (off course)------*/
  38. <?php wp_head(); ?>
  39. <?php wp_footer(); ?>
  40. /**---------------------------------------------**/
  41.  
  42.  
  43. /*------ For dynamic stylesheet------*/
  44. <link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_url'); ?>" media="screen" />
  45. /**---------------------------------------------**/
  46.  
  47.  
  48. /*------ For call any content from directory------*/
  49. <?php echo get_template_directory_uri(); ?>/
  50.  
  51. /*Extra Tips With Replacing*/
  52. <img src="
  53. <img src="<?php echo get_template_directory_uri(); ?>/
  54. /**---------------------------------------------**/
  55.  
  56.  
  57. /*------ For dynamic site title------*/
  58. <title><?php bloginfo('name'); ?><?php wp_title(); ?></title>
  59. For Tagline>>>>>  <?php bloginfo('description'); ?>
  60. /**---------------------------------------------**/
  61.  
  62. /*------ For bring  Dynamic Menu------*/
  63. For Dynamic Menu
  64.  
  65. functions.php
  66.  
  67. function wpj_register_menu() {
  68.     if (function_exists('register_nav_menu')) {
  69.        register_nav_menu( 'main-menu', __( 'Main Menu') );
  70.     }
  71.  
  72. }
  73. add_action('init', 'wpj_register_menu');
  74.  
  75. /*** For two menu Header & footer ***/
  76.  
  77. function register_mainmenu() {
  78.     if (function_exists('register_mainmenu')) {
  79.        register_nav_menu( 'main-menu', __( 'Main Menu') );
  80.     }
  81.     register_nav_menu( 'footer-menu', __( 'Footer Menu') );
  82.  
  83. }
  84. add_action('init', 'register_mainmenu');
  85.  
  86. header.php
  87. <?php wp_nav_menu( array( 'theme_location' => 'main-menu') ); ?>
  88.  
  89. <?php wp_nav_menu( array( 'theme_location' => 'main-menu','menu_id' => 'nav') ); ?>
  90. /**---------------------------------------------**/
  91.  
  92. /*------ For adding menu by replacing UL------*/
  93. <?php wp_nav_menu( array( 'theme_location' => 'main_menu') ); ?>
  94. <?php wp_nav_menu( array( 'theme_location' => 'footer-menu') ); ?>
  95. /**---------------------------------------------**/
  96.  
  97.  
  98. /*------ For bring dynamic Posts to show in page------*/
  99.                         <?php if(have_posts()) : ?><?php while(have_posts())  : the_post(); ?>
  100.                             <h2><?php the_title(); ?></h2>
  101.                             <?php the_content(); ?>
  102.                         <?php endwhile; ?>
  103.                        
  104.                         <?php else : ?>
  105.                             <h3><?php _e('404 Error&#58; Not Found', 'bilanti'); ?></h3>
  106.                         <?php endif; ?>
  107. /**---------------------------------------------**/
  108.  
  109.  
  110. /*------ For ragister a Widget------*/
  111. <?php
  112. function azad_widget() {
  113.     register_sidebar( array(
  114.         'name' => __( ''),
  115.         'id' => '',
  116.         'before_widget' => '',
  117.         'after_widget' => '</div>',
  118.         'before_title' => '<h2>',
  119.         'after_title' => '</h2>',
  120.     ) );
  121. }
  122. add_action('widgets_init', 'azad_widget');
  123.  ?>
  124.  
  125.  /*-------- Conditoonal Widget-------------*/
  126. <?php if ( ! dynamic_sidebar( 'right_sidebar' ) ) : ?> <?php endif; ?>
  127.  
  128.  <?php dynamic_sidebar('blog_sidebar'); ?>
  129.  
  130.  
  131. /**---------------------------------------------**/
  132.  
  133.  
  134. /*------ For Post Query in index.php------*/
  135. <?php if(have_posts()) : ?><?php while(have_posts())  : the_post(); ?>
  136.      
  137. <!-- Your Post Query here -->
  138.  
  139. <?php endwhile; ?>
  140. <?php else : ?>
  141.     <div class="post">
  142.         <h3><?php _e('404 Error&#58; Not Found', 'brightpage'); ?></h3>
  143.     </div>
  144. <?php endif; ?>    
  145. /**---------------------------------------------**/
  146.  
  147.  
  148. /**---------Query Post from a specific category--------------**/
  149. Query Post from a specific category
  150. <?php query_posts('post_type=post&post_status=publish&category-name=your_category_name&posts_per_page=10&paged='. get_query_var('paged')); ?>
  151. /**---------------------------------------------**/
  152.  
  153.  
  154.  
  155.  
  156. /*------For Post Information Query in index.php------*/
  157. <?php the_title(); ?> = to bring title
  158.  
  159. <?php the_permalink(); ?> = to bring post link
  160.  
  161. <?php the_time('M d, Y') ?> = to bring time, date or manth
  162.  
  163. <?php the_excerpt(); ?> = to bring read more
  164.  
  165. <?php the_content(); ?> = to bring full content
  166.  
  167. <?php the_category(', '); ?> = to bring post catagory,
  168. <?php the_author_link(); ?>
  169.  
  170. <?php comments_popup_link('No Comment', '1 Comment', '% Comments'); ?> = to bring post comment & his link
  171. /**---------------------------------------------**/
  172.  
  173.  
  174. /*------ For Pagination in index.php------*/
  175. Pagination in index.php
  176. =====================================
  177. <div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts') ); ?></div><div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>') ); ?></div>
  178. /**---------------------------------------------**/
  179.  
  180.  
  181. /*------ For Single.php page------*/
  182. <?php if(have_posts()) : ?><?php while(have_posts())  : the_post(); ?>
  183.     <h2><?php the_title(); ?></h2>
  184.     <?php the_content(); ?>
  185.    <?php comments_template( '', true ); ?>  
  186. <?php endwhile; ?>
  187.  
  188. <?php else : ?>
  189.     <h3><?php _e('404 Error&#58; Not Found'); ?></h3>
  190. <?php endif; ?>
  191. /**---------------------------------------------**/
  192.  
  193.  
  194. /*------ For Archive.php------*/
  195. for Archivezve Post List
  196.  
  197.  
  198.  
  199. <h1 style="text-align: center;text-shadow: 3px 2px 7px #000000;font-size: 25px;line-height: 30px;">
  200.     <?php if (have_posts()) : ?>
  201.         <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
  202.             <?php /* If this is a category archive */ if (is_category()) { ?>
  203.                 <?php _e('Archive for the'); ?> '<?php echo single_cat_title(); ?>' <?php _e('Category'); ?>                                    
  204.             <?php /* If this is a tag archive */  } elseif( is_tag() ) { ?>
  205.                 <?php _e('Archive for the'); ?> <?php single_tag_title(); ?> Tag
  206.             <?php /* If this is a daily archive */ } elseif (is_day()) { ?>
  207.                 <?php _e('Archive for'); ?> <?php the_time('F jS, Y'); ?>                                        
  208.             <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
  209.                 <?php _e('Archive for'); ?> <?php the_time('F, Y'); ?>                                    
  210.             <?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
  211.                 <?php _e('Archive for'); ?> <?php the_time('Y'); ?>                                        
  212.             <?php /* If this is a search */ } elseif (is_search()) { ?>
  213.                 <?php _e('Search Results'); ?>                            
  214.             <?php /* If this is an author archive */ } elseif (is_author()) { ?>
  215.                 <?php _e('Author Archive'); ?>                                        
  216.             <?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
  217.                 <?php _e('Blog Archives'); ?>                                        
  218.     <?php } ?>
  219. </h1>
  220.  
  221. For archive post query
  222.  
  223. <?php get_template_part( 'post-excerpt' ); // Post Excerpt (post-excerpt.php) ?>
  224.  
  225. If no post in archive or 404
  226.  
  227. <?php else : ?>
  228.     <h3><?php _e('404 Error&#58; Not Found'); ?></h3>
  229. <?php endif; ?>
  230. /**---------------------------------------------**/
  231.  
  232.  
  233. /*------ For 404.php------*/
  234. <h2>404 Error&#58; Not Found</h2>
  235. <p>Sorry, but the page you are trying to reach is unavailable or does not exist.</p>
  236. /**---------------------------------------------**/
  237.  
  238.  
  239. /*------ For bring dynamic Posts to show in page------*/
  240. Adding Comment CSS
  241. Pastebin Link for CSS: http://pastebin.com/VaxfkmMe
  242.  
  243. functions.php
  244. For enable comment
  245.  
  246. function comment_scripts(){
  247.    if ( is_singular() ) wp_enqueue_script( 'comment-reply' );
  248. }
  249. add_action( 'wp_enqueue_scripts', 'comment_scripts' );
  250.  
  251. For enable featured image
  252. add_theme_support( 'post-thumbnails', array( 'post' ) );
  253.  
  254. for enable crop feature
  255. set_post_thumbnail_size( 200, 200, true );
  256. add_image_size( 'post-image', 150, 150, true );
  257.  
  258. post-loop.php
  259.  
  260. Using Featured Image
  261. <?php the_post_thumbnail('post-image', array('class' => 'post-thumb')); ?>
  262.  
  263. <?php
  264.     $full_image_url = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'portfolio-big' );
  265. ?>
  266.  
  267. <?php echo $full_image_url[0]; ?>
  268.  
  269. the_post_thumbnail('project_smal_image', array('class' => 'post-thumb'));
  270.  
  271. /**---------------------------------------------**/
  272.  
  273.  
  274. /*------ For comments.css------*/
  275. /* ===================== comments ===================== */
  276.  
  277. .comments {margin: 10px 0;}
  278. .comments h3 {margin:50px 0 30px 0;font-size:24px;}
  279. ol.commentlist { list-style:none; margin:0 0 1em; padding:0; text-indent:0; }
  280. ol.commentlist li { }
  281. ol.commentlist li.alt { }
  282. ol.commentlist li.bypostauthor {}
  283. ol.commentlist li.byuser {}
  284. ol.commentlist li.comment-author-admin {}
  285. ol.commentlist li.comment { border-bottom: 1px solid #ddd; padding:1em; margin-bottom: 10px; }
  286. ol.commentlist li div.comment-author {}
  287. ol.commentlist li div.vcard { font-size:20px;}
  288. ol.commentlist li div.vcard cite.fn { font-style:normal; }
  289. ol.commentlist li div.vcard cite.fn a.url {}
  290. ol.commentlist li div.vcard img.avatar {float:left; margin:0 1em 1em 0; }
  291. ol.commentlist li div.vcard img.avatar-32 {}
  292. ol.commentlist li div.vcard img.photo {}
  293. ol.commentlist li div.vcard span.says {}
  294. ol.commentlist li div.commentmetadata {}
  295. ol.commentlist li div.comment-meta { font-size:9px; margin-bottom: 10px;}
  296. ol.commentlist li div.comment-meta a { color: #aaa; }
  297. ol.commentlist li p { margin: 0; }
  298. ol.commentlist li ul { list-style:square; margin:0 0 1em 2em; }
  299. ol.commentlist li div.reply { font-size:11px; }
  300. ol.commentlist li div.reply a { font-weight:bold; }
  301. ol.commentlist li ul.children { list-style:none; margin:1em 0 0; text-indent:0; }
  302. ol.commentlist li ul.children li {}
  303. ol.commentlist li ul.children li.alt {}
  304. ol.commentlist li ul.children li.bypostauthor {}
  305. ol.commentlist li ul.children li.byuser {}
  306. ol.commentlist li ul.children li.comment {}
  307. ol.commentlist li ul.children li.comment-author-admin {}
  308. ol.commentlist li ul.children li.depth-2 { margin:0 0 .25em .25em; }
  309. ol.commentlist li ul.children li.depth-3 { margin:0 0 .25em .25em; }
  310. ol.commentlist li ul.children li.depth-4 { margin:0 0 .25em .25em; }
  311. ol.commentlist li ul.children li.depth-5 {}
  312. ol.commentlist li ul.children li.odd {}
  313. ol.commentlist li.even { background:#fff; }
  314. ol.commentlist li.odd { background:#f6f6f6; }
  315. ol.commentlist li.parent { }
  316. ol.commentlist li.pingback { margin: 0 0 10px; padding: 1em; border: 1px dashed #ccc; }
  317. ol.commentlist li.thread-alt { }
  318. ol.commentlist li.thread-even { }
  319. ol.commentlist li.thread-odd {}
  320.  
  321. /* ===================== comment form ===================== */
  322.  
  323. #respond {position: relative;}
  324. #respond input[type="text"],#respond textarea {border:1px solid #ddd;padding:10px}
  325. #respond input[type="text"] {padding:7px;width:300px}
  326. #respond .comment-form-author,
  327. #respond .comment-form-email,
  328. #respond .comment-form-url,
  329. #respond .comment-form-comment { position: relative; }
  330. #respond .comment-form-author label,
  331. #respond .comment-form-email label,
  332. #respond .comment-form-url label,
  333. #respond .comment-form-comment label { background: #eee; color: #555; display: inline-block; left: 4px; min-width: 60px; padding: 4px 10px; position: relative; top: 40px; z-index: 1; }
  334. #respond input[type="text"]:focus,
  335. #respond textarea:focus { text-indent: 0; z-index: 1; }
  336. #respond textarea { resize: vertical; width: 95%;height: 220px; }
  337. #respond .comment-form-author .required,
  338. #respond .comment-form-email .required { color: #bd3500; font-size: 22px; font-weight: bold; left: 75%; position: absolute; top: 45px; z-index: 1; }
  339. #respond .comment-notes,
  340. #respond .logged-in-as { font-size: 13px; }
  341. #respond p { margin: 10px 0; }
  342. #respond .form-submit { float: right; margin: -20px 0 10px; }
  343. #respond input#submit { background: #454545; border: none; -moz-border-radius: 3px; border-radius: 3px; -webkit-box-shadow: 0px 1px 2px rgba(0,0,0,0.3); -moz-box-shadow: 0px 1px 2px rgba(0,0,0,0.3); box-shadow: 0px 1px 2px rgba(0,0,0,0.3); color: #eee; cursor: pointer; padding: 5px 42px 5px 22px; }
  344. #respond input#submit:active { background: #86222D; color: #fff; }
  345. #respond #cancel-comment-reply-link { color: #666; margin-left: 10px; text-decoration: none; }
  346. #respond .logged-in-as a:hover,
  347. #respond #cancel-comment-reply-link:hover { text-decoration: underline; }
  348. .commentlist #respond { margin: 1.625em 0 0; width: auto; }
  349. #reply-title { color: #373737; font-size: 20px; }
  350. #cancel-comment-reply-link { color: #888; display: block; position: absolute; right: 1.625em; text-decoration: none; text-transform: uppercase; top: 1.1em; }
  351. #cancel-comment-reply-link:focus,
  352. #cancel-comment-reply-link:active,
  353. #cancel-comment-reply-link:hover { color: #ff4b33; }
  354. #respond label {display: block; float: right; font-size: 16px; line-height: 2.2em; width: 280px;}
  355. #respond input[type=text] {}
  356. #respond p { font-size: 12px; }
  357. p.comment-form-comment { margin: 0; }
  358. .form-allowed-tags { display: none; }
  359. .trackback { margin: 0 0 10px; padding: 1em; border: 1px dashed #ccc; }
  360. /**---------------------------------------------**/
  361.  
  362.  
  363.  
  364.  
  365.  
  366. /*------ For bring An amazing readmore function------*/
  367. An amazing readmore function
  368.  
  369. functions.php
  370.  
  371. function excerpt($num) {
  372. $limit = $num+1;
  373. $excerpt = explode(' ', get_the_excerpt(), $limit);
  374. array_pop($excerpt);
  375. $excerpt = implode(" ",$excerpt)." <a href='" .get_permalink($post->ID) ." ' class='".readmore."'>Read More</a>";
  376. echo $excerpt;
  377. }
  378.  
  379. Usage: <?php echo excerpt('15'); ?>
  380. /**---------------------------------------------**/
  381.  
  382. /**---------Using Custom Templates--------------**/
  383. Using Custom Templates
  384.  
  385. <?php
  386. /*
  387.  * Template Name: Custom Template Name
  388.  */
  389. get_header(); ?>
  390. /**---------------------------------------------**/
  391.  
  392.  
  393.  
  394.  
  395.  
  396. /**---------Register Custom Post Types--------------**/
  397. /* Register Custom Post Types********************************************/
  398. function.php
  399.  
  400. /**---------Register Custom Post Types--------------**/
  401.     function create_post_type() {
  402.         register_post_type( 'testimonial',
  403.             array(
  404.                 'labels' => array(
  405.                     'name' => __( 'Testimonial' ),
  406.                     'singular_name' => __( 'Testimonial' ),
  407.                     'add_new' => __( 'Add New' ),
  408.                     'add_new_item' => __( 'Add New Testimonial' ),
  409.                     'edit_item' => __( 'Edit Testimonial' ),
  410.                     'new_item' => __( 'New Testimonial' ),
  411.                     'view_item' => __( 'View Testimonial' ),
  412.                     'not_found' => __( 'Sorry, we couldn\'t find the Testimonial you are looking for.' )
  413.                 ),
  414.             'public' => true,
  415.             'publicly_queryable' => false,
  416.             'exclude_from_search' => true,
  417.             'menu_position' => 14,
  418.             'has_archive' => false,
  419.             'hierarchical' => false,
  420.             'capability_type' => 'page',
  421.             'rewrite' => array( 'slug' => 'testimonial' ),
  422.             'supports' => array( 'title', 'editor', 'custom-fields' )
  423.             )
  424.         );
  425.     }
  426.     add_action( 'init', 'create_post_type' );
  427. /**---------------------------------------------**/
  428.  
  429.  
  430. /**---------Query Custom Post List--------------**/
  431. <?php query_posts('post_type=testimonial&post_status=publish&posts_per_page=10&paged='. get_query_var('paged')); ?>
  432. /**---------------------------------------------**/
  433.  
  434.  
  435. /**---------Query Custom Post Single--------------**/
  436. copy your single.php file & rename single-<custom-post>.php
  437. <custom-post> = Custom Post Type
  438. /**---------------------------------------------**/
  439.  
  440.  
  441.  
  442.  
  443. =====================================================================================================
  444. // Register Custom Taxonomy
  445. =====================================================================================================
  446. <?php
  447. function pages_taxonomy() {
  448.     register_taxonomy(
  449.         'pages_cat',  //The name of the taxonomy. Name should be in slug form (must not contain capital letters or spaces).
  450.         'page',          //post type name
  451.         array(
  452.             'hierarchical'      => true,
  453.             'label'             => 'Page Category',  //Display name
  454.             'query_var'         => true,
  455.             'rewrite'           => array(
  456.                 'slug'          => 'page-category', // This controls the base slug that will display before each term
  457.                 'with_front'    => false // Don't display the category base before
  458.                 )
  459.             )
  460.     );
  461. }
  462. add_action( 'init', 'pages_taxonomy');     
  463. <? 
  464.  
  465. =====================================================================================================
  466. // Custom Taxonomy Query
  467. =====================================================================================================
  468.  
  469. <?php
  470. global $post;
  471. $args = array( 'posts_per_page' => -1, 'post_type'=> 'staff', 'department_cat' => 'Commerical' );
  472. $myposts = get_posts( $args );
  473. foreach( $myposts as $post ) : setup_postdata($post); ?>
  474.                
  475.     // Your Post Content. Title, detail etc.
  476.                
  477. <?php endforeach; ?>
  478.  
  479.  
  480.  
  481.  
  482.  
  483.  
  484.  
  485.  
  486. /**---------Display Custom Field Data--------------**/
  487. Display Custom Field Data
  488.  
  489. <?php $ = get_post_meta($post->ID, '', true); ?>
  490.  
  491.  
  492. <?php $key="url"; echo get_post_meta($post->ID, $key, true); ?>
  493.  
  494.  
  495. Display custom field if exists
  496.  
  497. <?php $image = get_post_meta($post->ID, 'url', true);
  498. if($image) : ?>
  499. <img src="<?php echo $image; ?>" alt="" />
  500. <?php endif; ?>
  501.  
  502.  
  503. Conditional Custom Field
  504.  
  505. <?php
  506. $url = get_post_meta( $post->ID, 'url', true );
  507. if ( $url ) {
  508.     echo $url;
  509. } else {
  510.     the_permalink();
  511. }
  512. ?>
  513. /**---------------------------------------------**/
  514.  
  515.  
  516. /**---------For adding theme option in admin pannel----------------**/
  517. befor it active need create a folder named includes & create a file in includes folder named theme-options.php
  518. then open theme-options.php & paste below codes.
  519.  
  520. <?php
  521.  
  522. add_action( 'admin_init', 'custom_theme_options', 1 );
  523.  
  524. function custom_theme_options() {
  525.  
  526.   $saved_settings = get_option( 'option_tree_settings', array() );
  527.  
  528.  
  529.   $custom_settings = array(
  530.     'sections'        => array(
  531.       array(
  532.         'id'          => 'general',
  533.         'title'       => 'Site Settings'
  534.       )
  535.     ),
  536.     'settings'        => array(
  537.       array(
  538.         'id'          => 'logo_text',
  539.         'label'       => 'Logo Text',
  540.         'desc'        => 'Use H1, H2, H3 tag',
  541.         'type'        => 'textarea',
  542.         'section'     => 'general'
  543.       ),
  544.       array(
  545.         'id'          => 'footer_text',
  546.         'label'       => 'Footer Text',
  547.         'type'        => 'textarea',
  548.         'section'     => 'general'
  549.       )
  550.     )
  551.   );
  552.  
  553.   if ( $saved_settings !== $custom_settings ) {
  554.     update_option( 'option_tree_settings', $custom_settings );
  555.   }
  556.  
  557. }
  558.  ?>
  559. /**---------------------------------------------**//
  560.  
  561.  
  562. /**------------Activate Option Tree---------------------**/
  563. functions.php
  564. Activate Option Tree
  565.  
  566.  
  567. // add_filter( 'ot_show_pages', '__return_false' ); //For Turn on or Off Documentation
  568. add_filter( 'ot_show_new_layout', '__return_false' );
  569. add_filter( 'ot_theme_mode', '__return_true' );
  570.  
  571. include_once( 'option-tree/ot-loader.php' );
  572.  
  573. include_once( 'inc/theme-options.php' );
  574. include_once( 'inc/meta-boxes.php' );
  575.  
  576.  
  577. /**---------------------------------------------**//
  578.  
  579.  
  580. /**---------Get Data From Option Tree------------------**/
  581. Get Data From Option Tree
  582. ==========================
  583.  
  584. Condtional Data
  585.  
  586. <?php if ( function_exists( 'get_option_tree') ) : if( get_option_tree( 'logo_uploader') ) : ?>    
  587.     <?php get_option_tree( 'logo_uploader', '', 'true' ); ?>
  588. <?php else : ?>
  589.     Your Default Data
  590. <?php endif; endif; ?>
  591. /**---------------------------------------------**/
  592.  
  593.  
  594. /**----------------Simple Data---------------**/
  595. Simple Data
  596.  
  597. <?php get_option_tree( 'facebook', '', 'true' ); ?>
  598. /**---------------------------------------------**/
  599.  
  600.  
  601.  
  602.  
  603. /**** From Other Resorce    ****/
  604.  
  605.  
  606. /**--------------For Post View count------------------**/
  607. functions.php
  608.  
  609. function getPostViews($postID){
  610.     $count_key = 'post_views_count';
  611.     $count = get_post_meta($postID, $count_key, true);
  612.     if($count==''){
  613.         delete_post_meta($postID, $count_key);
  614.         add_post_meta($postID, $count_key, '0');
  615.         return "0 View";
  616.     }
  617.     return $count.' Views';
  618. }
  619. function setPostViews($postID) {
  620.     $count_key = 'post_views_count';
  621.     $count = get_post_meta($postID, $count_key, true);
  622.     if($count==''){
  623.         $count = 0;
  624.         delete_post_meta($postID, $count_key);
  625.         add_post_meta($postID, $count_key, '0');
  626.     }else{
  627.         $count++;
  628.         update_post_meta($postID, $count_key, $count);
  629.     }
  630. }
  631.  
  632. single.php
  633.  
  634. <?php setPostViews(get_the_ID()); ?>
  635.  
  636. writwe below code where do u want to show post view counter
  637. <?php echo getPostViews(get_the_ID()); ?>
  638.  
  639. /**---------------------------------------------**/
  640.  
  641. /**----This code For dynamic copyright Text------**/
  642. footer.php
  643.  
  644. <b>(c) <?php echo date('Y'); ?></b>
  645. | <a href="<?php bloginfo('url'); ?>"><?php bloginfo('name'); ?></a>
  646. | <?php bloginfo('description'); ?>
  647. /**---------------------------------------------**/
  648.  
  649. /**--For wiew Posst or Comments publish Time---**/
  650. single.php
  651.  
  652. <?php
  653. # For posts & pages #
  654. echo human_time_diff(get_the_time('U'), current_time('timestamp')) . ' ago';
  655. #Fo comments#
  656. echo human_time_diff(get_comment_time('U'), current_time('timestamp')) . ' ago';
  657.  
  658. // Change to the date after a certain time
  659. $time_difference = current_time('timestamp') - get_the_time('U');
  660. if($time_difference < 86400) {
  661.     //here goes the code from one of the sample above
  662. } else {
  663.     the_time();
  664. };
  665. ?>
  666.  
  667. /**---------------------------------------------**/
  668.  
  669. /**-This code for pre define post when i write a post on wordpress---**/
  670. function.php
  671. add_filter( 'default_content', 'my_content' );
  672. function my_content( $content ) {
  673. $content = "your content here.";
  674. return $content;
  675. }
  676. /**---------------------------------------------**/
  677.  
  678. /**-----------Slider Custom Post-------------**/
  679. <?php if(!is_paged()) { ?>
  680. <?php
  681.     $args = array( 'post_type' => 'slider', 'posts_per_page' => 5 );
  682.     $loop = new WP_Query( $args );
  683. ?>  
  684. <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
  685.     <?php the_post_thumbnail('slide-image', array('class' => 'postthumbnails')); ?>
  686. <?php endwhile; ?>
  687. <?php wp_reset_query(); ?>
  688. <?php } ?>
  689.  
  690.  
  691. /**---------------------------------------------**/
  692.  
  693. /**-----------ওয়ার্ডপ্রেসে ইমেজ আর টেক্সট আলাদা করুন ->---------------**/
  694.  
  695. Functions.php তে লিখুন
  696.  
  697. // Stop images getting wrapped up in p tags when they get dumped out with
  698. the_content() for easier theme styling
  699. function wpfme_remove_img_ptags($content){
  700. return preg_replace('/<p>\s*(<a .*>)?\s*(<img .* \/>)\s*(\/a>)?\s*<\/p>/iU', '\1\2\3', $content);
  701. }
  702. add_filter('the_content', 'wpfme_remove_img_ptags');
  703. /**---------------------------------------------**/
  704.  
  705.  
  706. Title: custom background.
  707. ============================================
  708. head.php
  709. ..............
  710. replace the <body> tag using  bellow  the code.
  711.  
  712.  
  713. <body <?php body_class(); ?>>
  714. =============================================
  715.  
  716. functions.php
  717. .........................
  718. this code put within the <?php  ?> tag
  719.  
  720.  
  721. $defaults_azad= array(
  722.     'default-color'          => '#000',
  723.     'default-image'          => '',
  724.     'wp-head-callback'       => '_custom_background_cb',
  725.     'admin-head-callback'    => '',
  726.     'admin-preview-callback' => ''
  727. );
  728. add_theme_support( 'custom-background', $defaults_azad );
  729.  
  730. ==============================================
  731.  
  732.  
  733.  
  734.  
  735. Title: custom Header/Logo
  736. =============================================
  737. head.php
  738. .........................
  739.  
  740. Put this  code where you want to upload your logo.
  741. <a href="<?php bloginfo('home'); ?>"><img src="<?php header_image(); ?>" height="<?php echo get_custom_header()->height; ?>" width="<?php echo get_custom_header()->width; ?>" alt="" /></a>
  742.  
  743.  
  744. =============================================
  745. functions.php
  746. ..........................
  747. this code put within the <?php  ?> tag
  748.  
  749. add_theme_support( 'custom-header' );
  750.  
  751.  
  752. $defaults = array(
  753.     'default-image'          => '',
  754.     'random-default'         => true,
  755.     'width'                  => 1000
  756.     'height'                 => 200,
  757.     'flex-height'            => true,
  758.     'flex-width'             => true,
  759.     'default-text-color'     => '#000',
  760.     'header-text'            => true,
  761.     'uploads'                => true,
  762.     'wp-head-callback'       => '',
  763.     'admin-head-callback'    => '',
  764.     'admin-preview-callback' => '',
  765. );
  766. add_theme_support( 'custom-header', $defaults );
  767.  
  768.  
  769.  
  770.  
  771.  
  772.  
  773.  
  774.  
  775. আমার ব্লগে যে কেউ ফটো আপলোড করুকনা কেন সে অন্যের ফটো ও দেখতে পারে এইটা বন্ধ করব কিভাবে
  776. /**-------------Function for ---------------**/
  777. function strawberry_author_media( $wp_query ) {
  778. //are we looking at the Media Library or the Posts list?
  779. if ( strpos( $_SERVER[ 'REQUEST_URI' ], '/wp-admin/upload.php' ) !== false
  780. || strpos( $_SERVER[ 'REQUEST_URI' ], '/wp-admin/edit.php' ) !== false ) {
  781. //user level 5 converts to Editor
  782. if ( !current_user_can( 'level_5' ) ) {
  783. //restrict the query to current user
  784. global $current_user;
  785. $wp_query->set( 'author', $current_user->id );
  786. }
  787. }
  788. }
  789. add_filter('parse_query', 'strawberry_author_media' );
  790. /**---------------------------------------------**/
  791.  
  792. /**---------------------------------------------**/
  793. SMOF Options Framework Uses
  794. =========================================================================
  795.  
  796. Single Data: <?php global $data; echo $data['your_option_id']; ?>
  797.  
  798. Conditional Data:
  799. <?php global $data; ?>
  800. <?php if($data['your_option_id']): ?>
  801.    <?php echo $data['your_option_id']; ?>
  802. <?php endif; ?>
  803.                    
  804. Conditional Data with Default Data
  805.  
  806. <?php global $data; ?>
  807. <?php if($data['your_option_id']): ?>
  808.    <?php echo $data['your_option_id']; ?>
  809. <?php else: ?>
  810.    My Default Data
  811. <?php endif; ?>
  812.  
  813. /**---------------------------------------------**/
  814.  
  815. /**---------------------------------------------**/
  816. Conditional Options in functions
  817. =========================================================================
  818.  
  819. $of_options[] = array(  "name"      => "Show Banner",
  820.                         "desc"      => "You can use banner below logo and description",
  821.                         "id"        => "show_banner",
  822.                         "on"        => "Yes, I'd like to show banner",
  823.                         "off"       => "Sorry, I don't want banner",                       
  824.                         "std"       => 0,
  825.                         "folds"     => 1,
  826.                         "type"      => "switch"
  827.                 );
  828.                
  829. $of_options[] = array(  "name"      => "Upload your banner",
  830.                         "desc"      => "You can upload your banner from here",
  831.                         "id"        => "custom_banner",
  832.                         "fold"      => "show_banner", /* the switch hook */
  833.                         "type"      => "upload"
  834.                 );
  835.                
  836.    
  837.  
  838.  
  839. Conditional Banner code in theme
  840. =========================================================================
  841.  
  842. <?php global $data; ?>
  843. <?php if($data['show_banner']): ?>
  844.    <img src="<?php echo $data['custom_banner']; ?>" alt="" />
  845. <?php else: ?>
  846.    
  847. <?php endif; ?>
  848.  
  849. /**---------------------------------------------**/
  850.  
  851.  
  852. /**-------------Related Post Using Category--------------------**/
  853. <div id="related_post">
  854. <?php
  855. $categories = get_the_category($post->ID);
  856. if ($categories) {
  857.     $category_ids = array();
  858.     foreach($categories as $individual_category) $category_ids[] = $individual_category->term_id;
  859.     $args=array(
  860.         'category__in' => $category_ids,
  861.         'post__not_in' => array($post->ID),
  862.         'showposts'=>5, // কতো সংখ্যক রিলেটেড পোস্ট দেখানো হবে।
  863.         'caller_get_posts'=>1
  864.     );
  865.      
  866.     $my_query = new wp_query($args);
  867.     if( $my_query->have_posts() ) {
  868.         echo '<h2>Related Posts</h2><ul id="rel_item">';
  869.         while ($my_query->have_posts()) : $my_query->the_post(); ?>
  870.             <li><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>
  871.         <?php
  872.         endwhile;
  873.         echo '</ul>';
  874.     }
  875.     wp_reset_query();
  876. }
  877. ?>
  878. </div>
  879. /**------------CSS For Both-------------------**/
  880. #related_post {width:632px;text-align:left; position:relative;}
  881. #related_post h2{font-size:18px; font-weight:normal; overflow:hidden;}
  882. ul#rel_item {margin-top: -10px; padding:0px 0px;}
  883. ul#rel_item li{padding-bottom:7px; line-height:24px; font: 12px;}
  884. ul#rel_item li a:link, ul#rel_item li a:visited{color:#0199BC;}
  885. ul#rel_item li a:hover{color:#364D55;}
  886. /**---------------------------------------------**/
  887.  
  888. /**---------------------------------------------**/
  889. <div id="related_post">
  890. <?php
  891. $categories = get_the_category($post->ID);
  892. if ($categories) {
  893.     $category_ids = array();
  894.     foreach($categories as $individual_category) $category_ids[] = $individual_category->term_id;
  895.     $args=array(
  896.         'category__in' => $category_ids,
  897.         'post__not_in' => array($post->ID),
  898.         'showposts'=>5, // কতো সংখ্যক রিলেটেড পোস্ট দেখানো হবে।
  899.         'caller_get_posts'=>1
  900.     );
  901.  
  902. /**---------------------------------------------**/
  903.  
  904.  
  905. /**------------Smooth Scrolling--------------**/
  906. $(document).ready(function() {
  907.   function filterPath(string) {
  908.   return string
  909.     .replace(/^\//,'')
  910.     .replace(/(index|default).[a-zA-Z]{3,4}$/,'')
  911.     .replace(/\/$/,'');
  912.   }
  913.   var locationPath = filterPath(location.pathname);
  914.   var scrollElem = scrollableElement('html', 'body');
  915.  
  916.   $('a[href*=#]').each(function() {
  917.     var thisPath = filterPath(this.pathname) || locationPath;
  918.     if (  locationPath == thisPath
  919.     && (location.hostname == this.hostname || !this.hostname)
  920.     && this.hash.replace(/#/,'') ) {
  921.       var $target = $(this.hash), target = this.hash;
  922.       if (target) {
  923.         var targetOffset = $target.offset().top;
  924.         $(this).click(function(event) {
  925.           event.preventDefault();
  926.           $(scrollElem).animate({scrollTop: targetOffset}, 400, function() {
  927.             location.hash = target;
  928.           });
  929.         });
  930.       }
  931.     }
  932.   });
  933.  
  934.   // use the first element that is "scrollable"
  935.   function scrollableElement(els) {
  936.     for (var i = 0, argLength = arguments.length; i <argLength; i++) {
  937.       var el = arguments[i],
  938.           $scrollElement = $(el);
  939.       if ($scrollElement.scrollTop()> 0) {
  940.         return el;
  941.       } else {
  942.         $scrollElement.scrollTop(1);
  943.         var isScrollable = $scrollElement.scrollTop()> 0;
  944.         $scrollElement.scrollTop(0);
  945.         if (isScrollable) {
  946.           return el;
  947.         }
  948.       }
  949.     }
  950.     return [];
  951.   }
  952.  
  953. });
  954.  
  955.  
  956. /*--------Stiker----------*/
  957. $(document).ready(function() {
  958.     var s = $("#sticker");
  959.     var pos = s.position();                  
  960.     $(window).scroll(function() {
  961.         var windowpos = $(window).scrollTop();
  962.         if (windowpos >= pos.top) {
  963.             s.addClass("stick");
  964.         } else {
  965.             s.removeClass("stick");
  966.         }
  967.     });
  968. });
  969.  
  970. div#sticker {
  971.     padding:20px;
  972.     margin:20px 0;
  973.     background:#AAA;
  974.     width:190px;
  975. }
  976. .stick {
  977.     position:fixed;
  978.     top:0px;
  979. }
  980.  
  981.  
  982. /**------------ For Search-------------------**/
  983. <form id="searchform" class="search fix" action="http://yourdomail.com/" method="get" role="search">
  984. <div>
  985. <label class="screen-reader-text" for="s"></label>
  986. <input class="search-field" id="s" type="text" name="s" value=""></div>
  987. </form>
  988.  
  989.  
  990.  
  991. /* Search Widget Style */
  992. .screen-reader-text{
  993. float:left;
  994. font-size:17px;
  995. padding-bottom:15px;
  996. text-align:center;
  997. width:100%;
  998. }
  999. #s{
  1000. background:none repeat scroll 0 0 #eeeeee;
  1001. /*border-radius*/
  1002. -webkit-border-radius:3px 3px 3px 3px;
  1003.    -moz-border-radius:3px 3px 3px 3px;
  1004.         border-radius:3px 3px 3px 3px;
  1005. color:#000;
  1006. /*transition*/
  1007. -webkit-transition:background 300ms ease-in-out 0s;
  1008.    -moz-transition:background 300ms ease-in-out 0s;
  1009.      -o-transition:background 300ms ease-in-out 0s;
  1010.         transition:background 300ms ease-in-out 0s;
  1011. width:40%;
  1012. margin-right:5%;
  1013. }
  1014. input[type="submit"]{
  1015. background:none repeat scroll 0 0 #444444;
  1016. border:medium none;
  1017. color:#FFFFFF;
  1018. cursor:pointer;
  1019. padding:5px 15px;
  1020. width:40%;
  1021. }
  1022.  
  1023.  
  1024.  
  1025.  
  1026.  
  1027.  
  1028. add_theme_support( 'woocommerce' );
  1029. //NUMBER OF PRODICTS TO DISPLAY ON SHOP PAGE
  1030. add_filter('loop_shop_per_page', create_function('$cols', 'return 100;'));
  1031.  
  1032.  
  1033. =================404=================
  1034. <div style="display: block;margin: 0 auto;padding: 30px 0;">
  1035.     <h1 class="font-size: 50px;text-align: center;font-weight: normal;color:#ddd">
  1036.         <span>404</span>not found
  1037.     </h1>
  1038. </div>
  1039.  
  1040.  
  1041.  
  1042.  
  1043. /*=============FOR---Plugin============*/
  1044. function boxed_css() {
  1045.     echo "
  1046.         <style type='text/css'>
  1047.             #boxed_style {border:5px solid red;padding:25px;}
  1048.         </style>
  1049.     ";
  1050. }
  1051. add_action ('wp_head', 'boxed_css');
  1052.  
  1053. /* This Code for load jQuery from Wordpress */
  1054. function latest_jquery_for_slider() {
  1055.     wp_enqueue_script('jquery');
  1056. }
  1057. add_action('init', 'latest_jquery_for_slider');
  1058.  
  1059. /* This Code for load jQuery File  depend on main jquery */
  1060. function lazy_news_plugin_main_js() {
  1061.     wp_enqueue_script( 'lazy-news-js', plugins_url( '/js/jquery.ticker.min.js', __FILE__ ), array('jquery'), 1.0, false);
  1062. }
  1063.  
  1064. add_action('init','lazy_news_plugin_main_js');
  1065.  
  1066. /* Loads Slider Javascript */
  1067. function plugin_javasctipt_main_file() {
  1068.     wp_register_script( 'onekb_slider_script', plugins_url('rrf-one-kb-slider/js/responsiveslides.min.js'), false, '1.0', true);
  1069.    
  1070.     wp_enqueue_script( 'onekb_slider_script' );
  1071. }
  1072. add_action( 'wp_footer', 'plugin_javasctipt_main_file' );
  1073.  
  1074.  
  1075. /* Active Slider */
  1076. function plugin_javasctipt_active_file() {
  1077.     wp_register_script( 'onekb_slider_active', plugins_url('rrf-one-kb-slider/js/active.js'), false, '1.0', true);
  1078.    
  1079.     wp_enqueue_script( 'onekb_slider_active' );
  1080. }
  1081. add_action( 'wp_footer', 'plugin_javasctipt_active_file' );
  1082.  
  1083.  
  1084. /* Load Slider Custom CSS */
  1085. function onekb_slider_plugin_styles() {
  1086.     wp_register_style( 'onekb_slider_plugin_style', plugins_url('css/custom.css', __FILE__) );
  1087.     wp_enqueue_style(onekb_slider_plugin_style);
  1088. }
  1089. add_action( 'wp_enqueue_scripts', 'onekb_slider_plugin_styles' );
  1090.  
  1091.  
  1092. /* Load Quotes Custom CSS */
  1093. function quotes_stylesheet() {
  1094.     // Enqueue the CSS
  1095.     wp_enqueue_style('quotes_style',plugins_url( 'css/component.css', __FILE__),false,1.0,'all');
  1096. }
  1097. add_action( 'wp_enqueue_scripts', 'quotes_stylesheet');
  1098.  
  1099.  
  1100. /* Generates Slider Shortcode */
  1101. function slider($atts, $content = null) {
  1102.     return ('<ul class="rslides">'.do_shortcode($content).'</ul>');
  1103. }
  1104. add_shortcode ("slider", "slider");
  1105.  
  1106. function slides($atts, $content = null) {
  1107.     return ('<li><img src="'.$content.'" alt=""/></li>');
  1108. }
  1109. add_shortcode ("slides", "slides");
  1110.  
  1111.  
  1112. /* Add Slider Shortcode Button on Post Visual Editor */
  1113.  
  1114. function onekbslider_button() {
  1115.     add_filter ("mce_external_plugins", "slider_button_js");
  1116.     add_filter ("mce_buttons", "slider_button");
  1117. }
  1118.  
  1119. function slider_button_js($plugin_array) {
  1120.     $plugin_array['wptuts'] = plugins_url('js/custom-button.js', __FILE__);
  1121.     return $plugin_array;
  1122. }
  1123.  
  1124. function slider_button($buttons) {
  1125.     array_push ($buttons, 'slider');
  1126.     return $buttons;
  1127. }
  1128. add_action ('init', 'onekbslider_button');
  1129.  
  1130.  
  1131.  
  1132.  
  1133. ==================WooCommerce====================
  1134. /*=============== BD Currency =================*/
  1135. add_filter( 'woocommerce_currencies', 'add_my_currency' );
  1136.  
  1137. function add_my_currency( $currencies ) {
  1138. $currencies['BDT'] = __( 'Currency name', 'woocommerce' );
  1139. return $currencies;
  1140. }
  1141.  
  1142. add_filter('woocommerce_currency_symbol', 'add_my_currency_symbol', 10, 2);
  1143.  
  1144. function add_my_currency_symbol( $currency_symbol, $currency ) {
  1145. switch( $currency ) {
  1146. case 'BDT': $currency_symbol = 'Tk'; break;
  1147. }
  1148. return $currency_symbol;
  1149. }
  1150.  
  1151.  
  1152.  
  1153. ==================Related Post by Same Author ====================
  1154. function get_related_author_posts() {
  1155.     global $authordata, $post;
  1156.  
  1157.     $authors_posts = get_posts( array( 'author' => $authordata->ID, 'post__not_in' => array( $post->ID ), 'posts_per_page' => 5 ) );
  1158.  
  1159.     $output = '<ul>';
  1160.     foreach ( $authors_posts as $authors_post ) {
  1161.         $output .= '<li><a href="' . get_permalink( $authors_post->ID ) . '">' . apply_filters( 'the_title', $authors_post->post_title, $authors_post->ID ) . '</a></li>';
  1162.     }
  1163.     $output .= '</ul>';
  1164.  
  1165.     return $output;
  1166. }
  1167.  
  1168. Place this code in single.php to show the related post:
  1169. <div style="background:#ddd;color:#fff;">
  1170.     <?php echo get_related_author_posts(); ?>
  1171. </div>
  1172.  
  1173. ==================Post View Count ====================
  1174. /*Use on functions.php function to display number of posts.*/
  1175. function getPostViews($postID){
  1176. $count_key = 'post_views_count';
  1177. $count = get_post_meta($postID, $count_key, true);
  1178. if($count==''){
  1179. delete_post_meta($postID, $count_key);
  1180. add_post_meta($postID, $count_key, '0');
  1181. return "0 View";
  1182. }
  1183. return $count.' Views';
  1184. }
  1185.  
  1186. // function to count views.
  1187. function setPostViews($postID) {
  1188. $count_key = 'post_views_count';
  1189. $count = get_post_meta($postID, $count_key, true);
  1190. if($count==''){
  1191. $count = 0;
  1192. delete_post_meta($postID, $count_key);
  1193. add_post_meta($postID, $count_key, '0');
  1194. }else{
  1195. $count++;
  1196. update_post_meta($postID, $count_key, $count);
  1197. }
  1198. }
  1199.  
  1200. // Add it to a column in WP-Admin
  1201. add_filter('manage_posts_columns', 'posts_column_views');
  1202. add_action('manage_posts_custom_column', 'posts_custom_column_views',5,2);
  1203. function posts_column_views($defaults){
  1204. $defaults['post_views'] = __('Views');
  1205. return $defaults;
  1206. }
  1207. function posts_custom_column_views($column_name, $id){
  1208. if($column_name === 'post_views'){
  1209. echo getPostViews(get_the_ID());
  1210. }
  1211. } /*Lastly, to display the number of views a post has, just add this where you want it to be displayed:*/
  1212. <?php echo getPostViews(get_the_ID()); ?>
  1213.  
  1214.  
  1215.  
  1216. ============================ Multilanguage Qtranslate ===============================
  1217. /*For manually*/
  1218. [:en]English Text[:fr]French Text[:de]German Text
  1219.  
  1220.  
  1221. /** Memory Limit */
  1222. define('WP_MEMORY_LIMIT', '64M');
  1223. /* That's all, stop editing! Happy blogging. */
  1224. set_time_limit(300);
  1225.  
  1226.  
  1227.  
  1228.  
  1229.  
  1230. ====================== Post Meta ==============================
  1231. $promotions_icon = get_post_meta($post->ID, 'promotions_icon', true);
  1232.  
  1233. ====================== Shortcode Custom Field ==============================
  1234. $product_price_dollar = get_post_meta($idd, 'product_price_dollar', true);
  1235.  
  1236.  
  1237. # Changing Default Title of 'qtrotator' Csutom post
  1238.  
  1239. function change_default_title( $title ) {
  1240.     $screen = get_current_screen();
  1241.     switch ($screen->post_type) {
  1242.     case 'qtrotator':
  1243.     $title = 'qtrotator';
  1244.     break;
  1245.     case 'page':
  1246.     $title = 'page';
  1247.     break;
  1248.     default:
  1249.     $title = 'Enter Default Post Title Heree';
  1250.     break;
  1251.     }
  1252.     return $title;
  1253. }
  1254. add_filter( 'enter_title_here', 'change_default_title', 10, 2 );
  1255.  
  1256. Load modernizr in plugin:
  1257. ===============================
  1258.  
  1259. function wpb_modernizr() {
  1260. wp_deregister_script('modernizr'); // deregister
  1261. wp_enqueue_script('wp_enqueue_scripts', plugins_url('/js/modernizr.custom.js', __FILE__), false, '2.7.0', false);
  1262. }
  1263. add_action('wp_enqueue_scripts', 'wpb_modernizr');
Advertisement
Add Comment
Please, Sign In to add comment