Skip to content

Instantly share code, notes, and snippets.

@j0lvera
Created June 18, 2014 20:58
Show Gist options
  • Save j0lvera/1a68c7e9a3fe376b3b8b to your computer and use it in GitHub Desktop.
Save j0lvera/1a68c7e9a3fe376b3b8b to your computer and use it in GitHub Desktop.
functions.php
<?php
/**
* _bitt functions and definitions
*
* @package _bitt
*/
/**
* Required: set 'ot_theme_mode' filter to true.
*/
add_filter( 'ot_theme_mode', '__return_true' );
/**
* Required: include OptionTree.
*/
require( trailingslashit( get_template_directory() ) . 'option-tree/ot-loader.php' );
/**
* Add Files to the Header
*/
function add_files_header() {
echo "<!-- here start add_files_header() -->";
/* echo "<link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/css'>"; */
echo '<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">';
echo "<!-- here ends add_files_header() -->";
}
add_filter('wp_head', 'add_files_header');
/**
* Add Files to the Footer
*/
function add_files_footer() {
echo '';
}
add_filter('wp_footer', 'add_files_footer');
/**
* Set the content width based on the theme's design and stylesheet.
*/
if ( ! isset( $content_width ) ) {
$content_width = 640; /* pixels */
}
if ( ! function_exists( '_bitt_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 for post thumbnails.
*/
function _bitt_setup() {
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on _bitt, use a find and replace
* to change '_bitt' to the name of your theme in all the template files
*/
load_theme_textdomain( '_bitt', 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 on posts and pages.
*
* @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails
*/
//add_theme_support( 'post-thumbnails' );
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'primary' => __( 'Primary Menu', '_bitt' ),
) );
// Enable support for Post Formats.
add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link' ) );
// Setup the WordPress core custom background feature.
add_theme_support( 'custom-background', apply_filters( '_bitt_custom_background_args', array(
'default-color' => 'ffffff',
'default-image' => '',
) ) );
// Enable support for HTML5 markup.
add_theme_support( 'html5', array(
'comment-list',
'search-form',
'comment-form',
'gallery',
) );
}
endif; // _bitt_setup
add_action( 'after_setup_theme', '_bitt_setup' );
/**
* Register widgetized area and update sidebar with default widgets.
*/
function _bitt_widgets_init() {
register_sidebar( array(
'name' => __( 'Sidebar', '_bitt' ),
'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>',
) );
// Juan's custom sidebars
register_sidebar( array(
'name' => __( 'Greybar', '_bitt' ),
'id' => 'greybar',
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h1 class="widget-title">',
'after_title' => '</h1>',
) );
}
add_action( 'widgets_init', '_bitt_widgets_init' );
/**
* Enqueue scripts and styles.
*/
function _bitt_scripts() {
wp_enqueue_style( '_bitt-style', get_stylesheet_uri() );
wp_enqueue_script( '_bitt-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20120206', true );
wp_enqueue_script( '_bitt-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20130115', true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', '_bitt_scripts' );
/**
* Implement the Custom Header feature.
*/
//require get_template_directory() . '/inc/custom-header.php';
/**
* 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/extras.php';
/**
* Customizer additions.
*/
require get_template_directory() . '/inc/customizer.php';
/**
* Load Jetpack compatibility file.
*/
require get_template_directory() . '/inc/jetpack.php';
/**
* Juan's Custom Post Types
*/
add_theme_support( 'post-thumbnails' );
// Register Custom Post Type
function adWhite_custom_post_type() {
$labels = array(
'name' => _x( 'Featured Projects', 'Post Type General Name', 'text_domain' ),
'singular_name' => _x( 'Featured Project', 'Post Type Singular Name', 'text_domain' ),
'menu_name' => __( 'Featured Projects', 'text_domain' ),
'parent_item_colon' => __( 'Parent Item:', 'text_domain' ),
'all_items' => __( 'All Items', 'text_domain' ),
'view_item' => __( 'View Item', 'text_domain' ),
'add_new_item' => __( 'Add New Item', 'text_domain' ),
'add_new' => __( 'Add New', 'text_domain' ),
'edit_item' => __( 'Edit Item', 'text_domain' ),
'update_item' => __( 'Update Item', 'text_domain' ),
'search_items' => __( 'Search Item', 'text_domain' ),
'not_found' => __( 'Not found', 'text_domain' ),
'not_found_in_trash' => __( 'Not found in Trash', 'text_domain' ),
);
$args = array(
'label' => __( 'post_type', 'text_domain' ),
'description' => __( 'Drymalla Featured Projects', 'text_domain' ),
'labels' => $labels,
'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail', ),
'taxonomies' => array( 'category', 'post_tag' ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'show_in_admin_bar' => true,
'menu_position' => 5,
'menu_icon' => 'http://www.adwhite.com/favicon.ico',
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'page',
);
register_post_type( 'post_type', $args );
}
// Hook into the 'init' action
add_action( 'init', 'adWhite_custom_post_type', 0 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment