Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Edutica functions and definitions
- *
- * @package Edutica
- * @since Edutica 1.0
- */
- require_once dirname( __FILE__ ) . '/lib/framework/framework-init.php';
- require_once dirname( __FILE__ ) . '/custom-post-type.php';
- /**
- * Set the content width based on the theme's design and stylesheet.
- *
- * @since Edutica 1.0
- */
- if ( ! isset( $content_width ) )
- $content_width = 640; /* pixels */
- class WeDevs_Bootstrap {
- function __construct() {
- add_action( 'after_setup_theme', array( $this, 'setup_theme' ), 14 );
- add_action( 'widgets_init', array( $this, 'widgets_init' ) );
- add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
- }
- /**
- * 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 Edutica 1.0
- */
- function setup_theme() {
- /**
- * Make theme available for translation
- * Translations can be filed in the /languages/ directory
- * If you're building a theme based on Edutica, use a find and replace
- * to change 'edutica' to the name of your theme in all the template files
- */
- load_theme_textdomain( 'edutica', get_template_directory() . '/languages' );
- add_theme_support( 'slider' );
- add_theme_support( 'custom-sidebar' );
- add_theme_support( 'post-template' );
- /**
- * This theme uses wp_nav_menu() in one location.
- */
- register_nav_menus( array(
- 'primary' => __( 'Primary Menu', 'edutica' ),
- ) );
- /**
- * Add support for the Aside Post Formats
- */
- add_theme_support( 'post-formats', array( 'aside', ) );
- }
- /**
- * Register widgetized area and update sidebar with default widgets
- *
- * @since Edutica 1.0
- */
- function widgets_init() {
- register_sidebar( array(
- 'name' => __( 'Sidebar', 'edutica' ),
- 'id' => 'sidebar-1',
- 'before_widget' => '<aside id="%1$s" class="widget %2$s">',
- 'after_widget' => '</div></aside>',
- 'before_title' => '<h3 class="widget-title">',
- 'after_title' => '</h3><div class="inside">',
- ) );
- register_sidebar( array(
- 'name' => __( 'Home Right Sidebar', 'edutica' ),
- 'id' => 'home-right-sidebar',
- 'before_widget' => '<aside id="%1$s" class="widget %2$s">',
- 'after_widget' => '</div></aside>',
- 'before_title' => '<h3 class="widget-title">',
- 'after_title' => '</h3><div class="inside">',
- ) );
- register_sidebar( array(
- 'name' => __( 'Home Left Sidebar', 'edutica' ),
- 'id' => 'home-left-sidebar',
- 'before_widget' => '<aside id="%1$s" class="widget %2$s">',
- 'after_widget' => '</div></aside>',
- 'before_title' => '<h3 class="widget-title">',
- 'after_title' => '</h3><div class="inside">',
- ) );
- register_sidebar( array(
- 'name' => __( 'Homepage Center', 'edutica' ),
- 'id' => 'homepage-center',
- 'before_widget' => '<aside id="%1$s" class="widget %2$s">',
- 'after_widget' => '</aside>',
- 'before_title' => '<h3 class="widget-title">',
- 'after_title' => '</h3>',
- ) );
- // footer sidebars
- register_sidebar( array(
- 'name' => __( 'Footer 1', 'edutica' ),
- 'id' => 'footer_1',
- 'before_widget' => '<aside id="%1$s" class="widget %2$s">',
- 'after_widget' => '</div></aside>',
- 'before_title' => '<h3 class="widget-title">',
- 'after_title' => '</h3><div class="inside">',
- ) );
- register_sidebar( array(
- 'name' => __( 'Footer 2', 'edutica' ),
- 'id' => 'footer_2',
- 'before_widget' => '<aside id="%1$s" class="widget %2$s">',
- 'after_widget' => '</div></aside>',
- 'before_title' => '<h3 class="widget-title">',
- 'after_title' => '</h3><div class="inside">',
- ) );
- register_sidebar( array(
- 'name' => __( 'Footer 3', 'edutica' ),
- 'id' => 'footer_3',
- 'before_widget' => '<aside id="%1$s" class="widget %2$s">',
- 'after_widget' => '</div></aside>',
- 'before_title' => '<h3 class="widget-title">',
- 'after_title' => '</h3><div class="inside">',
- ) );
- register_sidebar( array(
- 'name' => __( 'Footer 4', 'edutica' ),
- 'id' => 'footer_4',
- 'before_widget' => '<aside id="%1$s" class="widget %2$s">',
- 'after_widget' => '</div></aside>',
- 'before_title' => '<h3 class="widget-title">',
- 'after_title' => '</h3><div class="inside">',
- ) );
- // Botom Widget
- register_sidebar( array(
- 'name' => __( 'Widget Bottom ', 'edutica' ),
- 'id' => 'destination_1',
- 'before_widget' => '<aside id="%1$s" class="widget span3 %2$s">',
- 'after_widget' => '</div></aside>',
- 'before_title' => '<h3 class="widget-title">',
- 'after_title' => '</h3><div class="inside">',
- ) );
- }
- /**
- * Enqueue scripts and styles
- */
- function enqueue_scripts() {
- wp_enqueue_style( 'bootstrap', THEME_CSS . '/bootstrap.min.css' );
- // wp_enqueue_style( 'bootstrap-responsive', THEME_CSS . '/bootstrap-responsive.min.css' );
- wp_enqueue_style( 'prettyphoto', THEME_CSS . '/prettyPhoto.css' );
- wp_enqueue_style( 'theme-style', THEME_CSS . '/style.css' );
- wp_enqueue_style( 'shortcode' );
- wp_enqueue_style( 'collection' );
- wp_dequeue_style('wp_sidebarlogin_css_styles');
- wp_enqueue_script( 'tinynav', THEME_JS . '/tinynav.min.js', array( 'jquery' ), '20120206', true );
- if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
- wp_enqueue_script( 'comment-reply' );
- }
- if ( is_singular() && wp_attachment_is_image() ) {
- wp_enqueue_script( 'keyboard-image-navigation', THEME_JS . '/keyboard-image-navigation.js', array( 'jquery' ), '20120202' );
- }
- wp_enqueue_script( 'flexslider', THEME_JS . '/jquery.flexslider-min.js', array( 'jquery' ) );
- wp_enqueue_script( 'bootstrap-js', THEME_JS . '/bootstrap.min.js', array('jquery') );
- wp_enqueue_script( 'prettyphoto', THEME_JS . '/jquery.prettyPhoto.js', array('jquery') );
- wp_enqueue_script( 'theme-script' );
- }
- }
- $wedevs_bootstrap = new WeDevs_Bootstrap();
- /**
- * Rename user roles
- */
- function edutica_rename_user_roles() {
- global $wp_roles;
- if ( ! isset( $wp_roles ) ) {
- $wp_roles = new WP_Roles();
- }
- $custom_names = array(
- 'subscriber' => __( 'Student', 'wedevs' ),
- 'contributor' => __( 'Officers', 'wedevs' ),
- 'author' => __( 'Teacher', 'wedevs' )
- );
- $roles = $wp_roles->get_names();
- foreach( $roles as $role => $name ) {
- if( array_key_exists( $role, $custom_names ) ) {
- $wp_roles->roles[$role]['name'] = $custom_names[$role];
- $wp_roles->role_names[$role] = $custom_names[$role];
- }
- }
- }
- add_action( 'init', 'edutica_rename_user_roles' );
- /**
- * Add buttons to tinyMCE
- */
- function edutica_add_button() {
- if ( current_user_can('edit_posts') && current_user_can('edit_pages') ) {
- add_filter('mce_external_plugins', 'edutica_tinymce_plugins');
- add_filter('mce_buttons_3', 'edutica_register_buttons');
- }
- }
- add_action('init', 'edutica_add_button');
- /**
- * Register custom shortcode buttons
- */
- function edutica_register_buttons( $buttons ) {
- $custom_buttons = array("youtube", "vimeo", "soundcloud", "button","tab", "toggle","accordion" ,
- "tooltip", "dropcap","unlist", "social", "featurebox", "row", "one_half", "one_third",
- "two_third", "one_fourth", "three_fourth", "slider", "testimonial", "progress", "person",
- "alert", "pricing_table", "recent_works", "tagline_box", "content_boxes", "recent_posts"
- );
- return array_merge( $buttons, $custom_buttons );
- }
- function edutica_tinymce_plugins($plugin_array) {
- $plugin_array['youtube'] = get_template_directory_uri().'/lib/tinymce/shortcode-buttons.js';
- $plugin_array['vimeo'] = get_template_directory_uri().'/lib/tinymce/shortcode-buttons.js';
- $plugin_array['soundcloud'] = get_template_directory_uri().'/lib/tinymce/shortcode-buttons.js';
- $plugin_array['button'] = get_template_directory_uri().'/lib/tinymce/shortcode-buttons.js';
- $plugin_array['tab'] = get_template_directory_uri().'/lib/tinymce/shortcode-buttons.js';
- $plugin_array['toggle'] = get_template_directory_uri().'/lib/tinymce/shortcode-buttons.js';
- $plugin_array['accordion'] = get_template_directory_uri().'/lib/tinymce/shortcode-buttons.js';
- $plugin_array['tooltip'] = get_template_directory_uri().'/lib/tinymce/shortcode-buttons.js';
- $plugin_array['dropcap'] = get_template_directory_uri().'/lib/tinymce/shortcode-buttons.js';
- $plugin_array['unlist'] = get_template_directory_uri().'/lib/tinymce/shortcode-buttons.js';
- $plugin_array['social'] = get_template_directory_uri().'/lib/tinymce/shortcode-buttons.js';
- $plugin_array['featurebox'] = get_template_directory_uri().'/lib/tinymce/shortcode-buttons.js';
- $plugin_array['row'] = get_template_directory_uri().'/lib/tinymce/shortcode-buttons.js';
- $plugin_array['one_half'] = get_template_directory_uri().'/lib/tinymce/shortcode-buttons.js';
- $plugin_array['one_third'] = get_template_directory_uri().'/lib/tinymce/shortcode-buttons.js';
- $plugin_array['two_third'] = get_template_directory_uri().'/lib/tinymce/shortcode-buttons.js';
- $plugin_array['one_fourth'] = get_template_directory_uri().'/lib/tinymce/shortcode-buttons.js';
- $plugin_array['three_fourth'] = get_template_directory_uri().'/lib/tinymce/shortcode-buttons.js';
- return $plugin_array;
- }
- // custom post type
- $book = new Custom_Post_Type( 'Event' );
- $book->add_taxonomy( 'category' );
- $book->add_meta_box(
- 'Event Date',
- array(
- 'Date' => 'text',
- 'Time' => 'text'
- )
- );
- $book->add_meta_box(
- 'Event Place',
- array(
- 'Name' => 'text'
- )
- );
Add Comment
Please, Sign In to add comment