403Webshell
Server IP : 91.134.83.25  /  Your IP : 216.73.216.137
Web Server : Apache
System : Linux plesk.serveurapc.fr 6.1.0-51-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.177-1 (2026-07-16) x86_64
User : marrasse ( 10057)
PHP Version : 8.2.32
Disable Function : opcache_get_status
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /var/www/vhosts/as-cp.fr/wpascp/wp-content/themes/agencepointcom/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/vhosts/as-cp.fr/wpascp/wp-content/themes/agencepointcom/functions.php
<?php
/**
 * Agence Point Com functions and definitions
 *
 * @link https://developer.wordpress.org/themes/basics/theme-functions/
 *
 * @package Agence_Point_Com
 */

if ( ! function_exists( 'agencepointcom_setup' ) ) :
	/**
	 * Sets up theme defaults and registers support for various WordPress features.
	 *
	 * Note that this function is hooked into the after_setup_theme hook, which
	 * runs before the init hook. The init hook is too late for some features, such
	 * as indicating support for post thumbnails.
	 */
	function agencepointcom_setup() {
		/*
		 * Make theme available for translation.
		 * Translations can be filed in the /languages/ directory.
		 * If you're building a theme based on Agence Point Com, use a find and replace
		 * to change 'agencepointcom' to the name of your theme in all the template files.
		 */
		load_theme_textdomain( 'agencepointcom', get_template_directory() . '/languages' );

		// Add default posts and comments RSS feed links to head.
		add_theme_support( 'automatic-feed-links' );

		/*
		 * Let WordPress manage the document title.
		 * By adding theme support, we declare that this theme does not use a
		 * hard-coded <title> tag in the document head, and expect WordPress to
		 * provide it for us.
		 */
		add_theme_support( 'title-tag' );

		/*
		 * Enable support for Post Thumbnails on posts and pages.
		 *
		 * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
		 */
		add_theme_support( 'post-thumbnails' );

		// This theme uses wp_nav_menu() in one location.
		register_nav_menus( array(
			'menu-1' => esc_html__( 'Primary', 'agencepointcom' ),
		) );

		/*
		 * Switch default core markup for search form, comment form, and comments
		 * to output valid HTML5.
		 */
		add_theme_support( 'html5', array(
			'search-form',
			'comment-form',
			'comment-list',
			'gallery',
			'caption',
		) );

		// Set up the WordPress core custom background feature.
		add_theme_support( 'custom-background', apply_filters( 'agencepointcom_custom_background_args', array(
			'default-color' => 'ffffff',
			'default-image' => '',
		) ) );

		// Add theme support for selective refresh for widgets.
		add_theme_support( 'customize-selective-refresh-widgets' );

		/**
		 * Add support for core custom logo.
		 *
		 * @link https://codex.wordpress.org/Theme_Logo
		 */
		add_theme_support( 'custom-logo', array(
			'height'      => 250,
			'width'       => 250,
			'flex-width'  => true,
			'flex-height' => true,
		) );
	}
endif;
add_action( 'after_setup_theme', 'agencepointcom_setup' );

/**
 * Set the content width in pixels, based on the theme's design and stylesheet.
 *
 * Priority 0 to make it available to lower priority callbacks.
 *
 * @global int $content_width
 */
function agencepointcom_content_width() {
	// This variable is intended to be overruled from themes.
	// Open WPCS issue: {@link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/1043}.
	// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
	$GLOBALS['content_width'] = apply_filters( 'agencepointcom_content_width', 640 );
}
add_action( 'after_setup_theme', 'agencepointcom_content_width', 0 );

/**
 * Register widget area.
 *
 * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
 */
function agencepointcom_widgets_init() {
	register_sidebar( array(
		'name'          => esc_html__( 'Sidebar', 'agencepointcom' ),
		'id'            => 'sidebar-1',
		'description'   => esc_html__( 'Add widgets here.', 'agencepointcom' ),
		'before_widget' => '<section id="%1$s" class="widget %2$s">',
		'after_widget'  => '</section>',
		'before_title'  => '<h2 class="widget-title">',
		'after_title'   => '</h2>',
	) );
}
add_action( 'widgets_init', 'agencepointcom_widgets_init' );

/**
 * Enqueue scripts and styles.
 */
function agencepointcom_scripts() {
	wp_enqueue_style( 'agencepointcom-style', get_stylesheet_uri() );

	wp_enqueue_script( 'agencepointcom-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20151215', true );

	wp_enqueue_script( 'agencepointcom-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20151215', true );

	if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
		wp_enqueue_script( 'comment-reply' );
	}
}
add_action( 'wp_enqueue_scripts', 'agencepointcom_scripts' );

/**
 * Implement the Custom Header feature.
 */
require get_template_directory() . '/inc/custom-header.php';

/**
 * Custom template tags for this theme.
 */
require get_template_directory() . '/inc/template-tags.php';

/**
 * Functions which enhance the theme by hooking into WordPress.
 */
require get_template_directory() . '/inc/template-functions.php';

/**
 * Customizer additions.
 */
require get_template_directory() . '/inc/customizer.php';

/**
 * Load Jetpack compatibility file.
 */
if ( defined( 'JETPACK__VERSION' ) ) {
	require get_template_directory() . '/inc/jetpack.php';
}

/**
 * Load WooCommerce compatibility file.
 */
if ( class_exists( 'WooCommerce' ) ) {
	require get_template_directory() . '/inc/woocommerce.php';
}

/*personnalisation*/
show_admin_bar(false);




// Désactiver santé du site
add_action('wp_dashboard_setup', 'themeprefix_remove_dashboard_widget' );
function themeprefix_remove_dashboard_widget() {
    remove_meta_box( 'dashboard_site_health', 'dashboard', 'normal' );
}
add_action( 'admin_menu', 'remove_site_health_menu' );  
function remove_site_health_menu(){
  remove_submenu_page( 'tools.php','site-health.php' ); 
}


// Bouton visiter le site ouverture nouvel onglet
add_action( 'admin_bar_menu', 'vsnt_node', 999 );
function vsnt_node( $wp_admin_bar ) {
    $all_toolbar_nodes = $wp_admin_bar->get_nodes();
    foreach ( $all_toolbar_nodes as $node ) {
        if($node->id == 'site-name' || $node->id == 'view-site')
        {
            $args = $node;
            $args->meta = array('target' => '_blank');
            $wp_admin_bar->add_node( $args );
        }
    }
}

// Désactiver Gutenberg
add_filter('use_block_editor_for_post', '__return_false', 10);
add_filter('use_block_editor_for_post_type', '__return_false', 10);

// Rubrique dans admin pour insérer informations dans top bar
add_action('admin_menu', 'ajout_menu_admin');
function ajout_menu_admin()  
{  
    add_options_page('Informations haut de page', 'Informations haut de page', 'manage_options', 'functions','infos_top_header');
    add_menu_page(null, 'Informations haut de page','edit_posts','/options-general.php?page=functions', null, '', 32);

}
function infos_top_header()
{
?>
    <div class="wrap conteneur_infos">
        <h2>Informations à afficher dans la top bar</h2>
        <form method="post" action="options.php">
            <?php wp_nonce_field('update-options') ?>
            <div>Téléphone : </div><div><input style="width:300px;" type="text" name="telephone_topheader" value="<?php echo get_option('telephone_topheader'); ?>" /></div><br>
            <div>Adresse : </div><div><input style="width:300px;" type="text" name="adresse_topheader" value="<?php echo get_option('adresse_topheader'); ?>" /></div><br>
            <div>Horaires : </div><div><input style="width:300px;" type="text" name="horaires_topheader" value="<?php echo get_option('horaires_topheader'); ?>" /></div><br>
            <div>URL page Facebook : </div><div><input style="width:300px;" type="text" name="facebook_topheader" value="<?php echo get_option('facebook_topheader'); ?>" /></div><br>
            <div>URL compte Twitter : </div><div><input style="width:300px;" type="text" name="twitter_topheader" value="<?php echo get_option('twitter_topheader'); ?>" /></div><br>
            <div>URL compte Instagram : </div><div><input style="width:300px;" type="text" name="instagram_topheader" value="<?php echo get_option('instagram_topheader'); ?>" /></div><br>
            <div>URL compte Instagram : </div><div><input style="width:300px;" type="text" name="linkedin_topheader" value="<?php echo get_option('linkedin_topheader'); ?>" /></div><br>

            <p><input type="submit" name="Submit" value="Enregistrer" /></p>
            <input type="hidden" name="page_options" value="telephone_topheader,adresse_topheader,horaires_topheader,facebook_topheader,twitter_topheader,instagram_topheader,linkedin_topheader" />
            <input type="hidden" name="action" value="update" />
        </form>
    </div>
<?php
}

