__( 'Primary Menu', 'panaroma' ),
) );
register_nav_menus( array(
'useful' => __( 'Useful links', 'panaroma' ),
) );
add_theme_support( 'custom-background', array(
'default-color' => 'E6E1C4',
'default-image' => get_template_directory_uri().'/images/img/third-image.jpg',
) );
add_editor_style( 'editor-style.css' );
}
endif; // panaroma_setup
add_action( 'after_setup_theme', 'panaroma_setup' );
function panaroma_widgets_init() {
register_sidebar( array(
'name' => __( 'Blog Sidebar', 'panaroma' ),
'description' => __( 'Appears on blog page sidebar', 'panaroma' ),
'id' => 'sidebar-1',
'before_widget' => '',
'before_title' => '
',
) );
}
add_action( 'widgets_init', 'panaroma_widgets_init' );
define( 'OPTIONS_FRAMEWORK_DIRECTORY', get_stylesheet_directory_uri() . '/inc/' );
require_once dirname( __FILE__ ) . '/inc/options-framework.php';
// Loads options.php from child or parent theme
$optionsfile = locate_template( 'options.php' );
load_template( $optionsfile );
function panaroma_fonts_url(){
$font_url = '';
$robot_condensed = _x('on', 'Roboto Condensed: on or off', 'panaroma');
/* Translators:If any character not supported in your theme
* translate this to off, Do not translate to your own language.
*/
$roboto = _x('on', 'Roboto : on or off', 'panaroma');
/* Translators: If any character in your theme not supported
* by Roboto, translate this to 'off'. Do not translate
* to your own language.
*/
if( 'off' !== $robot_condensed || 'off' !== $roboto){
$font_families = array();
if('off' !== $robot_condensed){
$font_families[] = 'Roboto Condensed:300,400,600,700';
}
if('off' !== $roboto){
$font_families[] = 'Roboto:300,400,600,700';
}
$query_args = array(
'family' => urlencode(implode('|' , $font_families)),
);
$font_url = add_query_arg($query_args, '//fonts.googleapis.com/css');
}
return $font_url;
}
function panaroma_scripts() {
wp_enqueue_style('panaroma-font', panaroma_fonts_url(), array(), null);
wp_enqueue_style( 'panaroma-basic-style', get_stylesheet_uri() );
if ( (function_exists( 'of_get_option' )) && (of_get_option('sidebar-layout', true) != 1) ) {
if (of_get_option('sidebar-layout', true) == 'right') {
wp_enqueue_style( 'panaroma-layout', get_template_directory_uri()."/css/layouts/content-sidebar.css" );
}
else {
wp_enqueue_style( 'panaroma-layout', get_template_directory_uri()."/css/layouts/sidebar-content.css" );
}
}
else {
wp_enqueue_style( 'panaroma-layout', get_template_directory_uri()."/css/layouts/content-sidebar.css" );
}
wp_enqueue_style( 'panaroma-editor-style', get_template_directory_uri()."/editor-style.css", array('panaroma-layout') );
wp_enqueue_style( 'panaroma-main-style', get_template_directory_uri()."/css/main.css", array('panaroma-layout') );
wp_enqueue_script('panroma-jquery-min', 'http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js', array('jquery') );
wp_enqueue_script('panaroma-custom-script', get_template_directory_uri().'/js/custom.js', array('jquery'));
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'panaroma_scripts' );
function panaroma_custom_head_codes() {
if ( (function_exists( 'of_get_option' )) && (of_get_option('headcode1', true) != 1) ) {
echo esc_html( of_get_option('headcode1', true) );
}
if ( (function_exists( 'of_get_option' )) && (of_get_option('style2', true) != 1) ) {
echo "";
}
if ( function_exists( 'of_get_option' ) ) {
echo "";
}
}
add_action('wp_head', 'panaroma_custom_head_codes');
function panaroma_pagination() {
global $wp_query;
$big = 12345678;
$page_format = 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,
'type' => 'array'
) );
if( is_array($page_format) ) {
$paged = ( get_query_var('paged') == 0 ) ? 1 : get_query_var('paged');
echo '';
}
}
/**
* 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';
/**
* Load custom functions file.
*/
require get_template_directory() . '/inc/custom-functions.php';
function panaroma_custom_blogpost_pagination( $wp_query ){
$big = 999999999; // need an unlikely integer
if ( get_query_var('paged') ) { $pageVar = 'paged'; }
elseif ( get_query_var('page') ) { $pageVar = 'page'; }
else { $pageVar = 'paged'; }
$pagin = paginate_links( array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
'format' => '?'.$pageVar.'=%#%',
'current' => max( 1, get_query_var($pageVar) ),
'total' => $wp_query->max_num_pages,
'prev_text' => '« Prev',
'next_text' => 'Next »',
'type' => 'array'
) );
if( is_array($pagin) ) {
$paged = ( get_query_var('paged') == 0 ) ? 1 : get_query_var('paged');
echo '';
}
}
function panaroma_get_slug_by_id($id) {
$post_data = get_post($id, ARRAY_A);
$slug = $post_data['post_name'];
return $slug;
}
// Add support for Vertical Featured Images
if ( ! function_exists( 'panaroma_vertical_check' ) ) :
function panaroma_vertical_check( $html, $post_id, $post_thumbnail_id, $size, $attr ) {
$image_data = wp_get_attachment_image_src( $post_thumbnail_id , 'large' );
//Get the image width and height from the data provided by wp_get_attachment_image_src()
$width = $image_data[1];
$height = $image_data[2];
if ( $height > $width ) {
$html = str_replace( 'attachment-', 'vertical-image attachment-', $html );
}
return $html;
}
endif;
add_filter( 'post_thumbnail_html', 'panaroma_vertical_check', 10, 5 );