'',
'flex-width' => true,
'height' => 300,
'flex-height' => true,
'header-text' => false,
'admin-head-callback' => 'decode_admin_header_style',
'admin-preview-callback' => 'decode_admin_header_image',
) ) );
// Setup the WordPress core custom background feature.
add_theme_support( 'custom-background', apply_filters( 'decode_custom_background_args', array(
'default-color' => 'E3E5E7',
) ) );
// This theme supports live-updating of widgets in the customizer.
add_theme_support( 'widget-customizer' );
// Register all three menus.
register_nav_menus( array(
'header-menu' => __( 'Header Menu', 'decode' ),
'sidebar-menu' => __( 'Sidebar Menu', 'decode' ),
'footer-menu' => __( 'Footer Menu', 'decode' )
) );
/**
* Set the content width based on the theme's design and stylesheet.
*/
if ( ! isset( $content_width ) ) {
$content_width = 640; /* pixels */
}
}
endif; // decode_setup
add_action( 'after_setup_theme', 'decode_setup' );
/**
* Register styles and scripts.
*/
if ( ! is_admin() && ! function_exists( 'decode_scripts' ) ) {
function decode_scripts() {
wp_enqueue_style( 'decode-style', get_stylesheet_uri(), array(), "2.9.3" );
wp_enqueue_style( 'decode-font-stylesheet', '//fonts.googleapis.com/css?family=Oxygen&subset=latin-ext' );
if ( get_theme_mod( 'show_sidebar', true ) == false ) {
wp_enqueue_script( 'decode-scripts', get_template_directory_uri() . '/js/decode.js', array(), '2.9.3', true );
}
if ( get_theme_mod( 'show_sidebar', true ) == true ) {
wp_enqueue_script( 'decode-sidebar', get_template_directory_uri() . '/js/decode-with-sidebar.js', array(), '2.9.3', true );
}
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) && get_theme_mod( 'enable_comments', true ) == true ) {
wp_enqueue_script( 'comment-reply' );
}
if ( is_singular() && wp_attachment_is_image() ) {
wp_enqueue_script( 'decode-keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '2.7.5', true );
}
}
}
add_action( 'wp_enqueue_scripts', 'decode_scripts' );
/**
* Register widgetized area and update sidebar with default widgets.
*
* @link http://codex.wordpress.org/Function_Reference/register_sidebar
*/
if ( ! function_exists( 'decode_widgets_init' ) ) {
function decode_widgets_init() {
register_sidebar( array(
'name' => __( 'Sidebar', 'decode' ),
'id' => 'sidebar-1',
'description' => _x( 'Only displayed if sidebar remains enabled in the Customize menu.', 'sidebar description', 'decode' ),
'before_widget' => '',
) );
}
}
add_action( 'widgets_init', 'decode_widgets_init' );
/**
* Add Custom CSS to page.
*/
if ( ! is_admin() && ! function_exists( 'decode_custom_css' ) ) {
function decode_custom_css() {
?>
ID;
$post_id = get_post($thePostID);
$title = $post_id->post_title;
$perm = get_permalink($post_id);
$post_keys = array(); $post_val = array();
$post_keys = get_post_custom_keys($thePostID);
if (!empty($post_keys)) {
foreach ($post_keys as $pkey) {
if ($pkey=='title_url' || $pkey=='url_title' || $pkey=='title_link') {
$post_val = get_post_custom_values($pkey);
}
}
if (empty($post_val)) {
$link = $perm;
}
else {
$link = $post_val[0];
}
}
else {
$link = $perm;
}
echo ''.$title.'';
}
}
/**
* Show all post types in main query
*/
if ( ! function_exists( 'add_post_types_to_query' ) ) {
function add_post_types_to_query( $query ) {
$typelist = 'post';
if ( get_theme_mod( 'add_custom_post_types', '' ) !== '' ) {
$typelist .= ', ' . get_theme_mod( 'add_custom_post_types', '' );
$typelist = explode( ", ", $typelist );
}
if ( is_home() && $query->is_main_query() )
$query->set( 'post_type', $typelist );
return $query;
}
}
if ( get_theme_mod( 'add_custom_post_types', '' ) !== '' ) {
add_action( 'pre_get_posts', 'add_post_types_to_query' );
}