esc_html__( 'Import Demo Content', 'bianco' ),
'import_file_url' => get_template_directory_uri() . '/include/demos/demo-content.xml',
'import_widget_file_url' => get_template_directory_uri() . '/include/demos/widget-content.wie',
),
);
}
add_filter( 'pt-ocdi/import_files', 'bianco_demo_content' );
/*======
*
* Body Classes
*
======*/
function bianco_class_names( $classes ) {
$classes[] = 'bianco-theme';
return $classes;
}
add_filter( 'body_class', 'bianco_class_names' );
/*======
*
* Excerpt More
*
======*/
function bianco_excerpt_more( $more ) {
return '...';
}
add_filter( 'excerpt_more', 'bianco_excerpt_more' );
/*======
*
* Excerpt Support for Pages
*
======*/
function bianco_excerpts_for_pages() {
add_post_type_support( 'page', 'excerpt' );
}
add_action( 'init', 'bianco_excerpts_for_pages' );
/*======
*
* Pagination for Archive
*
======*/
function bianco_pagination() {
$args = array(
'prev_text' => esc_html__( 'Prev', 'bianco' ),
'next_text' => esc_html__( 'Next', 'bianco' ),
'type' => 'list',
);
if( !empty( paginate_links( $args ) ) ) {
echo '
';
}
}
/*======
*
* Pagination for Elements
*
======*/
function bianco_element_pagination( $paged = "", $query = "" ) {
if( !empty( $paged ) or !empty( $query ) ) {
$output = "";
$args = array(
'prev_text' => esc_html__( 'Prev', 'bianco' ),
'next_text' => esc_html__( 'Next', 'bianco' ),
'type' => 'list',
'total' => $query->max_num_pages
);
if( !empty( paginate_links( $args ) ) ) {
$output .= '';
}
return $output;
}
}
/*======
*
* Menus
*
======*/
register_nav_menus(
array(
'main-menu' => esc_html__( 'Main Menu', 'bianco' ),
'footer-menu' => esc_html__( 'Footer Menu', 'bianco' ),
)
);
/*======
*
* Menu Walker
*
======*/
class bianco_walker extends Walker_Nav_Menu {
public function start_lvl( &$output, $depth = 0, $args = array() ) {
$indent = str_repeat( "\t", $depth );
$output .= "\n$indent\n";
}
function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
$indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
$li_attributes = '';
$class_names = $value = '';
$classes = empty( $item->classes ) ? array() : (array) $item->classes;
if ($args->has_children){
$classes[] = 'dropdown';
$li_attributes .= ' data-dropdown="dropdown"';
}
$classes[] = 'menu-item-' . $item->ID;
$classes[] = ($item->current) ? 'active' : '';
$class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) );
$class_names = ' class="nav-item ' . esc_attr( $class_names ) . '"';
$id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args );
$id = strlen( $id ) ? ' id="' . esc_attr( $id ) . '"' : '';
$output .= $indent . '- ';
$attributes = ! empty( $item->attr_title ) ? ' title="' . esc_attr( $item->attr_title ) .'"' : '';
$attributes .= ! empty( $item->target ) ? ' target="' . esc_attr( $item->target ) .'"' : '';
$attributes .= ! empty( $item->xfn ) ? ' rel="' . esc_attr( $item->xfn ) .'"' : '';
$attributes .= ! empty( $item->url ) ? ' href="' . esc_attr( $item->url ) .'"' : '';
$attributes .= ! empty( $item->url ) ? ' class="nav-link"' : '';
$attributes .= ($args->has_children) ? ' ' : '';
$item_output = $args->before;
$item_output .= '';
$item_output .= $args->link_before;
$item_output .= apply_filters( 'the_title', $item->title, $item->ID );
$item_output .= $args->link_after;
$item_output .= ($args->has_children) ? '' : '';
$item_output .= '';
$item_output .= $args->after;
$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
}
public function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) {
if ( ! $element )
return;
$id_field = $this->db_fields['id'];
// Display this element.
if ( is_object( $args[0] ) )
$args[0]->has_children = ! empty( $children_elements[ $element->$id_field ] );
parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output );
}
}
/*======
*
* Search Form
*
======*/
function bianco_search_form( $button = "true", $placeholder = "" ) {
$output = '';
return $output;
}
/*======
*
* Social Media Sites
*
======*/
function bianco_social_media_sites() {
$social_sites = bianco_social_media_array_filter();
foreach ( $social_sites as $social_site => $profile ) {
if ( strlen( get_theme_mod( $social_site ) ) > 0 ) {
$active_social_sites[ $social_site ] = $social_site;
}
}
if ( ! empty( $active_social_sites ) ) {
$output = '
';
foreach ( $active_social_sites as $key => $active_site ) {
$icon_class = 'fa-' . esc_attr( $active_site );
$link_name = $active_site;
$label = ucfirst( $active_site );
if ( $active_site == 'twitter' ) {
$label = esc_html__( 'Twitter', 'bianco' );
} elseif ( $active_site == 'facebook' ) {
$label = esc_html__( 'Facebook', 'bianco' );
$icon_class = 'fa-facebook-f';
} elseif ( $active_site == 'google-plus' ) {
$label = esc_html__( 'Google Plus', 'bianco' );
$icon_class = 'fa-google-plus-g';
} elseif ( $active_site == 'pinterest' ) {
$label = esc_html__( 'Pinterest', 'bianco' );
$icon_class = 'fa-pinterest-p';
} elseif ( $active_site == 'youtube' ) {
$label = esc_html__( 'YouTube', 'bianco' );
} elseif ( $active_site == 'vimeo' ) {
$label = esc_html__( 'Vimeo', 'bianco' );
$icon_class = 'fa-vimeo-v';
} elseif ( $active_site == 'tumblr' ) {
$label = esc_html__( 'Tumblr', 'bianco' );
} elseif ( $active_site == 'instagram' ) {
$label = esc_html__( 'Instagram', 'bianco' );
} elseif ( $active_site == 'flickr' ) {
$label = esc_html__( 'Flickr', 'bianco' );
} elseif ( $active_site == 'dribbble' ) {
$label = esc_html__( 'Dribbble', 'bianco' );
} elseif ( $active_site == 'reddit' ) {
$label = esc_html__( 'Reddit', 'bianco' );
$icon_class = 'fa-reddit-alien';
} elseif ( $active_site == 'soundcloud' ) {
$label = esc_html__( 'SoundCloud', 'bianco' );
} elseif ( $active_site == 'spotify' ) {
$label = esc_html__( 'Spotify', 'bianco' );
} elseif ( $active_site == 'yahoo' ) {
$label = esc_html__( 'Yahoo', 'bianco' );
} elseif ( $active_site == 'behance' ) {
$label = esc_html__( 'Behance', 'bianco' );
} elseif ( $active_site == 'delicious' ) {
$label = esc_html__( 'Delicious', 'bianco' );
} elseif ( $active_site == 'stumbleupon' ) {
$label = esc_html__( 'Stumbleupon', 'bianco' );
} elseif ( $active_site == 'deviantart' ) {
$label = esc_html__( 'DeviantArt', 'bianco' );
} elseif ( $active_site == 'digg' ) {
$label = esc_html__( 'Digg', 'bianco' );
} elseif ( $active_site == 'github' ) {
$label = esc_html__( 'GitHub', 'bianco' );
} elseif ( $active_site == 'medium' ) {
$label = esc_html__( 'Medium', 'bianco' );
$icon_class = 'fa-medium-m';
} elseif ( $active_site == 'steam' ) {
$label = esc_html__( 'Steam', 'bianco' );
$icon_class = 'fa-steam-symbol';
} elseif ( $active_site == 'vk' ) {
$label = esc_html__( 'VK', 'bianco' );
} elseif ( $active_site == '500px' ) {
$label = esc_html__( '500px', 'bianco' );
} elseif ( $active_site == 'foursquare' ) {
$label = esc_html__( 'Foursquare', 'bianco' );
} elseif ( $active_site == 'slack' ) {
$label = esc_html__( 'Slack', 'bianco' );
$icon_class = 'fa-slack-hash';
} elseif ( $active_site == 'whatsapp' ) {
$label = esc_html__( 'WhatsApp', 'bianco' );
} elseif ( $active_site == 'twitch' ) {
$label = esc_html__( 'Twitch', 'bianco' );
} elseif ( $active_site == 'paypal' ) {
$label = esc_html__( 'PayPal', 'bianco' );
} elseif ( $active_site == 'rss' ) {
$label = esc_html__( 'RSS', 'bianco' );
$icon_class = 'fas fa-rss';
} elseif ( $active_site == 'codepen' ) {
$label = esc_html__( 'CodePen', 'bianco' );
} elseif ( $active_site == 'linkedin' ) {
$label = esc_html__( 'LinkedIn', 'bianco' );
$icon_class = 'fa-linkedin-in';
} elseif ( $active_site == 'custom-url' ) {
$label = esc_html__( 'Custom Link', 'bianco' );
$icon_class = 'fas fa-external-link-alt';
}
$output .='- ';
$target_name = $link_name . '-target';
if( !empty( $target_name ) ) {
if( !empty( get_theme_mod( $target_name ) ) or get_theme_mod( $target_name ) == "1" ) {
$target = '_blank';
} else {
$target = '_self';
}
}
$output .= '';
$output .= '';
$output .= '';
$output .= '
';
}
$output .= '
';
return $output;
}
}
/*======
*
* Social Share
*
======*/
function bianco_social_share() {
$output = "";
$social_shares = bianco_social_share_array_filter();
foreach ( $social_shares as $social_share => $value ) {
if ( strlen( get_theme_mod( $social_share . '_share' ) ) == "1" ) {
$active_share_sites[ $social_share . '_share' ] = $social_share . '_share';
}
}
if ( !empty( $active_share_sites ) ) {
$output = '';
$output .= '
';
foreach ( $active_share_sites as $key => $site ) {
if ( $site == 'twitter' . '_share' ) {
$label = esc_html__( 'Twitter', 'bianco' );
$link = esc_url( 'https://twitter.com/intent/tweet?url=' . get_the_permalink() . '&text=' . urlencode( get_the_title() ) );
$icon_class = 'fab fa-twitter';
$icon_name = 'twitter';
} elseif ( $site == 'facebook' . '_share' ) {
$label = esc_html__( 'Facebook', 'bianco' );
$link = esc_url( 'https://www.facebook.com/sharer/sharer.php?u=' . get_the_permalink() . '&t=' . urlencode( get_the_title() ) );
$icon_class = 'fab fa-facebook-f';
$icon_name = 'facebook';
} elseif ( $site == 'google-plus' . '_share' ) {
$label = esc_html__( 'Google+', 'bianco' );
$link = esc_url( 'https://plus.google.com/share?url=' . get_the_permalink() );
$icon_class = 'fab fa-google-plus-g';
$icon_name = 'google-plus';
} elseif ( $site == 'linkedin' . '_share' ) {
$label = esc_html__( 'LinkedIn', 'bianco' );
$link = esc_url( 'https://www.linkedin.com/shareArticle?mini=true&url=' . get_the_permalink() . '&title=' . urlencode( get_the_title() ) );
$icon_class = 'fab fa-linkedin-in';
$icon_name = 'linkedin';
} elseif ( $site == 'pinterest' . '_share' ) {
$label = esc_html__( 'Pinterest', 'bianco' );
$link = esc_url( 'https://pinterest.com/pin/create/button/?url=' . get_the_permalink() . '&description=' . urlencode( get_the_title() ) );
$icon_class = 'fab fa-pinterest-p';
$icon_name = 'pinterest';
} elseif ( $site == 'reddit' . '_share' ) {
$label = esc_html__( 'Reddit', 'bianco' );
$link = esc_url( 'https://reddit.com/submit?url=' . get_the_permalink() . '&title=' . urlencode( get_the_title() ) );
$icon_class = 'fab fa-reddit-alien';
$icon_name = 'reddit';
} elseif ( $site == 'delicious' . '_share' ) {
$label = esc_html__( 'Delicious', 'bianco' );
$link = esc_url( 'https://del.icio.us/post?url=' . get_the_permalink() );
$icon_class = 'fab fa-delicious';
$icon_name = 'delicious';
} elseif ( $site == 'stumbleupon' . '_share' ) {
$label = esc_html__( 'Stumbleupon', 'bianco' );
$link = esc_url( 'https://www.stumbleupon.com/submit?url=' . get_the_permalink() . '&title=' . get_the_title() );
$icon_class = 'fab fa-stumbleupon';
$icon_name = 'stumbleupon';
} elseif ( $site == 'tumblr' . '_share' ) {
$label = esc_html__( 'Tumblr', 'bianco' );
$link = esc_url( 'https://www.tumblr.com/share/link?url=' . get_the_permalink() );
$icon_class = 'fab fa-tumblr';
$icon_name = 'tumblr';
} elseif ( $site == 'whatsapp' . '_share' ) {
$label = esc_html__( 'WhatsApp', 'bianco' );
$link = 'whatsapp://send?text=' . get_the_permalink();
$icon_class = 'fab fa-whatsapp';
$icon_name = 'whatsapp';
} elseif ( $site == 'mail' . '_share' ) {
$label = esc_html__( 'Email', 'bianco' );
$link = 'mailto:' . get_the_permalink();
$icon_class = 'far fa-envelope';
$icon_name = 'envelope';
}
$link_name = $icon_name;
$label = ucfirst( $label );
if( is_single() or is_page() ) {
$post = get_the_ID();
} else {
$post = "";
}
if( $site == 'mail' . '_share' ) {
$target = "_self";
} else {
$target = "_blank";
}
$output .='- ';
$output .= '';
$output .= '';
$output .= '' . esc_html__( 'Share on', 'bianco' ) . ' ' . esc_attr( $label ) . '';
$output .= '';
$output .= '
';
}
$output .= '
';
$output .= '
';
}
return $output;
}
/*======
*
* Social Media of Authors
*
======*/
function bianco_user_social_links( $user_id = "" ) {
$output = "";
$user_social_sites = array(
'facebook' => 'bianco_user_facebook_url',
'twitter' => 'bianco_user_twitter_url',
'google-plus' => 'bianco_user_googleplus_url',
'pinterest' => 'bianco_user_pinterest_url',
'linkedin' => 'bianco_user_linkedin_url',
'youtube' => 'bianco_user_youtube_url',
'vimeo' => 'bianco_user_vimeo_url',
'tumblr' => 'bianco_user_tumblr_url',
'instagram' => 'bianco_user_instagram_url',
'flickr' => 'bianco_user_flickr_url',
'dribbble' => 'bianco_user_dribbble_url',
'reddit' => 'bianco_user_reddit_url',
'soundcloud' => 'bianco_user_soundcloud_url',
'spotify' => 'bianco_user_spotify_url',
'yahoo' => 'bianco_user_yahoo_url',
'behance' => 'bianco_user_behance_url',
'codepen' => 'bianco_user_codepen_url',
'delicious' => 'bianco_user_delicious_url',
'stumbleupon' => 'bianco_user_stumbleupon_url',
'deviantart' => 'bianco_user_deviantart_url',
'digg' => 'bianco_user_digg_url',
'github' => 'bianco_user_github_url',
'medium' => 'bianco_user_medium_url',
'steam' => 'bianco_user_steam_url',
'vk' => 'bianco_user_vk_url',
'500px' => 'bianco_user_500px_url',
'foursquare' => 'bianco_user_foursquare_url',
'slack' => 'bianco_user_slack_url',
'whatsapp' => 'bianco_user_whatsapp_url',
'skype' => 'bianco_user_skype_url',
'twitch' => 'bianco_user_twitch_url',
'paypal' => 'bianco_user_paypal_url',
'custom-url' => 'bianco_user_custom_url',
);
foreach ( $user_social_sites as $user_social_site => $value ) {
$active_sites[] = get_the_author_meta( $user_social_site, $user_id );
}
if( !empty( $active_sites ) ) {
$output .= '';
$author_url = get_the_author_meta( 'user_url' );
if ( !empty( $author_url ) ) {
$output .= ' ';
}
foreach ( $user_social_sites as $user_social_site => $value ) {
$label = ucfirst( $user_social_site );
$icon_class = 'fa-' . esc_attr( $user_social_site );
if ( $user_social_site == 'twitter' ) {
$label = esc_html__( 'Twitter', 'bianco' );
$icon_name = 'twitter';
} elseif ( $user_social_site == 'facebook' ) {
$label = esc_html__( 'Facebook', 'bianco' );
$icon_name = 'facebook';
$icon_class = 'fa-facebook-f';
} elseif ( $user_social_site == 'google-plus' ) {
$label = esc_html__( 'Google Plus', 'bianco' );
$icon_name = 'google-plus';
$icon_class = 'fa-google-plus-g';
} elseif ( $user_social_site == 'pinterest' ) {
$label = esc_html__( 'Pinterest', 'bianco' );
$icon_name = 'pinterest';
$icon_class = 'fa-pinterest-p';
} elseif ( $user_social_site == 'youtube' ) {
$label = esc_html__( 'YouTube', 'bianco' );
$icon_name = 'youtube';
} elseif ( $user_social_site == 'vimeo' ) {
$label = esc_html__( 'Vimeo', 'bianco' );
$icon_name = 'vimeo';
$icon_class = 'fa-vimeo-v';
} elseif ( $user_social_site == 'tumblr' ) {
$label = esc_html__( 'Tumblr', 'bianco' );
$icon_name = 'tumblr';
} elseif ( $user_social_site == 'instagram' ) {
$label = esc_html__( 'Instagram', 'bianco' );
$icon_name = 'instagram';
} elseif ( $user_social_site == 'flickr' ) {
$label = esc_html__( 'Flickr', 'bianco' );
$icon_name = 'flickr';
} elseif ( $user_social_site == 'dribbble' ) {
$label = esc_html__( 'Dribbble', 'bianco' );
$icon_name = 'dribbble';
} elseif ( $user_social_site == 'reddit' ) {
$label = esc_html__( 'Reddit', 'bianco' );
$icon_name = 'reddit';
$icon_class = 'fa-reddit-alien';
} elseif ( $user_social_site == 'soundcloud' ) {
$label = esc_html__( 'SoundCloud', 'bianco' );
$icon_name = 'soundcloud';
} elseif ( $user_social_site == 'spotify' ) {
$label = esc_html__( 'Spotify', 'bianco' );
$icon_name = 'spotify';
} elseif ( $user_social_site == 'yahoo' ) {
$label = esc_html__( 'Yahoo', 'bianco' );
$icon_name = 'yahoo';
} elseif ( $user_social_site == 'behance' ) {
$label = esc_html__( 'Behance', 'bianco' );
$icon_name = 'behance';
} elseif ( $user_social_site == 'delicious' ) {
$label = esc_html__( 'Delicious', 'bianco' );
$icon_name = 'delicious';
} elseif ( $user_social_site == 'stumbleupon' ) {
$label = esc_html__( 'Stumbleupon', 'bianco' );
$icon_name = 'stumbleupon';
} elseif ( $user_social_site == 'deviantart' ) {
$label = esc_html__( 'DeviantArt', 'bianco' );
$icon_name = 'deviantart';
} elseif ( $user_social_site == 'digg' ) {
$label = esc_html__( 'Digg', 'bianco' );
$icon_name = 'digg';
} elseif ( $user_social_site == 'github' ) {
$label = esc_html__( 'GitHub', 'bianco' );
$icon_name = 'github';
} elseif ( $user_social_site == 'medium' ) {
$label = esc_html__( 'Medium', 'bianco' );
$icon_name = 'medium';
$icon_class = 'fa-medium-m';
} elseif ( $user_social_site == 'steam' ) {
$label = esc_html__( 'Steam', 'bianco' );
$icon_name = 'steam';
$icon_class = 'fa-steam-symbol';
} elseif ( $user_social_site == 'vk' ) {
$label = esc_html__( 'VK', 'bianco' );
$icon_name = 'vk';
} elseif ( $user_social_site == '500px' ) {
$label = esc_html__( '500px', 'bianco' );
$icon_name = '500px';
} elseif ( $user_social_site == 'foursquare' ) {
$label = esc_html__( 'Foursquare', 'bianco' );
$icon_name = 'foursquare';
} elseif ( $user_social_site == 'slack' ) {
$label = esc_html__( 'Slack', 'bianco' );
$icon_name = 'slack';
$icon_class = 'fa-slack-hash';
} elseif ( $user_social_site == 'whatsapp' ) {
$label = esc_html__( 'WhatsApp', 'bianco' );
$icon_name = 'whatsapp';
} elseif ( $user_social_site == 'twitch' ) {
$label = esc_html__( 'Twitch', 'bianco' );
$icon_name = 'twitch';
} elseif ( $user_social_site == 'paypal' ) {
$label = esc_html__( 'PayPal', 'bianco' );
$icon_name = 'paypal';
} elseif ( $user_social_site == 'codepen' ) {
$label = esc_html__( 'CodePen', 'bianco' );
$icon_name = 'codepen';
} elseif ( $user_social_site == 'linkedin' ) {
$label = esc_html__( 'LinkedIn', 'bianco' );
$icon_name = 'linkedin';
$icon_class = 'fa-linkedin-in';
} elseif ( $user_social_site == 'custom-url' ) {
$label = esc_html__( 'Link', 'bianco' );
$icon_name = 'link';
$icon_class = 'fas fa-external-link-alt';
}
$user_social_site = get_the_author_meta( $user_social_site, $user_id );
if( !empty( $user_social_site ) ) {
$output .= ' ';
}
}
$output .= '
';
}
return $output;
}
/*======
*
* Loader
*
======*/
function bianco_loader() {
$output = "";
$loader = get_theme_mod( 'bianco_loader', '1' );
$loader_logo = get_theme_mod( 'bianco_loader_logo' );
if( $loader == "1" ) {
$output .= '';
$output .= '
';
$output .= '
';
$output .= '
';
$output .= '
';
$output .= '
';
$output .= '
';
$output .= '
';
if( !empty( $loader_logo ) ) {
$output .= '
';
$output .= '
';
$output .= '
';
$output .= '';
$output .= '
';
}
$output .= '
';
}
return $output;
}
/*======
*
* Comment List Template
*
======*/
function bianco_comment( $comment, $args, $depth ) {
$GLOBALS['comment'] = $comment;
extract($args, EXTR_SKIP);
if ( 'div' == $args['style'] ) {
$tag = 'div';
$add_below = 'comment';
} else {
$tag = 'li';
$add_below = 'div-comment';
}
?>
< id="comment-">
'bianco-sidebar',
'name' => esc_html__( 'General Sidebar', 'bianco' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
)
);
register_sidebar(
array(
'id' => 'bianco-shop-sidebar',
'name' => esc_html__( 'Shop Sidebar', 'bianco' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
)
);
}
}
add_action( 'widgets_init', 'bianco_sidebars_init' );
/*======
*
* Sidebar & Wrapper Layouts
*
======*/
function bianco_content_before() {
if( is_category() ) {
$sidebar_position = get_theme_mod( 'bianco_categories_sidebar_position', 'right-sidebar' );
} elseif( is_search() ) {
$sidebar_position = get_theme_mod( 'bianco_searches_sidebar_position', 'right-sidebar' );
} elseif( is_woocommerce() ) {
$sidebar_position = get_theme_mod( 'bianco_woo_sidebar_position', 'no-sidebar' );
} elseif( is_tag() ) {
$sidebar_position = get_theme_mod( 'bianco_tags_sidebar_position', 'right-sidebar' );
} elseif( is_author() ) {
$sidebar_position = get_theme_mod( 'bianco_authors_sidebar_position', 'right-sidebar' );
} elseif( is_archive() ) {
$sidebar_position = get_theme_mod( 'bianco_archives_sidebar_position', 'right-sidebar' );
} elseif( is_attachment() ) {
$sidebar_position = get_theme_mod( 'bianco_attachments_sidebar_position', 'no-sidebar' );
} elseif( is_singular( 'post' ) ) {
$sidebar_position = get_theme_mod( 'bianco_posts_sidebar_position', 'no-sidebar' );
} elseif( is_page() ) {
$sidebar_position = get_theme_mod( 'bianco_pages_sidebar_position', 'no-sidebar' );
} else {
$sidebar_position = get_theme_mod( 'bianco_general_sidebar_position', 'right-sidebar' );
}
if( is_singular( 'post' ) or is_page() ) {
$custom_sidebar_position = get_post_meta( get_the_ID(), 'sidebar-position', true );
if( !empty( $custom_sidebar_position ) ) {
$sidebar_position = $custom_sidebar_position;
}
$narrow_layout = get_post_meta( get_the_ID(), 'page-narrow-layout', true );
if( !empty( $narrow_layout ) ) {
$narrow = $narrow_layout;
} else {
$narrow = "";
}
} else {
$narrow = "";
}
if( $sidebar_position == 'no-sidebar' ) {
if( is_singular( 'post' ) or $narrow == "1" ) {
echo '