// Mise au format téléphone
function sanitize_phone($phone){
  $phone = str_replace(' ','',$phone);
  $phone = substr_replace($phone,'+33',0,1);

  return $phone;
}

// Création menu top Header
function menu_top_header() {
  register_nav_menu('menu-top-header',__( 'Menu en-tête' ));
}
add_action( 'init', 'menu_top_header' );


// Ajout classe role utilisateur dans admin
function add_role_to_body($rolessite) {
  global $current_user;
  $user_role = array_shift($current_user->roles);
  $rolessite .= 'role-'. $user_role;
  return $rolessite;
}
add_filter('admin_body_class', 'add_role_to_body');


// Ajout de css pour espace admin (dissimulation d'éléments non utiles aux users par exemple)
add_action('admin_head', 'my_custom_css');
function my_custom_css()
{
	echo 
	'<style>
		.maclasse
		{
		display:none!important;
		}
	</style>';
};

// Sidebar footer
function sidebar_footer() {
    register_sidebar( array(
        'name'          => __( 'Pied de page 1', 'theme_name' ),
        'id'            => 'sidebar-footer1',
        'before_widget' => '<aside id="%1$s" class="widget %2$s">',
        'after_widget'  => '</aside>',
        'before_title'  => '<h3 class="widget-title">',
        'after_title'   => '</h3>',
    ) );
    register_sidebar( array(
        'name'          => __( 'Pied de page 2', 'theme_name' ),
        'id'            => 'sidebar-footer2',
        'before_widget' => '<aside id="%1$s" class="widget %2$s">',
        'after_widget'  => '</aside>',
        'before_title'  => '<h3 class="widget-title">',
        'after_title'   => '</h3>',
    ) );

    register_sidebar( array(
        'name'          => __( 'Pied de page 3', 'theme_name' ),
        'id'            => 'sidebar-footer3',
        'before_widget' => '<aside id="%1$s" class="widget %2$s">',
        'after_widget'  => '</aside>',
        'before_title'  => '<h3 class="widget-title">',
        'after_title'   => '</h3>',
    ) );
    
    register_sidebar( array(
        'name'          => __( 'Pied de page 4', 'theme_name' ),
        'id'            => 'sidebar-footer4',
        'before_widget' => '<aside id="%1$s" class="widget %2$s">',
        'after_widget'  => '</aside>',
        'before_title'  => '<h3 class="widget-title">',
        'after_title'   => '</h3>',
    ) );
    register_sidebar( array(
        'name'          => __( 'Pied de page 5', 'theme_name' ),
        'id'            => 'sidebar-footer5',
        'before_widget' => '<aside id="%1$s" class="widget %2$s">',
        'after_widget'  => '</aside>',
        'before_title'  => '<h3 class="widget-title">',
        'after_title'   => '</h3>',
    ) );
    
}
add_action( 'widgets_init', 'sidebar_footer' );


// Personnalisation page connexion 
function my_login_logo() { ?>
    <style type="text/css">
        .login h1 a {
            background-image: url(<?php echo get_stylesheet_directory_uri(); ?>/img/logo_apc.png)!important;
            padding-bottom: 0px!important;
        background-size: 300px auto!important;
        min-height: 250px!important;
        width: 300px!important;
    }
    .login-action-login{
      background-color: #313131!important;
    }
    #loginform{
      background-color: rgba(0,0,0,0)!important;
      box-shadow: none!important;
    }
    #loginform label{
      color: #FFF!important;
    }
    .login-action-login #nav a,.login-action-login #backtoblog a{
      color: #FFF!important;
    }
    .login-action-login #nav a:hover,.login-action-login #backtoblog a:hover{
      color: #cccccc!important;
    }
    .submit #wp-submit{
      background-color: #4083a8!important;
      border: 2px solid #FFF!important;
      color: #FFF!important;
      border-radius: 0!important;
    }
    .wp-core-ui .button-primary{
      box-shadow: none!important;
      text-shadow: none!important;
    }
    </style>
<?php }
add_action( 'login_enqueue_scripts', 'my_login_logo' );

 // Personnalisation url logo page connexion 
add_filter( 'login_headerurl', 'custom_loginlogo_url' );
function custom_loginlogo_url($url) {
    return  get_home_url();
}

// Changer title logo hover page login
function put_my_title(){
    $titre_site= get_bloginfo( 'name' );
return ($titre_site); // changing the title from "Powered by WordPress" to whatever you wish
}
add_filter('login_headertitle', 'put_my_title');


/*
 * Ajout fonction dupliquer posts
 */
function rd_duplicate_post_as_draft(){
    global $wpdb;
    if (! ( isset( $_GET['post']) || isset( $_POST['post'])  || ( isset($_REQUEST['action']) && 'rd_duplicate_post_as_draft' == $_REQUEST['action'] ) ) ) {
        wp_die('No post to duplicate has been supplied!');
    }
 
    /*
     * Nonce verification
     */
    if ( !isset( $_GET['duplicate_nonce'] ) || !wp_verify_nonce( $_GET['duplicate_nonce'], basename( __FILE__ ) ) )
        return;
 
    /*
     * get the original post id
     */
    $post_id = (isset($_GET['post']) ? absint( $_GET['post'] ) : absint( $_POST['post'] ) );
    /*
     * and all the original post data then
     */
    $post = get_post( $post_id );
 
    /*
     * if you don't want current user to be the new post author,
     * then change next couple of lines to this: $new_post_author = $post->post_author;
     */
    $current_user = wp_get_current_user();
    $new_post_author = $current_user->ID;
 
    /*
     * if post data exists, create the post duplicate
     */
    if (isset( $post ) && $post != null) {
 
        /*
         * new post data array
         */
        $args = array(
            'comment_status' => $post->comment_status,
            'ping_status'    => $post->ping_status,
            'post_author'    => $new_post_author,
            'post_content'   => $post->post_content,
            'post_excerpt'   => $post->post_excerpt,
            'post_name'      => $post->post_name,
            'post_parent'    => $post->post_parent,
            'post_password'  => $post->post_password,
            'post_status'    => 'draft',
            'post_title'     => $post->post_title,
            'post_type'      => $post->post_type,
            'to_ping'        => $post->to_ping,
            'menu_order'     => $post->menu_order
        );
 
        /*
         * insert the post by wp_insert_post() function
         */
        $new_post_id = wp_insert_post( $args );
 
        /*
         * get all current post terms ad set them to the new post draft
         */
        $taxonomies = get_object_taxonomies($post->post_type); // returns array of taxonomy names for post type, ex array("category", "post_tag");
        foreach ($taxonomies as $taxonomy) {
            $post_terms = wp_get_object_terms($post_id, $taxonomy, array('fields' => 'slugs'));
            wp_set_object_terms($new_post_id, $post_terms, $taxonomy, false);
        }
 
        /*
         * duplicate all post meta just in two SQL queries
         */
        $post_meta_infos = $wpdb->get_results("SELECT meta_key, meta_value FROM $wpdb->postmeta WHERE post_id=$post_id");
        if (count($post_meta_infos)!=0) {
            $sql_query = "INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value) ";
            foreach ($post_meta_infos as $meta_info) {
                $meta_key = $meta_info->meta_key;
                if( $meta_key == '_wp_old_slug' ) continue;
                $meta_value = addslashes($meta_info->meta_value);
                $sql_query_sel[]= "SELECT $new_post_id, '$meta_key', '$meta_value'";
            }
            $sql_query.= implode(" UNION ALL ", $sql_query_sel);
            $wpdb->query($sql_query);
        }
 
 
        /*
         * finally, redirect to the edit post screen for the new draft
         */
        wp_redirect( admin_url( 'post.php?action=edit&post=' . $new_post_id ) );
        exit;
    } else {
        wp_die('Post creation failed, could not find original post: ' . $post_id);
    }
}
add_action( 'admin_action_rd_duplicate_post_as_draft', 'rd_duplicate_post_as_draft' );
 
/*
 * Add the duplicate link to action list for post_row_actions
 */
function rd_duplicate_post_link( $actions, $post ) {
    if (current_user_can('edit_posts')) {
        $actions['duplicate'] = '<a href="' . wp_nonce_url('admin.php?action=rd_duplicate_post_as_draft&post=' . $post->ID, basename(__FILE__), 'duplicate_nonce' ) . '" title="Dupliquer cette page" rel="permalink">Dupliquer</a>';
    }
    return $actions;
}
 
add_filter( 'post_row_actions', 'rd_duplicate_post_link', 10, 2 );
add_filter('page_row_actions', 'rd_duplicate_post_link', 10, 2);



// Réactiver justification du texte dans tiny mce
function parallel_admin_head()
{
    add_filter('mce_buttons', 'parallel_mce_buttons', 5);
}
function parallel_mce_buttons($buttons)
{
    $position = array_search('alignright', $buttons);
    if (! is_int($position)) {
        return array_merge($buttons, ['alignjustify']);
    }
    return array_merge(
        array_slice($buttons, 0, $position + 1),
        ['alignjustify'],
        array_slice($buttons, $position + 1)
    );
}
add_action('admin_head', 'parallel_admin_head', 5);


/* Pugins requis */
require_once dirname( __FILE__ ) . '/install/class-tgm-plugin-activation.php';
add_action( 'tgmpa_register', 'plugins_requis' );
function plugins_requis() {
	
	$plugins = array(

		// This is an example of how to include a plugin bundled with a theme.
		array(
			'name'     => 'Auto Optimize', // The plugin name
			'slug'     => 'autoptimize', // The plugin slug (typically the folder name)
			'source'   => get_stylesheet_directory() . '/plugins/autoptimize.zip', // The plugin source
			'required' => false, // If false, the plugin is only 'recommended' instead of required.
			'version'            => '', // E.g. 1.0.0. If set, the active plugin must be this version or higher. If the plugin version is higher than the plugin version installed, the user will be notified to update the plugin.
			'force_activation'   => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch.
			'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins.
			'external_url'       => '', // If set, overrides default API URL and points to an external URL.
			'is_callable'        => '', // If set, this callable will be be checked for availability to determine if a plugin is active.
		),
        array(
            'required' => false,
            'name'     => 'Contact Form 7', // The plugin name
            'slug'     => 'contact-form-7', // The plugin slug (typically the folder name)
            'force_activation'   => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch.
            'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins.
            'source'   => get_stylesheet_directory() . '/plugins/contact-form-7.zip', // The plugin source
        ),
        array(
            'name'     => 'Bakery Visual Composer', // The plugin name
            'slug'     => 'js_composer', // The plugin slug (typically the folder name)
            'required' => false, // If false, the plugin is only 'recommended' instead of required.
            'force_activation'   => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch.
            'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins.
            'source'   => get_stylesheet_directory() . '/plugins/js_composer.zip', // The plugin source
        ),
        array(
            'name'     => 'Loco Translate', // The plugin name
            'slug'     => 'loco-translate', // The plugin slug (typically the folder name)
            'required' => false, // If false, the plugin is only 'recommended' instead of required.
            'force_activation'   => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch.
            'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins.
            'source'   => get_stylesheet_directory() . '/plugins/loco-translate.zip', // The plugin source
        ),		
        array(
            'name'     => 'Redux Framework (pour plugin RGPD)', // The plugin name
            'slug'     => 'redux-framework', // The plugin slug (typically the folder name)
            'required' => false, // If false, the plugin is only 'recommended' instead of required.
            'force_activation'   => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch.
            'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins.
            'source'   => get_stylesheet_directory() . '/plugins/redux-framework.zip', // The plugin source
        ),
        array(
            'name'     => 'Revolution Slider', // The plugin name
            'slug'     => 'revslider', // The plugin slug (typically the folder name)
            'required' => false, // If false, the plugin is only 'recommended' instead of required.
            'force_activation'   => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch.
            'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins.
            'source'   => get_stylesheet_directory() . '/plugins/revslider.zip', // The plugin source
        ),
        array(
            'name'     => 'Plugin RGPD', // The plugin name
            'slug'     => 'rgpd', // The plugin slug (typically the folder name)
            'required' => false, // If false, the plugin is only 'recommended' instead of required.
            'force_activation'   => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch.
            'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins.
            'source'   => get_stylesheet_directory() . '/plugins/rgpd.zip', // The plugin source
        ),
        array(
            'required' => false,
            'name'     => 'User Role Editor Pro', // The plugin name
            'slug'     => 'user-role-editor-pro', // The plugin slug (typically the folder name)
            'force_activation'   => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch.
            'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins.
            'source'   => get_stylesheet_directory() . '/plugins/user-role-editor-pro.zip', // The plugin source
        ),
        array(
            'required' => false,
            'name'     => 'Regenerate Thumbnails', // The plugin name
            'slug'     => 'regenerate-thumbnails', // The plugin slug (typically the folder name)
            'force_activation'   => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch.
            'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins.
            'source'   => get_stylesheet_directory() . '/plugins/regenerate-thumbnails.zip', // The plugin source
        ),
        array(
            'name'     => 'Login Recaptcha (captcha pour page login)', // The plugin name
            'slug'     => 'login-recaptcha', // The plugin slug (typically the folder name)
            'required' => false, // If false, the plugin is only 'recommended' instead of required.
            'force_activation'   => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch.
            'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins.
            'source'   => get_stylesheet_directory() . '/plugins/login-recaptcha.zip', // The plugin source
        ),
        array(
            'name'     => 'Advanced Custom Fields Pro)', // The plugin name
            'slug'     => 'advanced-custom-fields-pro', // The plugin slug (typically the folder name)
            'required' => false, // If false, the plugin is only 'recommended' instead of required.
            'force_activation'   => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch.
            'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins.
            'source'   => get_stylesheet_directory() . '/plugins/advanced-custom-fields-pro.zip', // The plugin source
        ),  
        array(
            'name'     => 'Pagenavi', // The plugin name
            'slug'     => 'wp-pagenavi', // The plugin slug (typically the folder name)
            'required' => false, // If false, the plugin is only 'recommended' instead of required.
            'force_activation'   => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch.
            'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins.
            'source'   => get_stylesheet_directory() . '/plugins/wp-pagenavi.zip', // The plugin source
        ),  
        array(
            'required' => false,
            'name'     => 'Advanced Contact form 7 DB', // The plugin name
            'slug'     => 'advanced-cf7-db.1.7.2', // The plugin slug (typically the folder name)
            'force_activation'   => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch.
            'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins.
            'source'   => get_stylesheet_directory() . '/plugins/advanced-cf7-db.1.7.2.zip', // The plugin source
        ),  
        array(
            'required' => false,
            'name'     => 'Dashboard Widget Sidebar', // The plugin name
            'slug'     => 'dashboard-widget-sidebar', // The plugin slug (typically the folder name)
            'force_activation'   => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch.
            'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins.
            'source'   => get_stylesheet_directory() . '/plugins/dashboard-widget-sidebar.zip', // The plugin source
        ),
        array(
            'required' => false,
            'name'     => 'Wordfence', // The plugin name
            'slug'     => 'wordfence.7.4.10', // The plugin slug (typically the folder name)
            'force_activation'   => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch.
            'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins.
            'source'   => get_stylesheet_directory() . '/plugins/wordfence.7.4.10.zip', // The plugin source
        ),
        array(
            'required' => false,
            'name'     => 'Easy Update Manager', // The plugin name
            'slug'     => 'stops-core-theme-and-plugin-updates.9.0.6', // The plugin slug (typically the folder name)
            'force_activation'   => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch.
            'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins.
            'source'   => get_stylesheet_directory() . '/plugins/stops-core-theme-and-plugin-updates.9.0.6.zip', // The plugin source
        ),

        array(
            'required' => false,
            'name'     => 'ACF content analysis for Yoast', // The plugin name
            'slug'     => 'acf-content-analysis-for-yoast-seo.3.0.1', // The plugin slug (typically the folder name)
            'force_activation'   => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch.
            'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins.
            'source'   => get_stylesheet_directory() . '/plugins/acf-content-analysis-for-yoast-seo.3.0.1.zip', // The plugin source
        ),

        array(
            'required' => false,
            'name'     => 'Yoast Premium', // The plugin name
            'slug'     => 'wordpress-seo-premium', // The plugin slug (typically the folder name)
            'force_activation'   => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch.
            'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins.
            'source'   => get_stylesheet_directory() . '/plugins/wordpress-seo-premium.zip', // The plugin source
        ),

        array(
            'required' => false,
            'name'     => 'WP Migrate DB', // The plugin name
            'slug'     => 'wp-migrate-db.1.0.17', // The plugin slug (typically the folder name)
            'force_activation'   => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch.
            'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins.
            'source'   => get_stylesheet_directory() . '/plugins/wp-migrate-db.1.0.17.zip', // The plugin source
        ),
        array(
            'required' => false,
            'name'     => 'Superfly Responsive Menu', // The plugin name
            'slug'     => 'superfly-menu', // The plugin slug (typically the folder name)
            'force_activation'   => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch.
            'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins.
            'source'   => get_stylesheet_directory() . '/plugins/superfly-menu.zip', // The plugin source
        ),

        
        
        
	);

	/*
	 * Array of configuration settings. Amend each line as needed.
	 *
	 * TGMPA will start providing localized text strings soon. If you already have translations of our standard
	 * strings available, please help us make TGMPA even better by giving us access to these translations or by
	 * sending in a pull-request with .po file(s) with the translations.
	 *
	 * Only uncomment the strings in the config array if you want to customize the strings.
	 */
	$config = array(
		'id'           => 'tgmpa',                 // Unique ID for hashing notices for multiple instances of TGMPA.
		'default_path' => '',                      // Default absolute path to bundled plugins.
		'menu'         => 'plugins-requiss', // Menu slug.
		'parent_slug'  => 'themes.php',            // Parent menu slug.
		'capability'   => 'edit_theme_options',    // Capability needed to view plugin install page, should be a capability associated with the parent menu used.
		'has_notices'  => true,                    // Show admin notices or not.
		'dismissable'  => true,                    // If false, a user cannot dismiss the nag message.
		'dismiss_msg'  => '',                      // If 'dismissable' is false, this message will be output at top of nag.
		'is_automatic' => false,                   // Automatically activate plugins after installation or not.
		'message'      => 'Plugins conseillés',                      // Message to output right before the plugins table.
		
		'strings'      => array(
			'page_title'                      => __( 'Installation de Plugins', 'agencepointcom' ),
			'menu_title'                      => __( 'Installation de Plugins', 'agencepointcom' ),
			// <snip>...</snip>
			'nag_type'                        => 'updated', // Determines admin notice type - can only be 'updated', 'update-nag' or 'error'.
		)
		
	);

	tgmpa( $plugins, $config );
}

// Personnalisation de la structure des permarliens
add_action( 'init', function() {
    global $wp_rewrite;
    $wp_rewrite->set_permalink_structure( '/%postname%/' );
} );

// Retirer commentaires
function desactiver_commentaires() {

    // Turn off comments
    if( '' != get_option( 'default_ping_status' ) ) {
        update_option( 'default_ping_status', '' );
    } // end if

    // Turn off pings
    if( '' != get_option( 'default_comment_status' ) ) {
        update_option( 'default_comment_status', '' );
    } // end if

} // end desactiver_commentaires
add_action( 'after_setup_theme', 'desactiver_commentaires' );


// Désactiver mises à jour (décommenter les lignes ci-dessous)
add_filter( 'auto_update_plugin', '__return_false' );
add_filter( 'auto_update_theme', '__return_false' );
function remove_core_updates(){
global $wp_version;return(object) array('last_checked'=> time(),'version_checked'=> $wp_version,);
}
add_filter('pre_site_transient_update_core','remove_core_updates');
add_filter('pre_site_transient_update_plugins','remove_core_updates');
add_filter('pre_site_transient_update_themes','remove_core_updates');

add_image_size( 'archive', 350, 230, true );
add_image_size( 'prestations', 700, 700, true );

add_filter('excerpt_length', 'custom_excerpt_lenght' );

function custom_excerpt_lenght(){
    return 30;
}

add_shortcode('footer_infos', 'footer_infos_cb');
add_shortcode('footer_social', 'footer_social_cb');

function footer_infos_cb(){
    $str = '<div class = "footer_infos">';
    $str .= get_option('adresse_topheader')
        ? '<span>' . get_option('adresse_topheader') .'</span>'
        : '';
    if(get_option('telephone_topheader')){
        $str .=
        '<a 
        href = "tel:'.sanitize_phone(get_option('telephone_topheader')).'" 
        class = "phone-footer">'
            .get_option('telephone_topheader').
        '</a>';
    }
    $str .= '</div>';

    return $str;
}

function footer_social_cb(){
    $socials = array(
         'facebook_topheader'   => '<i class="fab fa-facebook-square"></i>' ,
         'instagram_topheader'  => '<i class="fab fa-instagram"></i>' ,
         'linkedin_topheader'   => '<i class="fab fa-linkedin"></i>' ,
         'twitter_topheader'    => '<i class="fab fa-twitter-square"></i>' ,
    );
	$str = '<div class = "footer_social">';

	foreach($socials as $social => $fa){
	    $str .= get_option($social)
            ? '<a target = "_blank" href = "'.get_option($social).'">'.$fa.'</a>'
            : '';
    }

	$str .= '</div>';

	return $str;

}

function acf_to_img($img,$size = ''){

    $title = $img['title'];
    $alt = $img['alt'];

    if(!$size){
        $url = $img['url'];
        $width = $img['width'];
        $height = $img['height'];
    }else{
	    $url = $img['sizes'][$size];
	    $width = $img['sizes'][$size.'-width'];
	    $height = $img['sizes'][$size.'-height'];
    }


    $img = "<img width = '" . $width ."' height = '" . $height . "' src = '" . $url . "' title = '" . $title . "' alt = '" . $alt . "'/>";

    return $img;
}



// Restaurer l'affichage classique des widgets dans l'admin
function example_theme_support() {
    remove_theme_support( 'widgets-block-editor' );
}
add_action( 'after_setup_theme', 'example_theme_support' );

Youez - 2016 - github.com/yon3zu
LinuXploit