Advertisement
RodrigoCasttro

functions_page_nativa

May 16th, 2013
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.03 KB | None | 0 0
  1. <?php
  2.  
  3. $functions_path = TEMPLATEPATH . '/functions/';
  4. $includes_path = TEMPLATEPATH . '/includes/';
  5.  
  6. //Loading jQuery and Scripts
  7. require_once $includes_path . 'theme-scripts.php';
  8.  
  9. //Widget and Sidebar
  10. require_once $includes_path . 'sidebar-init.php';
  11. require_once $includes_path . 'register-widgets.php';
  12.  
  13. //Theme initialization
  14. require_once $includes_path . 'theme-init.php';
  15.  
  16. //Additional function
  17. require_once $includes_path . 'theme-function.php';
  18.  
  19. //Shortcodes
  20. require_once $includes_path . 'theme_shortcodes/shortcodes.php';
  21. include_once(TEMPLATEPATH . '/includes/theme_shortcodes/alert.php');
  22. include_once(TEMPLATEPATH . '/includes/theme_shortcodes/tabs.php');
  23. include_once(TEMPLATEPATH . '/includes/theme_shortcodes/toggle.php');
  24. include_once(TEMPLATEPATH . '/includes/theme_shortcodes/html.php');
  25.  
  26. //tinyMCE includes
  27. include_once(TEMPLATEPATH . '/includes/theme_shortcodes/tinymce/tinymce_shortcodes.php');
  28.  
  29. // removes detailed login error information for security
  30. add_filter('login_errors',create_function('$a', "return null;"));
  31.  
  32. if ( !function_exists( 'optionsframework_init' ) ) {
  33.  
  34.  
  35. /*-----------------------------------------------------------------------------------*/
  36. /* Options Framework Theme
  37. /*-----------------------------------------------------------------------------------*/
  38.  
  39. /* Set the file path based on whether the Options Framework Theme is a parent theme or child theme */
  40.  
  41. if ( STYLESHEETPATH == TEMPLATEPATH ) {
  42. define('OPTIONS_FRAMEWORK_URL', TEMPLATEPATH . '/admin/');
  43. define('OPTIONS_FRAMEWORK_DIRECTORY', get_bloginfo('template_directory') . '/admin/');
  44. } else {
  45. define('OPTIONS_FRAMEWORK_URL', STYLESHEETPATH . '/admin/');
  46. define('OPTIONS_FRAMEWORK_DIRECTORY', get_bloginfo('stylesheet_directory') . '/admin/');
  47. }
  48.  
  49. require_once (OPTIONS_FRAMEWORK_URL . 'options-framework.php');
  50.  
  51. }
  52.  
  53. // Removes Trackbacks from the comment cout
  54. add_filter('get_comments_number', 'comment_count', 0);
  55. function comment_count( $count ) {
  56. if ( ! is_admin() ) {
  57. global $id;
  58. $comments_by_type = &separate_comments(get_comments('status=approve&post_id=' . $id));
  59. return count($comments_by_type['comment']);
  60. } else {
  61. return $count;
  62. }
  63. }
  64.  
  65.  
  66. // enable shortcodes in sidebar
  67. add_filter('widget_text', 'do_shortcode');
  68.  
  69. // custom excerpt ellipses for 2.9+
  70. function custom_excerpt_more($more) {
  71. return 'Read More &raquo;';
  72. }
  73. add_filter('excerpt_more', 'custom_excerpt_more');
  74. // no more jumping for read more link
  75. function no_more_jumping($post) {
  76. return '&nbsp;<a href="'.get_permalink($post->ID).'" class="read-more">'.'Continue Reading'.'</a>';
  77. }
  78. add_filter('excerpt_more', 'no_more_jumping');
  79.  
  80.  
  81. // category id in body and post class
  82. function category_id_class($classes) {
  83. global $post;
  84. foreach((get_the_category($post->ID)) as $category)
  85. $classes [] = 'cat-' . $category->cat_ID . '-id';
  86. return $classes;
  87. }
  88.  
  89. /** Pagination */
  90. function pagination_funtion() {
  91. // Get total number of pages
  92. global $wp_query;
  93. $total = $wp_query->max_num_pages;
  94. // Only paginate if we have more than one page
  95. if ( $total > 1 ) {
  96. // Get the current page
  97. if ( !$current_page = get_query_var('paged') )
  98. $current_page = 1;
  99.  
  100. $big = 999999999;
  101. // Structure of "format" depends on whether we’re using pretty permalinks
  102. $permalink_structure = get_option('permalink_structure');
  103. $format = emptyempty( $permalink_structure ) ? '&page=%#%' : 'page/%#%/';
  104. echo paginate_links(array(
  105. 'base' => str_replace( $big, '%#%', get_pagenum_link( $big ) ),
  106. 'format' => $format,
  107. 'current' => $current_page,
  108. 'total' => $total,
  109. 'mid_size' => 2,
  110. 'type' => 'list'
  111. ));
  112. }
  113. }
  114. /** END Pagination */
  115.  
  116. add_filter('post_class', 'category_id_class');
  117. add_filter('body_class', 'category_id_class');
  118.  
  119. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement