Advertisement
Guest User

Untitled

a guest
Aug 3rd, 2015
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 25.46 KB | None | 0 0
  1. <?php
  2. /**
  3.  * @KingSize 2011
  4.  * Developed by OurWebMedia - http://www.ourwebmedia.com
  5.  **/
  6.  
  7. #---------------------------------------------------------------#
  8. ###################### Get custom function ######################
  9. #---------------------------------------------------------------#
  10.  
  11. include (get_template_directory() . "/lib/custom.lib.php");
  12.  
  13. #---------------------------------------------------------------#
  14. ###################### Update notification ######################
  15. #---------------------------------------------------------------#
  16.  
  17. include (get_template_directory() . "/lib/theme-update-notification.php");
  18.  
  19. #--------------------------------------------------------------------------#
  20. ###################### Setup Theme page custom fields ######################
  21. #--------------------------------------------------------------------------#
  22.  
  23. include (get_template_directory() . "/lib/theme-page-custom-fields.php");
  24.  
  25. #--------------------------------------------------------------------------#
  26. ###################### Setup Theme post custom fields ######################
  27. #--------------------------------------------------------------------------#
  28.  
  29. include (get_template_directory() . "/lib/theme-post-custom-fields.php");
  30.  
  31. #---------------------------------------------------------------#
  32. ######################  Widget for sidebar ######################
  33. #---------------------------------------------------------------#
  34.  
  35. require_once (get_template_directory() . '/lib/widget-contact-info.php');
  36. require_once (get_template_directory() . '/lib/widget-twitter.php');
  37. require_once (get_template_directory() . '/lib/gallery-widget/gallery_widget.php');
  38.  
  39. #------------------------------------------------------------#
  40. ###################### Image Resizer V4 ######################
  41. #------------------------------------------------------------#
  42.  
  43. require_once(get_template_directory() . '/lib/image-resizer.php');
  44.  
  45. #---------------------------------------------------------------#
  46. ###################### WordPress Functions ######################
  47. #---------------------------------------------------------------#
  48.  
  49. /** Tell WordPress to run kingsize_setup() when the 'after_setup_theme' hook is run. **/
  50. add_action( 'after_setup_theme', 'kingsize_setup' );
  51.  
  52. if ( ! function_exists( 'kingsize_setup' ) ):
  53.  
  54.  /**
  55.  * Sets up theme defaults and registers support for various WordPress features.
  56.  * @uses add_theme_support() To add support for post thumbnails and automatic feed links.
  57.  * @uses register_nav_menus() To add support for navigation menus.
  58.  * @uses add_custom_background() To add support for a custom background.
  59.  * @uses add_editor_style() To style the visual editor.
  60.  * @uses load_theme_textdomain() For translation/localization support.
  61.  * @uses add_custom_image_header() To add support for a custom header.
  62.  * @uses register_default_headers() To register the default custom header images provided with the theme.
  63.  * @uses set_post_thumbnail_size() To set a custom post thumbnail size.
  64.  **/
  65.  
  66. function kingsize_setup() {
  67.     // This theme uses post thumbnails
  68.     //Deprecated from WP 3.9 add_theme_support( 'post-thumbnails', array( 'post', 'slider', 'track' ) );
  69.    
  70.     if ( function_exists( 'add_theme_support' ) ) {
  71.         add_theme_support( 'post-thumbnails' );
  72.         set_post_thumbnail_size( 460, 180, true );
  73.         add_image_size( 'thumbnail-post', 200, 150, true ); // Post portfolio thumbnails
  74.     }  
  75.     // Add default posts and comments RSS feed links to head
  76.     add_theme_support( 'automatic-feed-links' );   
  77. }
  78. endif;
  79.  
  80.  
  81. //$GLOBALS['content_width'] = 640;
  82.  
  83.  
  84. /**
  85.  *
  86.  * This removes the ability to add the FULL image size into a post, it does not alter or delete the image
  87.  * Add whataever extra image sizes to the insert dropdown in WordPress you create via add_image_size
  88.  *
  89.  *  For now we have to do it this way to make the labels translatable, see trac ref below.
  90.  *
  91.  *  If your theme has $content_width GLOBAL make sure and remove it
  92. */
  93. //example to add post-size instead of using $content_width and a max-size
  94. add_image_size( 'post-size', 460, 9999, true);
  95. add_image_size( 'max-size', 680, 9999, true);
  96.  
  97. // over-ride image_size_names_choose
  98. function add_image_insert_override($size_names){
  99.  
  100.   global $_wp_additional_image_sizes;
  101.  
  102.        //default array with hardcoded values for add_image_size
  103.         $size_names = array(
  104.                           'thumbnail' => __('Thumbnail', 'kslang'),
  105.                           'medium'    => __('Medium', 'kslang'),
  106.                           'large'     => __('Large', 'kslang'),
  107.                           'post-size' => __('Post Size', 'kslang'),
  108.                           'max-size'  => __('Max Size', 'kslang'),
  109.                           'full'      => __('Full Size', 'kslang')
  110.                         );
  111.  
  112.       return $size_names;
  113.  
  114. };
  115.  
  116. add_filter('image_size_names_choose', 'add_image_insert_override' );
  117.  
  118.  
  119. #--------------------------------------------------------------------------#
  120. ######################  Change Default Excerpt Length ######################
  121. #--------------------------------------------------------------------------#
  122.  
  123. function kingsize_excerpt_length($length) {
  124. return 30; }
  125. add_filter('excerpt_length', 'kingsize_excerpt_length');
  126.  
  127. #---------------------------------------------------------------------#
  128. ######################  Configure Excerpt String ######################
  129. #---------------------------------------------------------------------#
  130.  
  131. function kingsize_excerpt_more($excerpt) {
  132. return str_replace('[...]', '...', $excerpt); }
  133. add_filter('wp_trim_excerpt', 'kingsize_excerpt_more');
  134.  
  135.  
  136.  
  137. #------------------------------------------------------------------------------------------#
  138. ###################### Get our wp_nav_menu() fallback, wp_page_menu() ######################
  139. #------------------------------------------------------------------------------------------#
  140.  
  141. function kingsize_page_menu_args( $args ) {
  142.     $args['show_home'] = true;
  143.     return $args;
  144. }
  145. add_filter( 'wp_page_menu_args', 'kingsize_page_menu_args' );
  146.  
  147. #---------------------------------------------------------------------------#
  148. ###################### Widget Ready / Enabled Sidebars ######################
  149. #---------------------------------------------------------------------------#
  150.  
  151. function kingsize_widgets_init() {
  152.     register_sidebar( array(
  153.         'name' => 'Main Blog Sidebar',
  154.         'id' => 'primary-widget-area',
  155.         'description' => 'The main WordPress sidebar.',
  156.         'before_widget' => '<div id="%1$s" class="widget-container %2$s">',
  157.         'after_widget' => '</div>',
  158.         'before_title' => '<h3 class="widget-title">',
  159.         'after_title' => '</h3>',
  160.     ) );
  161.    
  162.     register_sidebar( array(
  163.         'name' => 'Pages Sidebar',
  164.         'id' => 'pages-sidebar',
  165.         'description' => 'Sidebar specific to Pages.',
  166.         'before_widget' => '<div id="%1$s" class="widget-container %2$s">',
  167.         'after_widget' => '</div>',
  168.         'before_title' => '<h3 class="widget-title">',
  169.         'after_title' => '</h3>',
  170.     ) );
  171.    
  172.     register_sidebar( array(
  173.         'name' => 'Contact Page Sidebar',
  174.         'id' => 'contact-page-sidebar',
  175.         'description' => 'Ideal for additional contact details, displayed as the Sidebar on the Contact Page. Can be used for anything.',
  176.         'before_widget' => '<div id="%1$s" class="widget-container %2$s">',
  177.         'after_widget' => '</div>',
  178.         'before_title' => '<h3 class="widget-title">',
  179.         'after_title' => '</h3>',
  180.     ) );
  181.  
  182.     register_sidebar( array(
  183.         'name' => 'Footer Column Left',
  184.         'id' => 'first-footer-widget-area',
  185.         'description' => 'The first footer widget area / column.',
  186.         'before_widget' => '<div id="%1$s" class="widget-container %2$s">',
  187.         'after_widget' => '</div>',
  188.         'before_title' => '<h3 class="widget-title">',
  189.         'after_title' => '</h3>',
  190.     ) );
  191.  
  192.     register_sidebar( array(
  193.         'name' => 'Footer Column Center',
  194.         'id' => 'second-footer-widget-area',
  195.         'description' => 'The second footer widget area / column.',
  196.         'before_widget' => '<div id="%1$s" class="widget-container %2$s">',
  197.         'after_widget' => '</div>',
  198.         'before_title' => '<h3 class="widget-title">',
  199.         'after_title' => '</h3>',
  200.     ) );
  201.  
  202.     register_sidebar( array(
  203.         'name' => 'Footer Column Right',
  204.         'id' => 'third-footer-widget-area',
  205.         'description' => 'The third footer widget area / column.',
  206.         'before_widget' => '<div id="%1$s" class="widget-container %2$s">',
  207.         'after_widget' => '</div>',
  208.         'before_title' => '<h3 class="widget-title">',
  209.         'after_title' => '</h3>',
  210.     ) );
  211.    
  212. }
  213.  
  214. #--------------------------------------------------------------------#
  215. ###################### Register Widget Sidebars ######################
  216. #--------------------------------------------------------------------#
  217.  
  218. add_action( 'widgets_init', 'kingsize_widgets_init' );
  219.  
  220. #------------------------------------------------------------------#
  221. ###################### Comment Style Settings ######################
  222. #------------------------------------------------------------------#
  223.  
  224. function kingsize_remove_recent_comments_style() {
  225.     global $wp_widget_factory;
  226.     remove_action( 'wp_head', array( $wp_widget_factory->widgets['WP_Widget_Recent_Comments'], 'recent_comments_style' ) );
  227. }
  228. add_action( 'widgets_init', 'kingsize_remove_recent_comments_style' );
  229.  
  230. #-----------------------------------------------------------------#
  231. ###################### Theme Options Setting ######################
  232. #-----------------------------------------------------------------#
  233.  
  234. global $data;
  235. require_once ('admin/index.php');
  236.  
  237. #-----------------------------------------------------------------#
  238. ###################### Menu Navitation Setup ######################
  239. #-----------------------------------------------------------------#
  240.  
  241. require_once ('lib/menu-walker.php');
  242.  
  243. add_action( 'init', 'register_my_menus' );
  244. function register_my_menus() {
  245. register_nav_menus(array(
  246. 'header-nav' => __( 'Header Navigation', 'kslang' )
  247. ));
  248. }
  249.  
  250. #-----------------------------------------------------#
  251. ###################### Home Body ######################
  252. #-----------------------------------------------------#
  253.  
  254. function my_plugin_body_class($classes) {
  255.     $classes[] = 'body_portfolio body_colorbox body_gallery_2col_cb';
  256.     return $classes;
  257. }
  258. add_filter('body_class', 'my_plugin_body_class');
  259.  
  260. #-------------------------------------------------------------#
  261. ###################### Admin E-MAIL HERE ######################
  262. #-------------------------------------------------------------#
  263.  
  264. define("webmaster_email", $data['wm_contact_email']);
  265. define("thanks_message", $data['wm_contact_email_template']);
  266.  
  267. #-----------------------------------------------------------------------#
  268. ######################  Enqueue Scripts and Styles ######################
  269. #-----------------------------------------------------------------------#
  270.  
  271. function my_init_method() {
  272. global $data;
  273.  
  274.     if (!is_admin()) {
  275.         wp_deregister_script( 'jquery' );
  276.         wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js');
  277.         wp_enqueue_script( 'jquery' );
  278.    
  279.         // register Google Fonts stylesheet
  280.         if($data['wm_google_fonts']!='')
  281.             wp_register_style( 'google-fonts', $data['wm_google_fonts']);
  282.         else
  283.             wp_register_style( 'google-fonts', 'http://fonts.googleapis.com/css?family=PT+Sans+Narrow|PT+Sans:i,b,bi');
  284.  
  285.         // enqueue Google Fonts stylesheet
  286.         wp_enqueue_style( 'google-fonts');
  287.                
  288.         wp_register_script('custom', get_template_directory_uri() . "/js/custom.js");
  289.         wp_enqueue_script('custom');
  290.  
  291.         wp_register_script('tipsy', get_template_directory_uri() . "/js/jquery.tipsy.js");
  292.         wp_enqueue_script('tipsy');  
  293.        
  294.         ##### V4.0.2 update ########
  295.         //registering prettyphoto style and script
  296.         wp_register_style( 'prettyphoto-css', get_template_directory_uri().'/css/prettyPhoto.css');
  297.         wp_register_script('prettyphoto-js', get_template_directory_uri() . "/js/jquery.prettyPhoto.js");
  298.  
  299.         //Google Map
  300.         wp_register_script( 'google-map', 'http://maps.google.com/maps/api/js?sensor=true');
  301.  
  302.     }
  303. }    
  304.  
  305. add_action('init', 'my_init_method');
  306.  
  307. #-----------------------------------------------------------#
  308. ######################  Add shortcodes ######################
  309. #-----------------------------------------------------------#
  310.  
  311. include (get_template_directory() . "/lib/shortcodes.php");
  312.  
  313. #----------------------------------------------------#
  314. ######################  TinyMCE ######################
  315. #----------------------------------------------------#
  316.  
  317. require_once (get_template_directory() . '/lib/tinymce/tinymce.php');
  318.  
  319. #--------------------------------------------------------------------#
  320. ######################  Password protected page ######################
  321. #--------------------------------------------------------------------#
  322.  
  323. function wm_the_password_form() {
  324.     global $post;
  325.  
  326.     $label = 'pwbox-'.(empty($post->ID) ? rand() : $post->ID);
  327.     $output = '<form action="' . get_option('siteurl') . '/wp-login.php?action=postpass" method="post">
  328.    <p><strong>' . __("Content is password protected. Please enter password:", "kslang") . '</strong></p>
  329.    <p><div for="' . $label . '" style="padding-top:10px;">' . __("Password", "kslang") . '</div><div style="padding-top:10px;"> <input name="post_password" id="' . $label . '" type="password" size="20" /> <input type="submit" name="Submit" value="' . esc_attr__("Login") . '" /></div></p>
  330.    </form>';
  331.  
  332.     return $output;
  333. }
  334. add_filter('the_password_form', 'wm_the_password_form');
  335.  
  336. #-----------------------------------------------------------------#
  337. ######################  Get the Blog Content ######################
  338. #-----------------------------------------------------------------#
  339.  
  340. function get_content($more_link_text = '(more...)', $stripteaser = 0, $more_file = '')
  341. {
  342.     $content = get_the_content($more_link_text, $stripteaser, $more_file);
  343.     $content = apply_filters('the_content', $content);
  344.     $content = str_replace(']]>', ']]&gt;', $content);
  345.     return $content;
  346. }
  347.  
  348. // Added v3.0
  349. #------------------------------------------------------------------------------------------#
  350. ######################  List categories for the portfolio in frontend ######################
  351. #------------------------------------------------------------------------------------------#
  352.  
  353. class Portfolio_Walker extends Walker_Category {
  354.    function start_el(&$output, $category, $depth, $args) {
  355.       extract($args);
  356.       $cat_name = esc_attr( $category->name);
  357.       $cat_name = apply_filters( 'list_cats', $cat_name, $category );
  358.       $link = '<a href="#" data-value="'.strtolower(preg_replace('/\s+/', '-', $cat_name)).'" ';
  359.       if ( $use_desc_for_title == 0 || empty($category->description) )
  360.          $link .= 'title="' . sprintf(__( 'View all items filed under %s', 'kslang' ), $cat_name) . '"';
  361.       else
  362.          $link .= 'title="' . esc_attr( strip_tags( apply_filters( 'category_description', $category->description, $category ) ) ) . '"';
  363.       $link .= '>';
  364.       // $link .= $cat_name . '</a>';
  365.       $link .= $cat_name;
  366.       if(!empty($category->description)) {
  367.          $link .= ' <span>'.$category->description.'</span>';
  368.       }
  369.       $link .= '</a>';
  370.       if ( (! empty($feed_image)) || (! empty($feed)) ) {
  371.          $link .= ' ';
  372.          if ( empty($feed_image) )
  373.             $link .= '(';
  374.          $link .= '<a href="' . get_category_feed_link($category->term_id, $feed_type) . '"';
  375.          if ( empty($feed) )
  376.             $alt = ' alt="' . sprintf(__( 'Feed for all posts filed under %s', 'kslang' ), $cat_name ) . '"';
  377.          else {
  378.             $title = ' title="' . $feed . '"';
  379.             $alt = ' alt="' . $feed . '"';
  380.             $name = $feed;
  381.             $link .= $title;
  382.          }
  383.          $link .= '>';
  384.          if ( empty($feed_image) )
  385.             $link .= $name;
  386.          else
  387.             $link .= "<img src='$feed_image'$alt$title" . ' />';
  388.          $link .= '</a>';
  389.          if ( empty($feed_image) )
  390.             $link .= ')';
  391.       }
  392.       if ( isset($show_count) && $show_count )
  393.          $link .= ' (' . intval($category->count) . ')';
  394.       if ( isset($show_date) && $show_date ) {
  395.          $link .= ' ' . gmdate('Y-m-d', $category->last_update_timestamp);
  396.       }
  397.       if ( isset($current_category) && $current_category )
  398.          $_current_category = get_category( $current_category );
  399.       if ( 'list' == $args['style'] ) {
  400.           $output .= '<li class="segment-'.rand(2, 99).'"';
  401.           $class = 'cat-item cat-item-'.$category->term_id;
  402.           if ( isset($current_category) && $current_category && ($category->term_id == $current_category) )
  403.              $class .=  ' current-cat';
  404.           elseif ( isset($_current_category) && $_current_category && ($category->term_id == $_current_category->parent) )
  405.              $class .=  ' current-cat-parent';
  406.           $output .=  '';
  407.           $output .= ">$link\n";
  408.        } else {
  409.           $output .= "\t$link<br />\n";
  410.        }
  411.    }
  412. }
  413.  
  414. #---------------------------------------------------------------#
  415. ######################  Portfolio in Admin ######################
  416. #---------------------------------------------------------------#
  417.  
  418. // create the portfolio Post types for admin
  419. include(get_template_directory() ."/lib/portfolio/portfolio-posttype.php");
  420.  
  421. // Add the Portfolio Custom Meta
  422. include(get_template_directory() ."/lib/portfolio/portfolio-meta.php");
  423.  
  424. // Add the portfolio Custom Fields
  425. // 6/26/2013 commented in V 4.1 include(get_template_directory() ."/lib/portfolio/portfolio-custom-fields.php");
  426.  
  427. include(get_template_directory() ."/lib/portfolio/portfolio-functions.php");
  428.  
  429. ///removing the custom field from the writeup panel
  430. function remove_metaboxes() {
  431.  remove_meta_box( 'postcustom' , 'portfolio' , 'normal' ); //removes custom fields for page
  432.  remove_meta_box( 'postcustom' , 'post' , 'normal' ); //removes custom fields for page
  433.  remove_meta_box( 'postcustom' , 'page' , 'normal' ); //removes custom fields for page
  434. }
  435. add_action( 'admin_menu' , 'remove_metaboxes' );
  436.  
  437. ////Include Custom Post Types Portfolio in Search Results and Archives
  438. function filter_search($query) {
  439.     if ($query->is_search) {
  440.     $query->set('post_type', array('post','page','Portfolio'));
  441.     };
  442.     return $query;
  443. };
  444. if (!is_admin())    {
  445. add_filter('pre_get_posts', 'filter_search');
  446. }
  447.  
  448.  
  449. //// add a default-gravatar to options ////
  450. function newgravatar ($avatar_defaults) {
  451.     $myavatar = get_template_directory_uri() . '/images/comment_avatar.jpg';
  452.     $avatar_defaults[$myavatar] = "KingSize Gravatar";
  453.     return $avatar_defaults;
  454. }
  455. add_filter( 'avatar_defaults', 'newgravatar' );
  456.  
  457. ########### To identify the first and last menu item ##########
  458. function mytheme_options() {
  459.     global $wpdb;
  460.    
  461.     $topmenuid = get_theme_mod('nav_menu_locations');
  462.     if ($topmenuid['header-nav'] != '0') {
  463.         $menutermtax = $wpdb->get_var("SELECT term_taxonomy_id FROM $wpdb->term_taxonomy WHERE term_id = " . $topmenuid['header-nav']);
  464.        
  465.         $menuitem_post_ids = $wpdb->get_var("
  466.         SELECT posts.ID
  467.         FROM " . $wpdb->prefix . "posts AS posts
  468.         INNER JOIN (
  469.         SELECT object_id
  470.         FROM " . $wpdb->prefix . "term_relationships
  471.         WHERE term_taxonomy_id = " . $menutermtax . "
  472.         ) AS termid ON termid.object_id = posts.ID
  473.         ORDER BY posts.menu_order DESC
  474.         LIMIT 1
  475.         ");
  476.        
  477.         set_theme_mod('lastmenuitem',$menuitem_post_ids);
  478.     }
  479. }
  480. add_action('init', 'mytheme_options');
  481.  
  482. #----------------------------------------------------------------------#
  483. ###################### New Additions in Version 4 ######################
  484. #----------------------------------------------------------------------#
  485.  
  486. // create the slider Post types for admin
  487. include(get_template_directory() ."/lib/slider/slider-posttype.php");
  488. // Add the slider Custom Meta
  489. include(get_template_directory() ."/lib/slider/slider-meta.php");
  490.  
  491. // create the gallery Post types for admin
  492. include(get_template_directory() ."/lib/gallery/gallery-posttype.php");
  493.  
  494. // Add the gallery Custom Meta
  495. include(get_template_directory() ."/lib/gallery/gallery-meta.php");
  496.  
  497.  
  498. include(get_template_directory() ."/lib/gallery/gallery_shortcodes.php");
  499.  
  500. // language files
  501. load_theme_textdomain('kslang', get_template_directory() . '/lang');
  502. $locale = get_locale();
  503. $locale_file = get_template_directory()."/lang/$locale.php";
  504. if(is_readable($locale_file)) require_once($locale_file);
  505.  
  506. //ON activation of theme update data of the theme
  507. require_once get_template_directory()."/lib/theme_activation_hook.php";
  508.  
  509. //Simply shows the ID of Posts, Pages, Media, Links, Categories, Tags and Users in the admin tables for easy access.
  510. include(get_template_directory() ."/lib/simply-show-ids.php");
  511.  
  512. #### Check this box if you want to hide/collapse the navigation by default. #####
  513. if($data['wm_navigation_hide_enabled'] == "Hide the Navigation on All Pages" || $data['wm_navigation_hide_enabled'] == "1")
  514. {
  515.     add_filter('body_class','kingsize_body_menu_hide');
  516. }
  517. elseif($data['wm_navigation_hide_enabled'] == "Hide the Navigation only on Homepage"){
  518.  
  519.    add_action('get_header', 'kingsize_get_method'); //Call the get header action hook to call is_home function etc
  520.     function kingsize_get_method() {
  521.       if (is_page('home')) { //have also used is_page('home') to no avail
  522.          add_filter('body_class','kingsize_body_menu_hide');         
  523.       }
  524.       elseif(is_home()){
  525.            add_filter('body_class','kingsize_body_menu_hide');         
  526.        }
  527.     }
  528. }
  529.  
  530. ### slider controller position ###
  531.  
  532.     $slider_controller_position = '';
  533.  
  534. //getting the post ID
  535. $url = explode('?', 'http://'.$_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]);
  536. $ID = url_to_postid($url[0]);
  537.  
  538. /*
  539. if(get_post_meta($ID, 'kingsize_post_slider_controller_position', true ) == 'display_controls_bottom')
  540.     $slider_controller_position = 'Display Controls on Bottom of Slider Content';
  541. elseif(get_post_meta($ID, 'kingsize_page_slider_controller_position', true ) == 'display_controls_bottom')
  542.     $slider_controller_position = 'Display Controls on Bottom of Slider Content';
  543. elseif(get_post_meta($ID, 'kingsize_portfolio_slider_controller_position', true ) == 'display_controls_bottom')
  544.     $slider_controller_position = 'Display Controls on Bottom of Slider Content';
  545. elseif( $data['wm_slider_controller_position'] == "Display Controls on Bottom of Slider Content" )
  546.     $slider_controller_position = 'Display Controls on Bottom of Slider Content';
  547. else
  548.    $slider_controller_position = '';
  549.  
  550. if($slider_controller_position == "Display Controls on Bottom of Slider Content")
  551. {
  552.     add_filter('body_class','kingsize_body_slider_text_position');
  553. }
  554.  
  555. function kingsize_body_slider_text_position($classes){
  556.     $classes[] = 'slider_details_bottom';
  557.     return $classes;
  558. }
  559. */
  560.  
  561.  
  562. ##### Exclude the_post_thumbnail from gallery shortcode ########
  563. function exclude_thumbnail_from_gallery($null, $attr)
  564. {
  565.     if (!$thumbnail_ID = get_post_thumbnail_id())
  566.         return $null; // no point carrying on if no thumbnail ID
  567.  
  568.     // temporarily remove the filter, otherwise endless loop!
  569.     remove_filter('post_gallery', 'exclude_thumbnail_from_gallery');
  570.  
  571.     // pop in our excluded thumbnail
  572.     if (!isset($attr['exclude']) || empty($attr['exclude']))
  573.         $attr['exclude'] = array($thumbnail_ID);
  574.     elseif (is_array($attr['exclude']))
  575.         $attr['exclude'][] = $thumbnail_ID;
  576.  
  577.     // now manually invoke the shortcode handler
  578.     $gallery = gallery_shortcode($attr);
  579.  
  580.     // add the filter back
  581.     add_filter('post_gallery', 'exclude_thumbnail_from_gallery', 10, 2);
  582.  
  583.     // return output to the calling instance of gallery_shortcode()
  584.     return $gallery;
  585. }
  586. add_filter('post_gallery', 'exclude_thumbnail_from_gallery', 10, 2);
  587.  
  588. // Removes WYSIWYG Editor from Gallery Post-type
  589. function wpse_78595_hide_editor() {
  590.     global $current_screen;
  591.  
  592.     if( $current_screen->post_type == 'galleries' ) {
  593.         $css = '<style type="text/css">';
  594.             $css .= '#wp-content-editor-container, #post-status-info, .wp-switch-editor, #postexcerpt { display: none; }';
  595.         $css .= '</style>';
  596.  
  597.         echo $css;
  598.     }
  599. }
  600. add_action('admin_footer', 'wpse_78595_hide_editor');
  601.  
  602. // Calls uploaded logo for WordPress Login Branding
  603. function custom_login_logo() {
  604.     global $data;
  605.  
  606.     if($data["wm_login_branding"] == 1)
  607.     {
  608.         $theme_custom_logo = $data['wm_logo_upload'];
  609.         $login_background_color = $data['wm_login_background_color'];
  610.         $login_label_color = $data['wm_login_label_color'];
  611.         $login_link_color = $data['wm_login_link_color'];
  612.         echo '<style type="text/css">'.
  613.                  '.login h1 a { background-image:url('.$theme_custom_logo.') !important; width: 200px !important; height: 220px !important; background-size: auto !important; }'.
  614.                 '#login { padding: 3% 0 0 !important; }'.
  615.                 'body.login, html { background: '.$login_background_color.'  !important; }'.
  616.                 '.login label { color: '.$login_label_color.'  !important; }'.
  617.                 '.login #nav a, .login #backtoblog a { color: '.$login_link_color.'  !important; }'.
  618.              '</style>';
  619.     }
  620.  
  621. }
  622. add_action( 'login_head', 'custom_login_logo' );
  623.  
  624. // Changes WordPress Login Logo Link to use the WordPress Installation Link
  625. function custom_login_url() {
  626.     return home_url( '/' );
  627. }
  628. add_filter( 'login_headerurl', 'custom_login_url' );
  629.  
  630. // Changes the Alt tag to use the WordPress Installation Title
  631. function custom_login_title() {
  632.     return get_option( 'blogname' );
  633. }
  634. add_filter( 'login_headertitle', 'custom_login_title' );
  635.  
  636.  
  637. #---------------------------------------------------------------#
  638. ############ Get Unlimited Sidebar function #####################
  639. #---------------------------------------------------------------#
  640. include (get_template_directory() . "/lib/sidebar-generator/sidebar_generator.php");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement