'Primary Navigation',
)
);
// Add support for Post Formats
add_theme_support( 'post-formats', array( 'image', 'gallery', 'video', 'audio', 'aside', 'link' ) );
// Add support for post formats and custom image sizes specific to theme locations
add_theme_support( 'post-thumbnails', array( 'post' ) );
add_image_size( 'slider-thumb', 600, 400, 1 );
add_image_size( 'homepage-thumb', 688, 230, 1 );
add_image_size( 'gallery-thumb', 200, 200, 1 );
add_image_size( 'video-thumb', 700, 444, 1 );
add_image_size( 'single-thumb', 460, 348 );
add_image_size( 'attachment-thumb', 688, 9999 ); // no crop flag, unlimited height
// Allows users to set a custom background
// add_custom_background();
// Allows users to set a custom header image
if ( ! defined( 'HEADER_TEXTCOLOR' ) )
define( 'HEADER_TEXTCOLOR', '151515' );
// The height and width of your custom header.
if ( ! defined( 'HEADER_IMAGE_WIDTH' ) )
define( 'HEADER_IMAGE_WIDTH', 940 );
if ( ! defined( 'HEADER_IMAGE_HEIGHT' ) )
define( 'HEADER_IMAGE_HEIGHT', 100 );
// Add a way for the custom header to be styled in the admin panel
// add_custom_image_header( 'minimatica_header_style', 'minimatica_admin_header_style' );
// Styles the post editor
add_editor_style();
// Makes theme translation ready
load_theme_textdomain( 'minimatica', get_template_directory() . '/languages' );
$locale = get_locale();
$locale_file = get_template_directory() . "/languages/$locale.php";
if ( is_readable( $locale_file ) )
require_once( $locale_file );
}
endif;
add_action( 'after_setup_theme', 'minimatica_theme_setup' );
if ( ! function_exists( 'minimatica_widgets_init' ) ) :
/**
* Registers theme widget areas
*
* @uses register_sidebar()
*
* @since Minimatica 1.0
*/
function minimatica_widgets_init() {
register_sidebar(
array(
'name' => 'Sidebar',
'before_widget' => '',
'before_title' => '
'
)
);
register_sidebar(
array(
'name' => 'Footer',
'before_widget' => '',
'before_title' => ''
)
);
}
endif;
add_action( 'widgets_init', 'minimatica_widgets_init' );
if ( ! function_exists( 'minimatica_paged_posts' ) ) :
/**
* Overrides the default posts_per_page value when viewing in gallery mode
* This prevents the 404 flag from being triggered when using query_posts() with pagination
* It does not alter the database value for the option, only fiters it when the posts query is called
*
* @since Minimatica 1.0
*/
function minimatica_paged_posts( $query ) {
if( (
( $query->is_home() && 'gallery' == minimatica_get_option( 'homepage_view' ) ) ||
( $query->is_category() && 'gallery' == minimatica_get_option( 'category_view' ) ) ||
( $query->is_tag() && 'gallery' == minimatica_get_option( 'tag_view' ) ) ||
( $query->is_author() && 'gallery' == minimatica_get_option( 'author_view' ) ) ||
( $query->is_archive() && 'gallery' == minimatica_get_option( 'archive_view' ) )
) && ( ! is_single() )
)
$query->set( 'posts_per_page', '4' );
}
endif;
add_filter( 'pre_get_posts', 'minimatica_paged_posts' );
/**
* Return default array of options
*
* @since Minimatica 1.0
*/
function minimatica_default_options() {
$options = array(
'homepage_view' => 'gallery',
'category_view' => 'gallery',
'tag_view' => 'blog',
'author_view' => 'blog',
'archive_view' => 'blog',
'blog_category' => 0
);
return $options;
}
if ( ! function_exists( 'minimatica_get_option' ) ) :
/**
* Used to output theme options is an elegant way
*
* @uses get_option() To retrieve the options array
*
* @since Minimatica 1.0
*/
function minimatica_get_option( $option ) {
$options = get_option( 'minimatica_options', minimatica_default_options() );
return $options[ $option ];
}
endif;
if ( ! function_exists( 'minimatica_doc_title' ) ) :
/**
* Output the tag
*
* @since Minimatica 1.0
*/
function minimatica_doc_title() {
global $page, $paged;
$doc_title = '';
$site_description = get_bloginfo( 'description', 'display' );
$separator = '#124';
if ( !is_front_page() ) :
$doc_title .= wp_title('', false);
if ( $paged >= 2 || $page >= 2 )
$doc_title .= ', ' . __( 'Page' ) . ' ' . max( $paged, $page );
if ( is_archive() )
$doc_title .= ' &' . $separator . '; ';
elseif ( is_singular() )
$doc_title .= ' &' . $separator . '; ';
endif;
if ( is_archive() )
$doc_title .= get_bloginfo( 'name' );
elseif ( is_singular() )
$doc_title .= get_bloginfo( 'name' );
elseif ( is_front_page() )
$doc_title .= get_bloginfo( 'name' );
if ( is_front_page() && ( $paged >= 2 || $page >= 2 ) )
$doc_title .= ', ' . __( 'Page' ) . ' ' . max( $paged, $page );
if ( $site_description && ( is_home() || is_front_page() ) )
$doc_title .= ' &' . $separator . '; ' . $site_description;
echo $doc_title;
}
endif;
if ( ! function_exists( 'minimatica_register_styles' ) ) :
/**
* Register theme styles
*
* @uses wp_register_style() To register styles
*
* @since Minimatica 1.0.1
*/
function minimatica_register_styles() {
wp_register_style( 'minimatica', get_bloginfo( 'stylesheet_url' ), false, '1.0.1' );
wp_register_style( 'colorbox', get_template_directory_uri() . '/styles/colorbox.css', false, '0.5' );
wp_register_style( 'minimatica-ie', get_template_directory_uri() . '/styles/ie.css', false, '1.0' );
}
endif;
add_action('wp_enqueue_scripts', 'minimatica_register_styles');
if ( ! function_exists( 'minimatica_enqueue_styles' ) ) :
/**
* Enqueue theme styles
*
* @uses wp_enqueue_style() To enqueue styles
*
* @since Minimatica 1.0
*/
function minimatica_enqueue_styles() {
wp_enqueue_style( 'minimatica' );
if( is_single() )
wp_enqueue_style( 'colorbox' );
wp_enqueue_style( 'minimatica-ie' );
// Add IE conditionals
global $wp_styles;
$wp_styles->add_data( 'minimatica-ie', 'conditional', 'lte IE 8' );
}
endif;
add_action('wp_print_styles', 'minimatica_enqueue_styles');
if ( ! function_exists( 'minimatica_register_scripts' ) ) :
/**
* Register theme scripts
*
* @uses wp_register_scripts() To register scripts
*
* @since Minimatica 1.0.1
*/
function minimatica_register_scripts() {
// Add HTML5 support to older versions of IE
wp_register_script( 'html5', get_template_directory_uri() . '/scripts/html5.js', false, '1.5.1' );
wp_register_script( 'audio-player', get_template_directory_uri() . '/scripts/audio-player.js', array( 'swfobject' ), '2.2' );
wp_register_script( 'kwicks', get_template_directory_uri() . '/scripts/kwicks.js', array( 'jquery' ), '1.5.1' );
wp_register_script( 'colorbox', get_template_directory_uri() . '/scripts/colorbox.js', array( 'jquery' ), '1.3.16' );
wp_register_script( 'minimatica', get_template_directory_uri() . '/scripts/minimatica.js', array( 'kwicks' ), '1.0' );
}
endif;
add_action( 'wp_enqueue_scripts', 'minimatica_register_scripts' );
if ( ! function_exists( 'minimatica_enqueue_scripts' ) ) :
/**
* Enqueue theme scripts
*
* @uses wp_enqueue_scripts() To enqueue scripts
*
* @since Minimatica 1.0
*/
function minimatica_enqueue_scripts() {
// Add HTML5 support to older versions of IE
if( isset( $_SERVER['HTTP_USER_AGENT'] ) &&
( false !== strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE' ) ) &&
( false === strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE 9' ) ) )
wp_enqueue_script( 'html5' );
wp_enqueue_script( 'kwicks' );
if ( is_singular() && get_option( 'thread_comments' ) )
wp_enqueue_script( 'comment-reply' );
if ( is_single() && has_post_format( 'video' ) )
wp_enqueue_script( 'swfobject' );
if ( is_single() && has_post_format( 'audio' ) )
wp_enqueue_script( 'audio-player' );
if ( is_single() )
wp_enqueue_script( 'colorbox' );
wp_enqueue_script( 'minimatica' );
}
endif;
add_action( 'wp_enqueue_scripts', 'minimatica_enqueue_scripts' );
if ( ! function_exists( 'minimatica_call_scripts' ) ) :
/**
* Call script functions in document head
*
* @since Minimatica 1.0
*/
function minimatica_call_scripts() { ?>
Header admin panel.
*
* @since Minimatica 1.0.7
*/
function minimatica_header_style() {
if( '' != get_header_image() ) : ?>
1,
'post_type' => 'attachment',
'post_mime_type' => 'image',
'post_parent' => get_the_ID()
);
$attachments = get_posts( $args );
if( count( $attachments ) )
$attachment = $attachments[0];
if( isset( $attachment ) && ! post_password_required() ) : ?>
ID, 'attachment-thumb' ); ?>
post_excerpt ) ) : ?>
post_excerpt ); ?>
-1,
'post_type' => 'attachment',
'post_mime_type' => 'image',
'post_parent' => get_the_ID()
);
$attachments = get_posts( $args );
// Reverse array to display them in chronological form instead of reverse chronological
$attachments = array_reverse( $attachments );
if( count( $attachments ) && ! post_password_required() ) : ?>
tag with flash fallback
* If more then one attached video is found, they are used as fallback to the first one
* Should work in most if not all browsers :)
*
* @uses get_posts() To retrieve attached videos
*
* @since Minimatica 1.0
*/
function minimatica_post_video() {
// Get attached videos
$args = array(
'numberposts' => -1,
'post_type' => 'attachment',
'post_mime_type' => 'video',
'post_parent' => get_the_ID()
);
$attachments = get_posts( $args );
// Reverse array to display them in chronological form instead of reverse chronological
$attachments = array_reverse( $attachments );
if( count( $attachments ) ) :
// Detect flash video format to use it as fallback
$mime_types = array();
foreach( $attachments as $attachment ) :
if( $attachment->post_mime_type == 'video/x-flv' )
$flash_video = $attachment;
endforeach;
endif;
if( count( $attachments ) && ! post_password_required() ) : ?>
post_mime_type == 'video/webm' ) echo '; codecs="vp8, vorbis"'; elseif( $attachment->post_mime_type == 'video/ogg' ) echo '; codecs="theora, vorbis"'; ?>'>
tag with flash fallback
* If more then one attached audio file is found, they are used as fallback to the first one
* Should work in most if not all browsers :)
*
* @uses get_posts() To retrieve attached audio files
*
* @since Minimatica 1.0
*/
function minimatica_post_audio() {
// Get attached audio files
$args = array(
'numberposts' => -1,
'post_type' => 'attachment',
'post_mime_type' => 'audio',
'post_parent' => get_the_ID()
);
$attachments = get_posts( $args );
// Reverse array to display them in chronological form instead of reverse chronological
$attachments = array_reverse( $attachments );
if( count( $attachments ) ) :
// Detect MP3 file to use it as flash fallback
$mime_types = array();
foreach( $attachments as $attachment ) :
if( $attachment->post_mime_type == 'audio/mpeg' )
$flash_audio = $attachment;
endforeach;
endif;
if( count( $attachments ) && ! post_password_required() ) : ?>
comment_type ) :
case '' :
?>
id="li-comment-">