__( 'Dropdown Menu', 'xtempt' ),
'aside_menu' => __( 'Aside Menu', 'xtempt' )
));
}
add_action( 'after_setup_theme', 'xtempt_setup' );
// INCLUDES
include_once( get_template_directory() . '/includes/xtempt-register-scripts.php' );
include_once( get_template_directory() . '/includes/shortcodes.php' );
// Include Functions
include_once( get_template_directory() . '/includes/popular-posts.php' );
include_once( get_template_directory() . '/includes/recent-items.php' );
include_once( get_template_directory() . '/includes/related.php' );
include_once( get_template_directory() . '/includes/network.php' );
include_once( get_template_directory() . '/includes/social-share.php' );
include_once( get_template_directory() . '/includes/slideshows.php' );
include_once( get_template_directory() . '/includes/custom-header.php' );
// Include Post Types
include_once( get_template_directory() . '/includes/post-types/post-type-project.php' );
// Include Custom Widgets
include_once( get_template_directory() . '/includes/widgets/widget-latest-posts.php' );
include_once( get_template_directory() . '/includes/widgets/widget-latest-projects.php' );
// Include Theme Options
if ( !function_exists( 'optionsframework_init' ) ) {
define( 'OPTIONS_FRAMEWORK_DIRECTORY', get_template_directory_uri() . '/includes/theme-options/' );
require_once ( get_template_directory() . '/includes/theme-options/options-framework.php');
require_once ( get_template_directory() . '/includes/theme-options/options.php');
include_once( get_template_directory() . '/includes/theme-options/xtempt-options-functions.php' );
}
// Include Meta Box
define( 'RWMB_URL', trailingslashit( get_stylesheet_directory_uri() . '/includes/meta-box' ) );
define( 'RWMB_DIR', trailingslashit( get_template_directory() . '/includes/meta-box' ) );
require_once RWMB_DIR . 'meta-box.php';
include RWMB_DIR . 'xtempt-meta-boxes.php';
// TITLE
/**
* Creates a nicely formatted and more specific title element text
* for output in head of document, based on current view.
*
*/
function xtempt_wp_title( $title, $sep ) {
global $paged, $page;
if ( is_feed() )
return $title;
$title .= get_bloginfo( 'name' );
$site_description = get_bloginfo( 'description', 'display' );
if ( $site_description && ( is_home() || is_front_page() ) )
$title = "$title $sep $site_description";
if ( $paged >= 2 || $page >= 2 )
$title = "$title $sep " . sprintf( __( 'Page %s', 'xtempt' ), max( $paged, $page ) );
return $title;
}
add_filter( 'wp_title', 'xtempt_wp_title', 10, 2 );
// HOME LINK
/**
* Makes our wp_nav_menu() fallback -- wp_page_menu() -- show a home link.
*
*/
function xtempt_page_menu_args( $args ) {
$args['show_home'] = true;
return $args;
}
add_filter( 'wp_page_menu_args', 'xtempt_page_menu_args' );
// Widgets
function xtempt_widgets_init() {
register_sidebar( array(
'name' => __( 'PAGE', 'xtempt' ),
'id' => 'sidebar-page',
'before_widget' => '
',
'before_title' => ''
) );
register_sidebar( array(
'name' => __( 'BLOG', 'xtempt' ),
'id' => 'sidebar-blog',
'before_widget' => '',
'before_title' => ''
) );
register_sidebar( array(
'name' => __( 'PROJECT', 'xtempt' ),
'id' => 'sidebar-project',
'before_widget' => '',
'before_title' => ''
) );
register_sidebar( array(
'name' => __( 'FOOTER', 'xtempt' ),
'id' => 'sidebar-footer',
'before_widget' => '',
'before_title' => ''
) );
register_sidebar( array(
'name' => __( 'ASIDE', 'xtempt' ),
'id' => 'sidebar-aside',
'before_widget' => '',
'after_widget' => '
',
'before_title' => ''
) );
register_sidebar( array(
'name' => __( 'WIDGETABLE 1', 'xtempt' ),
'id' => 'sidebar-template-widgetable',
'before_widget' => '',
'before_title' => ''
) );
register_sidebar( array(
'name' => __( 'WIDGETABLE 2', 'xtempt' ),
'id' => 'sidebar-area-1',
'before_widget' => '',
'after_widget' => '
',
'before_title' => ''
) );
register_sidebar( array(
'name' => __( 'WIDGETABLE 3', 'xtempt' ),
'id' => 'sidebar-area-2',
'before_widget' => '',
'after_widget' => '
',
'before_title' => ''
) );
register_sidebar( array(
'name' => __( 'SITEMAP 1', 'xtempt' ),
'id' => 'sidebar-sitemap1',
'before_widget' => '',
'before_title' => ''
) );
register_sidebar( array(
'name' => __( 'SITEMAP 2', 'xtempt' ),
'id' => 'sidebar-sitemap2',
'before_widget' => '',
'before_title' => ''
) );
}
add_action( 'widgets_init', 'xtempt_widgets_init' );
// Pagination
function xtempt_pagination_archive() {
global $wp_query;
$big = 999999999; // need an unlikely integer
echo paginate_links( array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
'format' => '?paged=%#%',
'current' => max( 1, get_query_var('paged') ),
'total' => $wp_query->max_num_pages,
'prev_text' => __('«', 'xtempt'),
'next_text' => __('»', 'xtempt'),
'type' => 'plain',
) );
}
// Excerpt & More
function xtempt_excerpt_length ($length) {
$one_coll_blog = of_get_option('xtempt_one_coll_blog');
$four_coll_blog = of_get_option('xtempt_four_coll_blog');
$two_coll_blog = of_get_option('xtempt_two_coll_blog');
$three_coll_blog = of_get_option('xtempt_three_coll_blog');
if ( is_single() ) :
return 10;
elseif ($one_coll_blog != 0) :
return 100;
elseif ($four_coll_blog != 0) :
return 3;
elseif ($two_coll_blog != 0) :
return 15;
elseif ($three_coll_blog != 0) :
return 10;
else :
return 5;
endif;
}
add_filter( 'excerpt_length', 'xtempt_excerpt_length' );
// Puts link in excerpts more tag
function xtempt_excerpt_more($more) {
global $post;
return '' .__("...", "xtempt").' ';
}
add_filter('excerpt_more', 'xtempt_excerpt_more');
// Comments
if ( ! function_exists( 'xtempt_comments' ) ) :
function xtempt_comments($comment, $args, $depth) {
$GLOBALS['comment'] = $comment; ?>
>
]+>\s*)?
]+>(?:\s*)?)(.*)#is', $content, $matches ) ) {
$content = $matches[1];
$attr['caption'] = trim( $matches[2] );
}
}
// Allow plugins/themes to override the default caption template.
$output = apply_filters('img_caption_shortcode', '', $attr, $content);
if ( $output != '' )
return $output;
extract(shortcode_atts(array(
'id' => '',
'align' => 'alignnone',
'width' => '',
'caption' => ''
), $attr));
if ( 1 > (int) $width || empty($caption) )
return $content;
if ( $id ) $id = 'id="' . esc_attr($id) . '" ';
return ''
. do_shortcode( $content ) . '
' . $caption . '
';
}
// The Post Thumbnail Caption
function xtempt_post_thumbnail_caption() {
global $post;
$thumbnail_id = get_post_thumbnail_id($post->ID);
$thumbnail_image = get_posts(array('p' => $thumbnail_id, 'post_type' => 'attachment'));
if ($thumbnail_image && isset($thumbnail_image[0])) {
if (!empty($thumbnail_image[0]->post_excerpt) OR ($thumbnail_image[0]->post_content)) {
echo '';
echo '
'.$thumbnail_image[0]->post_excerpt.'
';
echo '
'.$thumbnail_image[0]->post_content.'
';
echo '
';
}
}
}
// Admin Icons
add_action( 'admin_head', 'xtempt_cpt_icons' );
function xtempt_cpt_icons() {
?>
$category_name ));
$category_list = array( '0' =>'All');
foreach( $get_category as $category ){
$category_list[] = $category->cat_name;
}
return $category_list;
}else{
$parent_id = get_term_by('name', $parent, $category_name);
$get_category = get_categories( array( 'taxonomy' => $category_name, 'child_of' => $parent_id->term_id ));
$category_list = array( '0' => $parent );
foreach( $get_category as $category ){
$category_list[] = $category->cat_name;
}
return $category_list;
}
}
// Page Attachment Count
function xtempt_attachment_count() {
global $wpdb;
global $post;
echo $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts WHERE post_parent = '$post->ID' AND post_type = 'attachment'" );
}
comment_approved == '0') : ?>