I have an interesting template here - Underfire. Functions.php is a bit different than I´ve seen before.
<?php
/**
* web2feel functions and definitions
*
* @package web2feel
* @since web2feel 1.0
*/
/**
* Set the content width based on the theme's design and stylesheet.
*
* @since web2feel 1.0
*/
require_once('class-tgm-plugin-activation.php');
include ( 'getplugins.php' );
include ( 'aq_resizer.php' );
include ( 'slide.php' );
include ( 'guide.php' );
/* Theme updater */
require 'updater.php';
$example_update_checker = new ThemeUpdateChecker(
'Underfire', //Theme folder name, AKA "slug".
'http://www.fabthemes.com/versions/underfire.json' //URL of the metadata file.
);
if ( ! isset( $content_width ) )
$content_width = 640; /* pixels */
if ( ! function_exists( 'web2feel_setup' ) ):
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which runs
* before the init hook. The init hook is too late for some features, such as indicating
* support post thumbnails.
*
* @since web2feel 1.0
*/
function web2feel_setup() {
/**
* Custom template tags for this theme.
*/
require( get_template_directory() . '/inc/template-tags.php' );
/**
* Custom functions that act independently of the theme templates
*/
//require( get_template_directory() . '/inc/tweaks.php' );
/**
* Custom Theme Options
*/
//require( get_template_directory() . '/inc/theme-options/theme-options.php' );
/**
* Make theme available for translation
* Translations can be filed in the /languages/ directory
* If you're building a theme based on web2feel, use a find and replace
* to change 'web2feel' to the name of your theme in all the template files
*/
load_theme_textdomain( 'web2feel', get_template_directory() . '/languages' );
/**
* Add default posts and comments RSS feed links to head
*/
add_theme_support( 'automatic-feed-links' );
/**
* Enable support for Post Thumbnails
*/
add_theme_support( 'post-thumbnails' );
/**
* This theme uses wp_nav_menu() in one location.
*/
register_nav_menus( array(
'primary' => __( 'Primary Menu', 'web2feel' ),
) );
/**
* Add support for the Aside Post Formats
*/
add_theme_support( 'post-formats', array( 'aside', ) );
}
endif; // web2feel_setup
add_action( 'after_setup_theme', 'web2feel_setup' );
/**
* Register widgetized area and update sidebar with default widgets
*
* @since web2feel 1.0
*/
function web2feel_widgets_init() {
register_sidebar( array(
'name' => __( 'Sidebar', 'web2feel' ),
'id' => 'sidebar-1',
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h1 class="widget-title">',
'after_title' => '</h1>',
) );
register_sidebar(array(
'name' => 'Footer',
'before_widget' => '<li class="botwid grid_2 %2$s">',
'after_widget' => '</li>',
'before_title' => '<h3 class="bothead">',
'after_title' => '</h3>',
));
}
add_action( 'widgets_init', 'web2feel_widgets_init' );
/**
* Enqueue scripts and styles
*/
function web2feel_scripts() {
wp_enqueue_style( 'style', get_stylesheet_uri() );
wp_enqueue_script( 'superfish', get_template_directory_uri() . '/js/superfish.js', array( 'jquery' ), '20120206', true );
wp_enqueue_script( 'custom', get_template_directory_uri() . '/js/custom.js', array( 'jquery' ), '20120206', true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'web2feel_scripts' );
/* FLush rewrite */
function my_rewrite_flush() {
flush_rewrite_rules();
}
add_action( 'after_switch_theme', 'my_rewrite_flush' );
/* CUSTOM EXCERPTS */
function wpe_excerptlength_home($length) {
return 20;
}
function wpe_excerpt($length_callback='', $more_callback='') {
global $post;
if(function_exists($length_callback)){
add_filter('excerpt_length', $length_callback);
}
if(function_exists($more_callback)){
add_filter('excerpt_more', $more_callback);
}
$output = get_the_excerpt();
$output = apply_filters('wptexturize', $output);
$output = apply_filters('convert_chars', $output);
$output = '<p>'.$output.'</p>';
echo $output;
}
/**
* Implement the Custom Header feature
*/
//require( get_template_directory() . '/inc/custom-header.php' );
When I try to erase some unnecessary plugins then I get errors.
I really don´t need this stuff:
require_once('class-tgm-plugin-activation.php');
include ( 'getplugins.php' );
include ( 'aq_resizer.php' ); // this is necessary though
include ( 'slide.php' );
include ( 'guide.php' );
Any ideas on how to get rid of those unnecessary requests and web2feel stuff?? Some divs have web2feel classes so is it that necessary? I´d like to optimize the whole code and clean up all unnecessary pieces.