thachpham92

File functions.php của theme Wordpress

May 15th, 2013
359
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. //Tao menu
  3.  function tao_menu() {
  4.     register_nav_menus (
  5.         array   ('top-menu' => __('Top Menu'),
  6.                  'main-menu' => __('Main menu'),
  7.                 )
  8.     );
  9. }
  10. add_action('init','tao_menu');
  11. //Bat chuc nang Featured Image
  12. add_theme_support( 'post-thumbnails' );
  13. //Tuy chinh do dai noi dung bai viet trang chu
  14. function custom_excerpt_length( $length ) {
  15.     return 80;
  16. }
  17. add_filter ('excerpt_length','custom_excerpt_length','999');
  18. function new_excerpt_more( $more ) {
  19.     return ' <a class="more-link" href="'. get_permalink( get_the_ID() ) . '"> Xem thêm</a>';
  20. }
  21. add_filter( 'excerpt_more', 'new_excerpt_more' );
  22. //Tao sidebar
  23. if (function_exists('register_sidebar'))
  24.     register_sidebar( array(
  25.     'name' =>'Sidebar',
  26.     'id' => 'sidebar',
  27.     'before_widget' => '',
  28.     'after_widget' => '',
  29.     'before_title' => '<h4 class="widet-title">',
  30.     'after_title' => '</h4>',
  31.     ) );
  32. register_sidebar( array(
  33.     'name' =>'Footer Widget 1',
  34.     'id' => 'footer-widget-1',
  35.     'before_widget' => '',
  36.     'after_widget' => '',
  37.     'before_title' => '<h4 class="widget-title">',
  38.     'after_title' => '</h4>',
  39.     ) );
  40. register_sidebar( array(
  41.     'name' =>'Footer Widget 2',
  42.     'id' => 'footer-widget-2',
  43.     'before_widget' => '',
  44.     'after_widget' => '',
  45.     'before_title' => '<h4 class="widget-title">',
  46.     'after_title' => '</h4>',
  47.     ) );
  48. register_sidebar( array(
  49.     'name' =>'Footer Widget 3',
  50.     'id' => 'footer-widget-3',
  51.     'before_widget' => '',
  52.     'after_widget' => '',
  53.     'before_title' => '<h4 class="widget-title">',
  54.     'after_title' => '</h4>',
  55.     ) );
  56. ?>
RAW Paste Data