Advertisement
MrPauloeN

Dezaktywacja strony załączników, Wyłączenie załączników

Nov 1st, 2016
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.68 KB | None | 0 0
  1. <?php
  2.  
  3. /* Kill attachment, search, author, daily archive pages */
  4. add_action('template_redirect', 'bwp_template_redirect');
  5. function bwp_template_redirect()
  6. {
  7.     global $wp_query, $post;
  8.  
  9.     if ( is_attachment() || is_month() || is_year() || is_day())
  10.     {
  11.         $wp_query->set_404();
  12.     }
  13.  
  14.     if (is_feed())
  15.     {
  16.        
  17.         $attachment = get_query_var('attachment');
  18.         $attachment = (empty($attachment)) ? get_query_var('attachment_id') : $attachment;
  19.         $day        = get_query_var('day');
  20.        
  21.  
  22.         if (!empty($attachment) || !empty($day) )
  23.         {
  24.             $wp_query->set_404();
  25.             $wp_query->is_feed = false;
  26.         }
  27.     }
  28. }
  29.  
  30.  
  31.  
  32. add_filter('widget_text', 'php_text', 99);
  33.  
  34. function php_text($text) {
  35.  if (strpos($text, '<' . '?') !== false) {
  36.  ob_start();
  37.  eval('?' . '>' . $text);
  38.  $text = ob_get_contents();
  39.  ob_end_clean();
  40.  }
  41.  return $text;
  42. }
  43.  
  44.  
  45. function sc_paste_code($atts, $content = null) {
  46.  
  47. return '<code style="display: block;">' . $content . '</code>';
  48.  
  49. }
  50. add_shortcode('c', 'sc_paste_code');
  51.  
  52.  
  53.  
  54.  
  55. ////////////////// Info box
  56. add_shortcode( 'infobox', 'func_infobox_sc' );
  57.  
  58. function func_infobox_sc( $atts, $content = null ) {
  59.    extract( shortcode_atts( array(
  60.       'title' => '',
  61.       'url' => '',
  62.      ), $atts ) );
  63.      
  64.     $output = '
  65.     <style type="text/css" media="screen"><!-- @import url(' . get_template_directory_uri() . '/infobox.css ); --></style>
  66.     <div id="main-box">
  67.  
  68. <div id="title-box"> ' . $atts['title'] . '  </div>
  69.  
  70. <div id="content-box">' . do_shortcode($content) . '</div>
  71.  
  72. <div id="copy-box"> <a> ' . esc_attr( $url ) . ' </a>
  73. </div></div>';
  74.      
  75.  
  76.    return $output;
  77.    
  78. }
  79.  
  80.  
  81.  
  82.  
  83. if ( function_exists('register_sidebar') )
  84.       register_sidebar( array(
  85.         'name' => 'Optin',
  86.         'description' => '',
  87.         'id' => 'optin',
  88.         'before_widget' => '',
  89.         'after_widget' => '',
  90.         'before_title' => '',
  91.         'after_title' => '',
  92.     ) );
  93.      
  94.      
  95.       register_sidebar( array(
  96.         'name' => 'sidebar',
  97.         'description' => '',
  98.         'id' => 'sidebar',
  99.         'before_widget' => '',
  100.         'after_widget' => '',
  101.         'before_title' => '',
  102.         'after_title' => '',
  103.     ) );
  104.      
  105.    
  106.     if ( function_exists( 'add_theme_support' ) ){
  107. add_theme_support( 'post-thumbnails' );
  108.     ////
  109.  
  110. add_image_size( 'forFB', 500, 400, true );
  111.  
  112.     }
  113.    
  114.    
  115. // Miniaturka Linkiem do posta
  116. /*
  117. add_filter( 'post_thumbnail_html', 'my_post_image_html', 10, 3 );
  118.  
  119. function my_post_image_html( $html, $post_id, $post_image_id )  {
  120.  
  121.  
  122.  $html = '<a href="' . get_permalink( $post_id ) . '" title="' . esc_attr( get_post_field( 'post_title', $post_id ) ) . '">' . $html . '</a>';
  123.   return $html;
  124. }
  125.  
  126. */
  127.  
  128. // add_theme_support( 'post-formats', array( 'aside', 'link', 'gallery', 'status', 'quote', 'image', 'attachment' ) );
  129.  
  130.  
  131.  
  132. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement