Advertisement
Guest User

Functions.php

a guest
Mar 19th, 2012
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.89 KB | None | 0 0
  1. <?php
  2. if ( function_exists( 'add_theme_support' ) ) {
  3. add_theme_support( 'post-thumbnails' );
  4. add_image_size( 'homethumb', 260, 304, true );
  5. add_image_size( 'sliderthumb', 620, 280, true );
  6. }
  7.  
  8.  
  9. function custom_excerpt_length( $length ) {
  10. return 46;
  11. }
  12. add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
  13.  
  14. add_filter('post_limits', 'my_limit_posts');
  15. function my_limit_posts($limit){
  16. return "LIMIT 4";
  17. }
  18. $wp_query = new WP_Query('posts_per_page=4&category_name=destaque');
  19. remove_filter('post_limits', 'my_limit_posts');
  20.  
  21. function theme_add_scripts() {
  22. wp_enqueue_script('jquery');
  23. wp_enqueue_script('nivoslider', get_bloginfo('stylesheet_directory').'/js/jquery.nivo.slider.pack.js', 'jquery', '2.1');
  24. wp_enqueue_script('nivoslider-custom', get_bloginfo('stylesheet_directory').'/js/slider.js', 'jquery');
  25. }
  26. add_action('init', 'theme_add_scripts');
  27.  
  28. function theme_add_styles() {
  29. wp_enqueue_style('nivoslider', get_bloginfo('stylesheet_directory').'/js/nivo-slider.css', false, '2.1');
  30. }
  31. add_action('init', 'theme_add_styles');
  32.  
  33. register_sidebar( array(
  34. 'name'=>'Barra lateral Direita',
  35. 'before_widget' => '<div id="%1$s" class="%2$s">',
  36. 'after_widget' => '</div>',
  37. 'before_title' => '<div class="titlebar">',
  38. 'after_title' => '</div>',
  39. ) );
  40.  
  41. /*Pagination */
  42. function kriesi_pagination($pages = '', $range = 2)
  43. {
  44. $showitems = ($range * 2)+1;
  45.  
  46. global $paged;
  47. if(empty($paged)) $paged = 1;
  48.  
  49. if($pages == '')
  50. {
  51. global $wp_query;
  52. $pages = $wp_query->max_num_pages;
  53. if(!$pages)
  54. {
  55. $pages = 1;
  56. }
  57. }
  58.  
  59. if(1 != $pages)
  60. {
  61. echo "<div class='pagination'>";
  62. if($paged > 2 && $paged > $range+1 && $showitems < $pages) echo "<a href='".get_pagenum_link(1)."'>&laquo;</a>";
  63. if($paged > 1 && $showitems < $pages) echo "<a href='".get_pagenum_link($paged - 1)."'>&lsaquo;</a>";
  64.  
  65. for ($i=1; $i <= $pages; $i++)
  66. {
  67. if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems ))
  68. {
  69. echo ($paged == $i)? "<span class='current'>".$i."</span>":"<a href='".get_pagenum_link($i)."' class='inactive' >".$i."</a>";
  70. }
  71. }
  72.  
  73. if ($paged < $pages && $showitems < $pages) echo "<a href='".get_pagenum_link($paged + 1)."'>&rsaquo;</a>";
  74. if ($paged < $pages-1 && $paged+$range-1 < $pages && $showitems < $pages) echo "<a href='".get_pagenum_link($pages)."'>&raquo;</a>";
  75. echo "</div>\n";
  76. }
  77. }
  78. /*Autor Box */
  79. function extra_contact_info($contactmethods) {
  80. unset($contactmethods['yim']);
  81. unset($contactmethods['jabber']);
  82. $contactmethods['facebook'] = 'Facebook';
  83. $contactmethods['twitter'] = 'Twitter';
  84. return $contactmethods;
  85. }
  86. add_filter('user_contactmethods', 'extra_contact_info');
  87. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement