esc_html__( 'Sidebar', 'advance-blog' ),
'id' => 'sidebar-1',
'description' => '',
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer Col-1', 'advance-blog' ),
'id' => 'footer-1',
'description' => '',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer Col-2', 'advance-blog' ),
'id' => 'footer-2',
'description' => '',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer Col-3', 'advance-blog' ),
'id' => 'footer-3',
'description' => '',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
}
add_action( 'widgets_init', 'advance_blog_widgets_init' );
/**
* function for google fonts
*/
if (!function_exists('advance_blog_fonts_url')) :
/**
* Return fonts URL.
*
* @since 1.0.0
* @return string Fonts URL.
*/
function advance_blog_fonts_url()
{
$fonts_url = '';
$fonts = array();
$subsets = 'latin,latin-ext';
if ('off' !== _x('on', 'Open Sans font: on or off', 'advance-blog')) {
$fonts[] = 'Open+Sans:300,300i,400,400i';
}
if ($fonts) {
$fonts_url = add_query_arg(array(
'family' => urldecode(implode('|', $fonts)),
'subset' => urldecode($subsets),
), '//fonts.googleapis.com/css');
}
return $fonts_url;
}
endif;
if( !function_exists( 'advance_blog_social_menu_icon' ) ) :
function advance_blog_social_menu_icon( $item_output, $item, $depth, $args ) {
// Add Icon
if ( isset( $args->theme_location ) && 'social' === $args->theme_location ) {
$svg = Advance_Blog_SVG_Icons::get_theme_svg_name( $item->url );
if ( empty( $svg ) ) {
$svg = advance_blog_the_theme_svg( 'link',$return = true );
}
$item_output = str_replace( $args->link_after, '' . $svg, $item_output );
}
return $item_output;
}
endif;
add_filter( 'walker_nav_menu_start_el', 'advance_blog_social_menu_icon', 10, 4 );
/**
* Advance Blog SVG Icon helper functions
*
* @package Advance Blog
* @since 1.0.0
*/
if ( ! function_exists( 'advance_blog_the_theme_svg' ) ):
/**
* Output and Get Theme SVG.
* Output and get the SVG markup for an icon in the Advance_Blog_SVG_Icons class.
*
* @param string $svg_name The name of the icon.
* @param string $group The group the icon belongs to.
* @param string $color Color code.
*/
function advance_blog_the_theme_svg( $svg_name, $return = false ) {
if( $return ){
return advance_blog_get_theme_svg( $svg_name ); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped in advance_blog_get_theme_svg();.
}else{
echo advance_blog_get_theme_svg( $svg_name ); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped in advance_blog_get_theme_svg();.
}
}
endif;
if ( ! function_exists( 'advance_blog_get_theme_svg' ) ):
/**
* Get information about the SVG icon.
*
* @param string $svg_name The name of the icon.
* @param string $group The group the icon belongs to.
* @param string $color Color code.
*/
function advance_blog_get_theme_svg( $svg_name ) {
// Make sure that only our allowed tags and attributes are included.
$svg = wp_kses(
Advance_Blog_SVG_Icons::get_svg( $svg_name ),
array(
'svg' => array(
'class' => true,
'xmlns' => true,
'width' => true,
'height' => true,
'viewbox' => true,
'aria-hidden' => true,
'role' => true,
'focusable' => true,
),
'path' => array(
'fill' => true,
'fill-rule' => true,
'd' => true,
'transform' => true,
),
'polygon' => array(
'fill' => true,
'fill-rule' => true,
'points' => true,
'transform' => true,
'focusable' => true,
),
)
);
if ( ! $svg ) {
return false;
}
return $svg;
}
endif;
if ( ! function_exists( 'advance_blog_svg_escape' ) ):
/**
* Get information about the SVG icon.
*
* @param string $svg_name The name of the icon.
* @param string $group The group the icon belongs to.
* @param string $color Color code.
*/
function advance_blog_svg_escape( $input ) {
// Make sure that only our allowed tags and attributes are included.
$svg = wp_kses(
$input,
array(
'svg' => array(
'class' => true,
'xmlns' => true,
'width' => true,
'height' => true,
'viewbox' => true,
'aria-hidden' => true,
'role' => true,
'focusable' => true,
),
'path' => array(
'fill' => true,
'fill-rule' => true,
'd' => true,
'transform' => true,
),
'polygon' => array(
'fill' => true,
'fill-rule' => true,
'points' => true,
'transform' => true,
'focusable' => true,
),
)
);
if ( ! $svg ) {
return false;
}
return $svg;
}
endif;
if( !function_exists('advance_blog_post_format_icon') ):
// Post Format Icon.
function advance_blog_post_format_icon( ){
global $post;
$format = get_post_format( $post->ID ) ? : 'standard';
if( $format == 'video' ){
$icon = advance_blog_get_theme_svg( 'video' );
}elseif( $format == 'audio' ){
$icon = advance_blog_get_theme_svg( 'audio' );
}elseif( $format == 'gallery' ){
$icon = advance_blog_get_theme_svg( 'gallery' );
}elseif( $format == 'quote' ){
$icon = advance_blog_get_theme_svg( 'quote' );
}elseif( $format == 'image' ){
$icon = advance_blog_get_theme_svg( 'image' );
}else{
$icon = '';
}
if( !empty( $icon ) ){ ?>
__('One Click Demo Import', 'advance-blog'),
'slug' => 'one-click-demo-import',
'required' => false,
)
);
$advance_blog_plugins_config = array(
'dismissable' => true,
);
tgmpa($advance_blog_plugins, $advance_blog_plugins_config);
}
endif;
add_action('tgmpa_register', 'advance_blog_recommended_plugins');
function advance_blog_check_other_plugin() {
// check for plugin using plugin name
if (is_plugin_active('one-click-demo-import/one-click-demo-import.php')) {
// Disable PT branding.
add_filter('pt-ocdi/disable_pt_branding', '__return_true');
//plugin is activated
function ocdi_after_import_setup() {
// Assign menus to their locations.
$main_menu = get_term_by('name', 'Primary Menu', 'nav_menu');
$social_menu = get_term_by('name', 'Social menu', 'nav_menu');
set_theme_mod('nav_menu_locations', array(
'menu-1' => $main_menu->term_id,
'social' => $social_menu->term_id,
)
);
// Assign front page and posts page (blog page).
$front_page_id = get_page_by_title('');
$blog_page_id = get_page_by_title('Blog');
update_option('show_on_front', 'page');
update_option('page_on_front', $front_page_id->ID);
update_option('page_for_posts', $blog_page_id->ID);
}
add_action('pt-ocdi/after_import', 'ocdi_after_import_setup');
}
}
add_action('admin_init', 'advance_blog_check_other_plugin');