Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Custom Theme Functions
- * @package WordPress
- * @subpackage Hester Browne
- * @author By Association Only | http://byassociationonly.com
- * @copyright 2012-2013
- **/
- ?>
- <?php
- /**
- * @desc Add featured image support
- **/
- add_theme_support( 'post-thumbnails' );
- set_post_thumbnail_size( 540, 9999 ); // set width and height
- /**
- * @desc Add widget support
- **/
- if ( function_exists('register_sidebar') )
- register_sidebar();
- function quickchic_widgets_init() {
- register_sidebar(array(
- 'name' => __( 'Sidebar 1', 'quickchic' ),
- 'id' => 'sidebar-1',
- 'before_widget' => '',
- 'after_widget' => '',
- 'before_title' => '<h4>',
- 'after_title' => '</h4>',
- ));
- }
- add_action( 'init', 'quickchic_widgets_init' );
- /**
- * @desc Strip width and height dimensions from all featured images (post_thumbnails)
- **/
- add_filter( 'post_thumbnail_html', 'remove_thumbnail_dimensions', 10 );
- add_filter( 'image_send_to_editor', 'remove_thumbnail_dimensions', 10 );
- function remove_thumbnail_dimensions( $html ) {
- $html = preg_replace( '/(width|height)=\"\d*\"\s/', "", $html );
- return $html;
- }
- /**
- * @desc Add/Remove links from page head
- **/
- add_theme_support( 'automatic-feed-links' );
- remove_action( 'wp_head', 'wlwmanifest_link');
- /**
- * @desc Configure Contact Form 7
- **/
- // Remove stylesheet
- add_action('wp_enqueue_scripts', 'my_scripts_method', 11);
- add_action('wp_print_styles','remove_styles',100);
- function remove_styles() {
- // add handles for styles you wish to remove
- wp_deregister_style('contact-form-7');
- }
- /**
- * @desc Use Google's hosted jQuery file
- **/
- if (!is_admin()) add_action("wp_enqueue_scripts", "my_jquery_enqueue", 10);
- function my_jquery_enqueue() {
- wp_deregister_script('jquery');
- wp_register_script('jquery', "http" . ($_SERVER['SERVER_PORT'] == 443 ? "s" : "") . "://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js", false, null, true);
- wp_enqueue_script('jquery');
- }
- /**
- * @desc Only load in these files when necessary
- **/
- function my_scripts_method() {
- if ( is_front_page() ) {
- wp_register_script('lettering', get_template_directory_uri() . '/js/jquery.lettering.js', false, null, true);
- wp_register_script('fittext', get_template_directory_uri() . '/js/jquery.fittext.js', false, null, true);
- wp_register_script('plugins', get_template_directory_uri() . '/js/plugins.js', false, null, true);
- wp_register_script('script', get_template_directory_uri() . '/js/script.js', false, null, true);
- wp_register_script('anything', get_template_directory_uri() . '/js/jquery.anythingslider.min.js', false, null, true);
- // enqueue the script
- wp_enqueue_script('lettering');
- wp_enqueue_script('fittext');
- wp_enqueue_script('plugins');
- wp_enqueue_script('script');
- wp_enqueue_script('anything');
- }
- wp_register_script('tweets', "http" . ($_SERVER['SERVER_PORT'] == 443 ? "s" : "") . "://twitterjs.googlecode.com/svn/trunk/src/twitter.min.js", false, null, true);
- wp_enqueue_script('tweets');
- }
- add_action('wp_enqueue_scripts', 'my_scripts_method', 11);
- /**
- * @desc Disable links on all post images
- **/
- add_filter( 'the_content', 'attachment_image_link_remove_filter' );
- function attachment_image_link_remove_filter( $content ) {
- $content =
- preg_replace(
- array('{<a(.*?)(wp-att|wp-content\/uploads)[^>]*><img}',
- '{ wp-image-[0-9]*" /></a>}'),
- array('<img','" />'),
- $content
- );
- return $content;
- }
- /**
- * @desc Disable more tag jump on continue reading links
- **/
- function remove_more_jump_link($link) {
- $offset = strpos($link, '#more-');
- if ($offset) {
- $end = strpos($link, '"',$offset);
- }
- if ($end) {
- $link = substr_replace($link, '', $offset, $end-$offset);
- }
- return $link;
- }
- add_filter('the_content_more_link', 'remove_more_jump_link');
- /**
- * @desc Customise footer message in admin panel
- **/
- function modify_footer_admin () {
- echo '{ <a href="http://byassociationonly.com">By Association Only</a> } ';
- echo 'Powered by <a href="http://WordPress.org">WordPress</a>.';
- }
- add_filter('admin_footer_text', 'modify_footer_admin');
- /**
- * @desc Remove menu items from admin area that are not needed by the client
- **/
- function remove_menus () {
- global $menu;
- $restricted = array(__('Links'), __('Tools'));
- end ($menu);
- while (prev($menu)){
- $value = explode(' ',$menu[key($menu)][0]);
- if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){unset($menu[key($menu)]);}
- }
- }
- add_action('admin_menu', 'remove_menus');
- /**
- * @desc Hide ACF menu item from all user types excluding admin
- */
- function hide_admin_menu()
- {
- global $current_user;
- get_currentuserinfo();
- if($current_user->user_login != 'admin')
- {
- echo '<style type="text/css">#toplevel_page_edit-post_type-acf{display:none;}</style>';
- }
- }
- add_action('admin_head', 'hide_admin_menu');
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement