Guest User

Untitled

a guest
Jan 24th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.87 KB | None | 0 0
  1. <?php
  2. if ( function_exists('register_sidebar') )
  3. {
  4.     register_sidebar(array(
  5.         'before_widget' => '<li id="%1$s" class="widget %2$s">',
  6.         'after_widget' => '</li>',
  7.         'before_title' => '<h2 class="widgettitle">',
  8.         'after_title' => '</h2>',
  9.     ));
  10. }
  11.  
  12. function wp_list_pages2($limit=NULL) {
  13.    
  14.     $defaults = array('depth' => 0, 'show_date' => '', 'date_format' => get_option('date_format'),
  15.         'child_of' => 0, 'exclude' => '', 'title_li' =>'', 'echo' => 1, 'authors' => '', 'sort_column' => 'menu_order, post_title');
  16.     $r = array_merge((array)$defaults, (array)$r);
  17.  
  18.     $output = '';
  19.     $current_page = 0;
  20.  
  21.     // sanitize, mostly to keep spaces out
  22.     $r['exclude'] = preg_replace('[^0-9,]', '', $r['exclude']);
  23.  
  24.     // Allow plugins to filter an array of excluded pages
  25.     $r['exclude'] = implode(',', apply_filters('wp_list_pages_excludes', explode(',', $r['exclude'])));
  26.  
  27.     // Query pages.
  28.     $pages = get_pages($r);
  29.  
  30.     if ( !empty($pages) ) {
  31.  
  32.         for($i=0;$i<count($pages);$i++)
  33.         {
  34.             $output .='<li><a href="'.get_page_link($pages[$i]->ID).'">'.$pages[$i]->post_title.'</a></li>';
  35.             if($limit!=NULL)
  36.             {
  37.                 break;
  38.             }
  39.         }
  40.     }
  41.  
  42.     $output = apply_filters('wp_list_pages', $output);
  43.  
  44.     echo $output;
  45. }
  46.  
  47.  
  48. /* JS for bokmark */
  49. wp_enqueue_script( 'config', '/wp-includes/js/config.js', false, NULL );
  50. add_action( 'wp_head', 'wp_enqueue_script');
  51.  
  52. /* Remove unusful header metatags */
  53. remove_action( 'wp_head', 'feed_links_extra', 3 );
  54. remove_action( 'wp_head', 'feed_links', 2 );
  55. remove_action( 'wp_head', 'rsd_link' );
  56. remove_action( 'wp_head', 'wlwmanifest_link' );
  57. remove_action( 'wp_head', 'index_rel_link' );
  58. remove_action( 'wp_head', 'parent_post_rel_link', 10, 0 );
  59. remove_action( 'wp_head', 'start_post_rel_link', 10, 0 );
  60. remove_action( 'wp_head', 'adjacent_posts_rel_link', 10, 0 );
  61. remove_action( 'wp_head', 'wp_generator' );
  62. ?>
Add Comment
Please, Sign In to add comment