<?php
/*********=============== Sidebar ============*****************/
if(!function_exists('roofers_sidebar')){
	function roofers_sidebar(){
		get_sidebar();
	}
}
/*********=============== add a menu start ============*****************/
if(!function_exists('roofers_menu_editor')){
 function roofers_menu_editor($args){
	    if ( ! current_user_can( 'edit_theme_options' ) ){
		    return;
	   	}
        // see wp-includes/nav-menu-template.php for available arguments
        extract( $args );
        $link = $link_before
              . '<a href="' .esc_url(admin_url( 'nav-menus.php' )) . '">' . $before . esc_html__('Add a menu','roofers') . $after . '</a>'
             . $link_after;
        // We have a list
       if ( FALSE !== stripos( $items_wrap, '<ul' )
        
	       or FALSE !== stripos( $items_wrap, '<ol' )
		)
		{
			$link = "<li>$link</li>";
		}
		$output = sprintf( $items_wrap, $menu_id, $menu_class, $link );
		if ( ! empty ( $container ) ){
			$output  = "<$container class='$container_class' id='$container_id'>$output</$container>";
		}
		if ( $echo ){
			echo "$output";
		}
		return $output;
	}
}
/*********========= start edit archive count ======*********/
add_filter('get_archives_link', 'roofers_archive_count');
function roofers_archive_count($links) {
$links = str_replace('</a>&nbsp;(', '&nbsp;<span>(', $links);
$links = str_replace(')', ')</span></a>', $links);
return $links;
} 

add_filter('get_archives_link', 'roofers_archive_count1');
function roofers_archive_count1($links) {
$links = str_replace(')</span></a></option>', ')</option>', $links);
return $links;
}
/*********========= close edit archive count ======*********/
/*********========= edit category ======*********/
add_filter('wp_list_categories', 'roofers_cat_count');
function roofers_cat_count($links) {
$links = str_replace('</a> (', ' <span>(', $links);
$links = str_replace(')', ')</span></a>', $links);
return $links;
}
// Load Google fonts
function roofers_google_fonts_url() {
    $fonts_url = '';
    $OpenSans = _x( 'on', 'Open Sans Script font: on or off', 'roofers' );   

    if (  'off' !== $OpenSans  )
    {
        $font_families = array();
		
		if ('off' !== $OpenSans) {
            $font_families[] = 'Open Sans:300,300i,400,400i,600,600i,700,700i,800,800i';
        }

        $query_args = array(
            'family' => urlencode(implode('|', $font_families )),
            'subset' => urlencode('latin,latin-ext')
        );

        $fonts_url = add_query_arg($query_args, 'https://fonts.googleapis.com/css');
    }

    return esc_url_raw($fonts_url); 
}

// Google fonts
function roofers_enqueue_googlefonts() {
    wp_enqueue_style( 'roofers-googlefonts', roofers_google_fonts_url(), array(), null );
}
add_action('wp_enqueue_scripts', 'roofers_enqueue_googlefonts');

// Footer copyrigth
if ( ! function_exists( 'roofers_footer_copyright_text' ) ) {

	/**
	 * Displays the footer copyright text information
	 */
	function roofers_footer_copyright_text() {
		$site_link = '<a href="' . esc_url( home_url( '/' ) ) . '" title="' . esc_attr( get_bloginfo( 'name', 'display' ) ) . '" ><span>' . get_bloginfo( 'name', 'display' ) . '</span></a>';
		
		$wp_link = '<a href="'.esc_url( __( 'https://wordpress.org/', 'roofers' ) ).'" target="_blank" title="' . esc_attr__( 'WordPress', 'roofers' ) . '"><span>' . esc_html__( 'WordPress', 'roofers' ) . '</span></a>';

		$tg_link =  '<a href="'.esc_url( 'http://pixelnx.com/wp/demo/roofers-wordpress-theme' ).'" target="_blank" title="'.esc_attr__( 'PixelNX', 'roofers' ).'" rel="designer"><span>'.esc_html__( 'PixelNX', 'roofers') .'</span></a>';

		$default_footer_value = sprintf( __( 'Copyright %1$s %2$s. All rights reserved.', 'roofers' ), date_i18n( __( 'Y', 'roofers' ) ), $site_link ).' '.sprintf( __( 'Powered by %s.', 'roofers' ), $wp_link ).' '.sprintf( __( 'Theme: %1$s by %2$s.', 'roofers' ), 'roofers', $tg_link ); 

		$roofers_footer_copyright = '<p class="ed_paragraph Copyright_text">'.$default_footer_value.'</p>';
		echo $roofers_footer_copyright;
	}
}
add_action( 'roofers_footer_copyright_text', 'roofers_footer_copyright_text', 10 );
function roofers_Category_list(){
    $roofers_cat_lists = get_categories(
        array(
            'hide_empty' => '0',
            'exclude' => '1',
        )
    );
    $roofers_cat_array = array();
    $roofers_cat_array[''] = esc_html__('--Choose--','roofers');
    foreach($roofers_cat_lists as $roofers_cat_list){
        $roofers_cat_array[$roofers_cat_list->slug] = $roofers_cat_list->name;
    }
    return $roofers_cat_array;
}

add_action( 'add_meta_boxes', 'post_meta_box_add' );
function post_meta_box_add()
{
    add_meta_box( 'slider-button', 'Slider Buttons Link', 'slider_post_meta_box', 'post', 'normal', 'high' );
}
function slider_post_meta_box()
{
    
  echo  '<label for="button_link">Button Link</label>
    <input type="text" name="button_link" id="button_link" value="" />';
        
}

/*********************** Require File Start **********************************/
get_template_part( 'vendor/include/roofers', 'enqueue' ); 
/************************* Require File End ************************************/
?>