$value) {
$link = get_theme_mod( $key, '' );
if ( !empty( $link ) ) {
$social_profiles_links += 1;
}
}
return $social_profiles_links;
}
}
if ( !function_exists('meta_news_layout_primary') ) {
/**
* Functions for Sidebars.
*/
function meta_news_layout_primary() {
$meta_news_settings = meta_news_get_option_defaults();
global $post;
if ($post) {
$meta_news_meta_layout = get_post_meta($post->ID, 'meta_news_sidebarlayout', true);
}
$meta_news_custom_layout = $meta_news_settings['meta_news_content_layout'];
if ( empty($meta_news_meta_layout) || is_archive() || is_search() || is_home() ) {
$meta_news_meta_layout = 'default';
}
if ( 'default' == $meta_news_meta_layout ) {
if ( ('right' == $meta_news_custom_layout) || ('nosidebar' == $meta_news_custom_layout) ) {
$class = 'col-lg-8 ';
}
elseif ( 'left' == $meta_news_custom_layout ) {
$class = 'col-lg-8 order-lg-2 ';
}
elseif ( 'fullwidth' == $meta_news_custom_layout ) {
$class = 'col-lg-12 ';
}
}
elseif ( ('meta-right' == $meta_news_meta_layout) || ('meta-nosidebar' == $meta_news_meta_layout) ) {
$class = 'col-lg-8 ';
}
elseif ( 'meta-left' == $meta_news_meta_layout ) {
$class = 'col-lg-8 order-lg-2 ';
}
elseif ( 'meta-fullwidth' == $meta_news_meta_layout ) {
$class = 'col-lg-12 ';
}
$sticky_column_class = '';
if ( ( ('default' == $meta_news_meta_layout) && ( !(('nosidebar' == $meta_news_custom_layout)|| (is_404()) || (is_search()) || ('fullwidth' == $meta_news_custom_layout)) ) ) || ( !(('default' == $meta_news_meta_layout) || ('meta-fullwidth' == $meta_news_meta_layout) || ('meta-nosidebar' == $meta_news_meta_layout)) ) ) {
$sticky_column_class = ' sticky-column-bottom';
}
echo '
';
}
}
if ( ! function_exists( 'meta_news_posted_on' ) ) :
/**
* Prints HTML with meta information for the current post-date/time.
*/
function meta_news_posted_on() {
$time_string = get_the_time( get_option( 'date_format' ) );
$posted_on = '
' . esc_html( $time_string ) . ' ';
echo '
' . $posted_on . '
';
}
endif;
if ( ! function_exists( 'meta_news_posted_by' ) ) :
/**
* Prints HTML with meta information of post author.
*/
function meta_news_posted_by() {
$byline = '
' . esc_html( get_the_author() ) . ' ';
echo '
' . $byline . '
';
}
endif;
if ( ! function_exists( 'meta_news_breadcrumbs' ) ) :
/**
* Simple Breadcrumbs.
*
* @since 1.1.1
*/
function meta_news_breadcrumbs() {
if ( ! function_exists( 'breadcrumb_trail' ) ) {
require_once get_template_directory() . '/assets/library/breadcrumbs/breadcrumbs.php';
}
$args = array(
'container' => 'div',
'show_browse' => false,
);
breadcrumb_trail($args);
}
endif;
if ( ! function_exists( 'meta_news_sections_title' ) ) {
/**
* Prints sections title with category link or blog page.
*/
function meta_news_sections_title($post_opt, $section_title, $post_cat) {
if ( $section_title !== '' ) { ?>
esc_html__( 'One Click Demo Import', 'meta-news' ),
'slug' => 'one-click-demo-import',
'required' => false,
),
);
tgmpa( $plugins );
}
endif;
add_action( 'tgmpa_register', 'meta_news_register_required_plugins' );
if ( ! function_exists( 'meta_news_ocdi_after_import' ) ) :
/**
* function to import/export demo data
*/
function meta_news_ocdi_after_import() {
// Set static front page and posts page
$front_page = 'Home';
$blog_page = 'Blog';
update_option( 'show_on_front', 'page' );
$pages = array(
'page_on_front' => $front_page,
'page_for_posts' => $blog_page,
);
foreach ( $pages as $option_key => $slug ) {
$result = get_page_by_title( $slug );
if ( $result ) {
if ( is_array( $result ) ) {
$object = array_shift( $result );
} else {
$object = $result;
}
update_option( $option_key, $object->ID );
}
}
// Assign navigation menu locations.
$menu_details = array(
'primary' => 'main-menu',
'right-section' => 'top-right-menu',
);
if ( !empty($menu_details) ) {
$nav_settings = array();
$current_menus = wp_get_nav_menus();
if ( !empty( $current_menus ) && !is_wp_error( $current_menus ) ) {
foreach ( $current_menus as $menu ) {
foreach ( $menu_details as $location => $menu_slug ) {
if ( $menu->slug === $menu_slug ) {
$nav_settings[ $location ] = $menu->term_id;
}
}
}
}
set_theme_mod( 'nav_menu_locations', $nav_settings );
}
}
endif;
add_action( 'pt-ocdi/after_import', 'meta_news_ocdi_after_import' );
// Disable PT branding.
add_filter( 'pt-ocdi/disable_pt_branding', '__return_true' );