Advertisement
Guest User

function

a guest
Mar 30th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.31 KB | None | 0 0
  1. <?php
  2. /**
  3.  * Codereye Seo functions and definitions
  4.  *
  5.  * @link https://developer.wordpress.org/themes/basics/theme-functions/
  6.  *
  7.  * @package Codereye_Seo
  8.  */
  9.  
  10. if ( ! function_exists( 'seo_codereye_setup' ) ) :
  11. /**
  12.  * Sets up theme defaults and registers support for various WordPress features.
  13.  *
  14.  * Note that this function is hooked into the after_setup_theme hook, which
  15.  * runs before the init hook. The init hook is too late for some features, such
  16.  * as indicating support for post thumbnails.
  17.  */
  18. function seo_codereye_setup() {
  19.     /*
  20.      * Make theme available for translation.
  21.      * Translations can be filed in the /languages/ directory.
  22.      * If you're building a theme based on Codereye Seo, use a find and replace
  23.      * to change 'seo-codereye' to the name of your theme in all the template files.
  24.      */
  25.     load_theme_textdomain( 'seo-codereye', get_template_directory() . '/languages' );
  26.  
  27.     // Add default posts and comments RSS feed links to head.
  28.     add_theme_support( 'automatic-feed-links' );
  29.  
  30.     /*
  31.      * Let WordPress manage the document title.
  32.      * By adding theme support, we declare that this theme does not use a
  33.      * hard-coded <title> tag in the document head, and expect WordPress to
  34.      * provide it for us.
  35.      */
  36.     add_theme_support( 'title-tag' );
  37.  
  38.     /*
  39.      * Enable support for Post Thumbnails on posts and pages.
  40.      *
  41.      * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
  42.      */
  43.     add_theme_support( 'post-thumbnails' );
  44.  
  45.     // This theme uses wp_nav_menu() in one location.
  46.     register_nav_menus( array(
  47.         'menu-1' => esc_html__( 'Primary', 'seo-codereye' ),
  48.     ) );
  49.  
  50.     /*
  51.      * Switch default core markup for search form, comment form, and comments
  52.      * to output valid HTML5.
  53.      */
  54.     add_theme_support( 'html5', array(
  55.         'search-form',
  56.         'comment-form',
  57.         'comment-list',
  58.         'gallery',
  59.         'caption',
  60.     ) );
  61.  
  62.     // Set up the WordPress core custom background feature.
  63.     add_theme_support( 'custom-background', apply_filters( 'seo_codereye_custom_background_args', array(
  64.         'default-color' => 'ffffff',
  65.         'default-image' => '',
  66.     ) ) );
  67.  
  68.     // Add theme support for selective refresh for widgets.
  69.     add_theme_support( 'customize-selective-refresh-widgets' );
  70. }
  71. endif;
  72. add_action( 'after_setup_theme', 'seo_codereye_setup' );
  73.  
  74. /**
  75.  * Set the content width in pixels, based on the theme's design and stylesheet.
  76.  *
  77.  * Priority 0 to make it available to lower priority callbacks.
  78.  *
  79.  * @global int $content_width
  80.  */
  81. function seo_codereye_content_width() {
  82.     $GLOBALS['content_width'] = apply_filters( 'seo_codereye_content_width', 640 );
  83. }
  84. add_action( 'after_setup_theme', 'seo_codereye_content_width', 0 );
  85.  
  86. /**
  87.  * Register widget area.
  88.  *
  89.  * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
  90.  */
  91. function seo_codereye_widgets_init() {
  92.     register_sidebar( array(
  93.         'name'          => esc_html__( 'Sidebar', 'seo-codereye' ),
  94.         'id'            => 'sidebar-1',
  95.         'description'   => esc_html__( 'Add widgets here.', 'seo-codereye' ),
  96.         'before_widget' => '<section id="%1$s" class="widget %2$s">',
  97.         'after_widget'  => '</section>',
  98.         'before_title'  => '<h2 class="widget-title">',
  99.         'after_title'   => '</h2>',
  100.     ) );
  101.     register_sidebar( array(
  102.         'name'          => esc_html__( 'Seo Footer Sidebar', 'seo-codereye' ),
  103.         'id'            => 'seo_footer',
  104.         'description'   => esc_html__( 'Add footer widgets here.', 'seo-codereye' ),
  105.         'before_widget' => '<div class="col-md-3"><div id="%1$s" class="widget %2$s">',
  106.         'after_widget'  => '</div></div>',
  107.         'before_title'  => '<h4 class="widget-title">',
  108.         'after_title'   => '</h4>',
  109.     ) );
  110. }
  111. add_action( 'widgets_init', 'seo_codereye_widgets_init' );
  112.  
  113. /**
  114.  * Enqueue scripts and styles.
  115.  */
  116. function seo_codereye_scripts() {
  117.     wp_enqueue_style( 'seo-codereye-default', get_template_directory_uri() . '/assets/css/default.css', array(),'1.0.0' );
  118.     wp_enqueue_style( 'bootstrap', get_template_directory_uri() . '/assets/css/bootstrap.min.css', array(),'3.3.7' );
  119.     wp_enqueue_style( 'font-awesome', get_template_directory_uri() . '/assets/css/font-awesome.min.css', array(),'4.7.0' );
  120.     wp_enqueue_style( 'seo-codereye-style', get_stylesheet_uri() );
  121.  
  122.     wp_enqueue_script( 'bootstrap', get_template_directory_uri() . '/assets/js/bootstrap.min.js', array('jquery'), '20151215', true );
  123.  
  124.     wp_enqueue_script( 'seo-codereye-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20151215', true );
  125.  
  126.     if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
  127.         wp_enqueue_script( 'comment-reply' );
  128.     }
  129. }
  130. add_action( 'wp_enqueue_scripts', 'seo_codereye_scripts' );
  131.  
  132. /**
  133.  * Implement the Custom Header feature.
  134.  */
  135. require get_template_directory() . '/inc/custom-header.php';
  136.  
  137. /**
  138.  * Custom template tags for this theme.
  139.  */
  140. require get_template_directory() . '/inc/template-tags.php';
  141.  
  142. /**
  143.  * Custom functions that act independently of the theme templates.
  144.  */
  145. require get_template_directory() . '/inc/extras.php';
  146.  
  147. /**
  148.  * Customizer additions.
  149.  */
  150. require get_template_directory() . '/inc/customizer.php';
  151.  
  152. /**
  153.  * Load Jetpack compatibility file.
  154.  */
  155. require get_template_directory() . '/inc/jetpack.php';
  156.  
  157.  
  158. /**
  159.  *Theme Options & Metabox Framework
  160.  */
  161. require get_template_directory_uri() . '/inc/cs-framework/cs-framework.php';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement