'Noto+Sans:400,400i,700',
'subset' => $subsets,
);
$font_url = add_query_arg( $query_args, "$protocol://fonts.googleapis.com/css" );
}
return $font_url;
}
/**
* Enqueue scripts and styles for front-end.
*
* @since Twenty Twelve 1.0
*
* @return void
*/
function keninvest_scripts_styles() {
$font_url = keninvest_get_font_url();
if ( ! empty( $font_url ) )
wp_enqueue_style( 'keninvest-fonts', esc_url_raw( $font_url ), array(), null );
}
add_action( 'wp_enqueue_scripts', 'keninvest_scripts_styles' );
/**
* Filter TinyMCE CSS path to include Google Fonts.
*
* Adds additional stylesheets to the TinyMCE editor if needed.
*
* @uses keninvest_get_font_url() To get the Google Font stylesheet URL.
*
* @since Twenty Twelve 1.2
*
* @param string $mce_css CSS path to load in TinyMCE.
* @return string Filtered CSS path.
*/
function keninvest_mce_css( $mce_css ) {
$font_url = keninvest_get_font_url();
if ( empty( $font_url ) )
return $mce_css;
if ( ! empty( $mce_css ) )
$mce_css .= ',';
$mce_css .= esc_url_raw( str_replace( ',', '%2C', $font_url ) );
return $mce_css;
}
add_filter( 'mce_css', 'keninvest_mce_css' );
/**
* Filter the page menu arguments.
*
* Makes our wp_nav_menu() fallback -- wp_page_menu() -- show a home link.
*
* @since Twenty Twelve 1.0
*/
function keninvest_page_menu_args( $args ) {
if ( ! isset( $args['show_home'] ) )
$args['show_home'] = true;
return $args;
}
add_filter( 'wp_page_menu_args', 'keninvest_page_menu_args' );
/**
* Register sidebars.
*
* Registers our main widget area and the front page widget areas.
*
* @since Twenty Twelve 1.0
*/
function keninvest_widgets_init() {
register_sidebar( array(
'name' => __( 'Main Sidebar', 'keninvest' ),
'id' => 'sidebar-1',
'description' => __( 'Appears on posts and pages except the optional Front Page template, which has its own widgets', 'keninvest' ),
'before_widget' => '',
'before_title' => '
',
) );
register_sidebar( array(
'name' => __( 'Footer Widget Area', 'keninvest' ),
'id' => 'footer-area',
'description' => __( 'Appears in the footer section of the site.', 'keninvest' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
/*register_sidebar( array(
'name' => __( 'Footer Menu Area', 'keninvest' ),
'id' => 'footer-menu',
'description' => __( 'Appears in the footer section of the site.', 'keninvest' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );*/
register_sidebar( array(
'name' => __( 'Footer Partners', 'keninvest' ),
'id' => 'footer-partners',
'description' => __( 'Appears in the footer section of the site.', 'keninvest' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
}
add_action( 'widgets_init', 'keninvest_widgets_init' );
/**
* Extend the default WordPress body classes.
*/
function keninvest_body_class( $classes ) {
if ( is_front_page() ) {
$classes[] = 'front-page';
if ( has_post_thumbnail() )
$classes[] = 'has-post-thumbnail';
}
if ( is_page_template( 'page-templates/contact.php' ) ) {
$classes[] = 'contact';
}
if ( is_page_template( 'page-templates/page-circuits.php' ) ) {
$classes[] = 'circuits';
}
$lang = pll_current_language();
$classes[] = 'lang-'.$lang;
return $classes;
}
add_filter( 'body_class', 'keninvest_body_class' );
// Suppression de la sauvegarde automatique
add_action('wp_print_scripts', 'no_autosave');
function no_autosave() {
wp_deregister_script('autosave');
};
// Suppression de la meta generator
remove_action('wp_head', 'wp_generator');
remove_action('wp_head', 'rsd_link');
remove_action('wp_head', 'wlwmanifest_link');
remove_action('wp_head', 'feed_links_extra', 3 );
remove_action('wp_head', 'feed_links', 2 );
//Ajout des fichers custom
add_action( 'wp_enqueue_scripts', 'add_js_css_scripts' );
function add_js_css_scripts() {
global $wp_styles;
wp_enqueue_script( 'modernizr', get_template_directory_uri() . '/lib/modernizr-2.8.3-respond-1.4.2.min.js', array(), '2.8.4', false);
wp_enqueue_script( 'bootstrap', get_template_directory_uri() . '/lib/bootstrap/js/bootstrap.min.js', array( 'jquery' ), '3.2', true);
wp_enqueue_script( 'script', get_template_directory_uri().'/js/custom.js', array('jquery'), '1.0', true );
if(is_front_page()) :
wp_enqueue_script( 'slick', get_template_directory_uri().'/js/slick.min.js', null, '1.0', true );
wp_enqueue_style( 'slick', get_template_directory_uri() . '/css/slick.css', array(), '1.0' );
endif;
wp_enqueue_style( 'bootstrap', get_template_directory_uri() . '/lib/bootstrap/css/bootstrap.min.css', array(), '3.2' );
// Loads our main stylesheet.
wp_enqueue_style( 'keninvest-style', get_stylesheet_uri() );
// Loads the Internet Explorer specific stylesheet.
wp_enqueue_style( 'keninvest-ie', get_template_directory_uri() . '/css/ie.css', array( 'keninvest-style' ), '20121010' );
$wp_styles->add_data( 'keninvest-ie', 'conditional', 'lte IE 9' );
// Loads translations
$translation_array = array(
/*'population' => __( 'Population', 'keninvest' ),
'Human_Development_Index' => __( 'Human Development Index', 'keninvest' ),
'Main_airports' => __( 'Main airports', 'keninvest' ),*/
'please_select' => __( 'Please select', 'keninvest' ),
'show_more' => __( 'Show more', 'keninvest' ),
'show_less' => __( 'Show less', 'keninvest' ),
);
wp_localize_script( 'script', 'traductions', $translation_array );
}
//Autorise exposant editor
function my_mce_buttons_2( $buttons ) {
$buttons[] = 'superscript';
return $buttons;
}
add_filter( 'mce_buttons_2', 'my_mce_buttons_2' );
//Autorise balises span
function override_mce_options($initArray)
{
$opts = '*[*]';
$initArray['valid_elements'] = $opts;
$initArray['extended_valid_elements'] = $opts;
return $initArray;
}
add_filter('tiny_mce_before_init', 'override_mce_options');
/* Autoriser les fichiers SVG */
function wpc_mime_types($mimes) {
$mimes['svg'] = 'image/svg+xml';
return $mimes;
}
add_filter('upload_mimes', 'wpc_mime_types');
add_filter('pll_get_post_types', 'unset_cpt_pll', 10, 2);
function unset_cpt_pll( $post_types, $is_settings ) {
$post_types['acf'] = 'acf';
return $post_types;
}
// remove comment script et css
function comment_removeScript() {
wp_dequeue_script('comment-reply');
remove_action( 'wp_head', array( $wp_widget_factory->widgets['WP_Widget_Recent_Comments'], 'recent_comments_style' ) );
}
add_action('wp_print_styles', 'comment_removeScript');
function twentyten_remove_recent_comments_style() {
global $wp_widget_factory;
remove_action( 'wp_head', array( $wp_widget_factory->widgets['WP_Widget_Recent_Comments'], 'recent_comments_style' ) );
}
add_action( 'widgets_init', 'twentyten_remove_recent_comments_style' );
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'wp_print_styles', 'print_emoji_styles' );
//Modifier la taille du excerpt
function new_excerpt_length($length) {
return 18;
}
add_filter('excerpt_length', 'new_excerpt_length',0);
//Remplace [...] par ... pour le excerpt_more
function custom_excerpt_more($more) {
return '...';
}
add_filter('excerpt_more', 'custom_excerpt_more');
// Ajout class menu footer
function my_secondary_menu_classes( $classes, $item, $args ) {
// Only affect the menu placed in the 'footer' wp_nav_bar() theme location
if ( 'footer' === $args->theme_location ) {
// Make these items 3-columns wide in Bootstrap
$classes[] = 'col-md-15 col-sm-3 col-xs-4';
}
return $classes;
}
add_filter( 'nav_menu_css_class', 'my_secondary_menu_classes', 10, 3 );
// Ajout class sub-menu
class My_Walker_Nav_Menu extends Walker_Nav_Menu {
function start_lvl(&$output, $depth) {
$indent = str_repeat("\t", $depth);
$output .= "\n$indent