Commit b6bdbd05 authored by agnez's avatar agnez

ajouter le projet

parent ccf13242
<?php
// Hiding Users by ID https://buddydev.com/hiding-users-on-buddypress-based-site/
add_filter( 'bp_after_has_members_parse_args', 'buddydev_exclude_users' );
function buddydev_exclude_users( $args ) {
//do not exclude in admin
if( is_admin() && ! defined( 'DOING_AJAX' ) ) {
return $args;
}
$excluded = isset( $args['exclude'] )? $args['exclude'] : array();
if( !is_array( $excluded ) ) {
$excluded = explode(',', $excluded );
}
$user_ids = array( 1,6 ); //user ids
$excluded = array_merge( $excluded, $user_ids );
$args['exclude'] = $excluded;
return $args;
}
?>
<?php /* Silence, so that search engines don't index/crawl this folder and it's contents */ ?>
\ No newline at end of file
<?php
/**
* @package vs-users
* @version 1.0
*/
/*
Plugin Name: VS users
Description: Plugin for Voisins Solidaires, managing user roles and capabilities
Author: Lore Mipsum
Text Domain: vs-users
Domain Path: /languages
Version: 1.0
Author URI: http://mipsum.be/
*/
defined( 'ABSPATH' ) or die();
add_action( 'plugins_loaded', 'vs_users_load_plugin_textdomain' );
function vs_users_load_plugin_textdomain() {
load_plugin_textdomain( 'vs-users', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
}
/*
* class for moving admin role out of editor's reach
* http://wordpress.stackexchange.com/questions/4479/editor-can-create-any-new-user-except-administrator
*/
class JPB_User_Caps {
// Add our filters
function __construct() {
add_filter( 'editable_roles', array(&$this, 'editable_roles'));
add_filter( 'map_meta_cap', array(&$this, 'map_meta_cap'),10,4);
}
// Remove 'Administrator' from the list of roles if the current user is not an admin
function editable_roles( $roles ){
if( isset( $roles['administrator'] ) && !current_user_can('administrator') ){
unset( $roles['administrator']);
}
return $roles;
}
// If someone is trying to edit or delete and admin and that user isn't an admin, don't allow it
function map_meta_cap( $caps, $cap, $user_id, $args ){
switch( $cap ){
case 'edit_user':
case 'remove_user':
case 'promote_user':
if( isset($args[0]) && $args[0] == $user_id )
break;
elseif( !isset($args[0]) )
$caps[] = 'do_not_allow';
$other = new WP_User( absint($args[0]) );
if( $other->has_cap( 'administrator' ) ){
if(!current_user_can('administrator')){
$caps[] = 'do_not_allow';
}
}
break;
case 'delete_user':
case 'delete_users':
if( !isset($args[0]) )
break;
$other = new WP_User( absint($args[0]) );
if( $other->has_cap( 'administrator' ) ){
if(!current_user_can('administrator')){
$caps[] = 'do_not_allow';
}
}
break;
default:
break;
}
return $caps;
}
}
$jpb_user_caps = new JPB_User_Caps();
/*
* user roles and capabilities
*/
remove_role( 'contributor' );
remove_role( 'author' );
add_action( 'admin_init', 'vs_add_capabilities');
function vs_add_capabilities() {
$editor = get_role( 'editor' );
$editor->add_cap( 'create_users' );
$editor->add_cap( 'delete_users' );
$editor->add_cap( 'edit_users' );
$editor->add_cap( 'list_users' );
$editor->add_cap( 'promote_users' );
$editor->add_cap( 'remove_users' );
// add $cap capability to this role object
$editor->add_cap( 'edit_theme_options' );
}
/**
* Remove capabilities from editors. https://codex.wordpress.org/Function_Reference/remove_cap
*/
//add_action( 'init', 'vs_remove_capabilities' );
function vs_remove_capabilities() {
$editor = get_role( 'editor' );
$caps = array(
'customize',
);
foreach ( $caps as $cap ) {
$editor->remove_cap( $cap );
}
}
// hide from admin menu http://www.wpmayor.com/how-to-remove-menu-items-in-admin-depending-on-user-role/
add_action( 'admin_head', 'vs_remove_menu_pages' );
function vs_remove_menu_pages() {
global $user_ID;
if ( current_user_can( 'editor' ) ) {
remove_submenu_page( 'themes.php', 'themes.php' ); // hide the theme selection submenu
remove_submenu_page( 'themes.php', 'widgets.php' ); // hide the widgets submenu
// remove Appearance -> Customize
remove_submenu_page( 'themes.php', 'customize.php?return=' . urlencode( $_SERVER['REQUEST_URI'] ) );
// Remove Appearance -> Editor
remove_submenu_page( 'themes.php', 'theme-editor.php' );
}
}
add_action( 'admin_bar_menu', 'remove_wp_nodes', 999 );
function remove_wp_nodes()
{
global $wp_admin_bar;
$wp_admin_bar->remove_node( 'customize' );
$wp_admin_bar->remove_node( 'new-media' );
}
?>
\ No newline at end of file
<?php
/**
* The template for displaying Archive pages.
*
* Learn more: http://codex.wordpress.org/Template_Hierarchy
*
* @package multipurpose blog
*/
get_header(); ?>
<div class="container">
<?php
$left_right = get_theme_mod( 'multipurpose_blog_theme_options','One Column');
if($left_right == 'Left Sidebar'){ ?>
<div class="row">
<div class="col-md-4 col-sm-4"><?php get_sidebar(); ?></div>
<div id="our-services" class="services col-md-8 col-sm-8">
<?php
the_archive_title( '<h1 class="page-title">', '</h1>' );
the_archive_description( '<div class="taxonomy-description">', '</div>' );
?>
<?php if ( have_posts() ) :
/* Start the Loop */
while ( have_posts() ) : the_post();
get_template_part( 'template-parts/content',get_post_format() );
endwhile;
else :
get_template_part( 'no-results' );
endif;
?>
<div class="navigation">
<?php
// Previous/next page navigation.
the_posts_pagination( array(
'prev_text' => __( 'Previous page', 'multipurpose-blog' ),
'next_text' => __( 'Next page', 'multipurpose-blog' ),
'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'multipurpose-blog' ) . ' </span>',
) );
?>
<div class="clearfix"></div>
</div>
</div>
</div>
<?php }else if($left_right == 'Right Sidebar'){ ?>
<div class="row">
<div id="our-services" class="services col-md-8 col-sm-8">
<?php
the_archive_title( '<h1 class="page-title">', '</h1>' );
the_archive_description( '<div class="taxonomy-description">', '</div>' );
?>
<?php if ( have_posts() ) :
/* Start the Loop */
while ( have_posts() ) : the_post();
get_template_part( 'template-parts/content',get_post_format() );
endwhile;
else :
get_template_part( 'no-results' );
endif;
?>
<div class="navigation">
<?php
// Previous/next page navigation.
the_posts_pagination( array(
'prev_text' => __( 'Previous page', 'multipurpose-blog' ),
'next_text' => __( 'Next page', 'multipurpose-blog' ),
'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'multipurpose-blog' ) . ' </span>',
) );
?>
<div class="clearfix"></div>
</div>
</div>
<div class="col-md-4 col-sm-4"><?php get_sidebar(); ?></div>
</div>
<?php }else if($left_right == 'One Column'){ ?>
<div id="our-services" class="services">
<?php
the_archive_title( '<h1 class="page-title">', '</h1>' );
the_archive_description( '<div class="taxonomy-description">', '</div>' );
?>
<?php if ( have_posts() ) :
/* Start the Loop */
while ( have_posts() ) : the_post();
get_template_part( 'template-parts/content',get_post_format(),get_post_format() );
endwhile;
else :
get_template_part( 'no-results' );
endif;
?>
<div class="navigation">
<?php
// Previous/next page navigation.
the_posts_pagination( array(
'prev_text' => __( 'Previous page', 'multipurpose-blog' ),
'next_text' => __( 'Next page', 'multipurpose-blog' ),
'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'multipurpose-blog' ) . ' </span>',
) );
?>
<div class="clearfix"></div>
</div>
</div>
<?php }else if($left_right == 'Three Columns'){ ?>
<div class="row">
<div id="sidebar" class="col-md-3 col-sm-3"><?php dynamic_sidebar('sidebar-1'); ?></div>
<div id="our-services" class="services col-md-6 col-sm-6">
<?php
the_archive_title( '<h1 class="page-title">', '</h1>' );
the_archive_description( '<div class="taxonomy-description">', '</div>' );
?>
<?php if ( have_posts() ) :
/* Start the Loop */
while ( have_posts() ) : the_post();
get_template_part( 'template-parts/content',get_post_format() );
endwhile;
else :
get_template_part( 'no-results' );
endif;
?>
<div class="navigation">
<?php
// Previous/next page navigation.
the_posts_pagination( array(
'prev_text' => __( 'Previous page', 'multipurpose-blog' ),
'next_text' => __( 'Next page', 'multipurpose-blog' ),
'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'multipurpose-blog' ) . ' </span>',
) );
?>
<div class="clearfix"></div>
</div>
</div>
<div id="sidebar" class="col-md-3 col-sm-3"><?php dynamic_sidebar('sidebar-2'); ?></div>
</div>
<?php }else if($left_right == 'Four Columns'){ ?>
<div class="row">
<div id="sidebar" class="col-md-3 col-sm-3"><?php dynamic_sidebar('sidebar-1'); ?></div>
<div id="our-services" class="services col-md-3 col-sm-3">
<?php
the_archive_title( '<h1 class="page-title">', '</h1>' );
the_archive_description( '<div class="taxonomy-description">', '</div>' );
?>
<?php if ( have_posts() ) :
/* Start the Loop */
while ( have_posts() ) : the_post();
get_template_part( 'template-parts/content',get_post_format() );
endwhile;
else :
get_template_part( 'no-results' );
endif;
?>
<div class="navigation">
<?php
// Previous/next page navigation.
the_posts_pagination( array(
'prev_text' => __( 'Previous page', 'multipurpose-blog' ),
'next_text' => __( 'Next page', 'multipurpose-blog' ),
'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'multipurpose-blog' ) . ' </span>',
) );
?>
<div class="clearfix"></div>
</div>
</div>
<div id="sidebar" class="col-md-3 col-sm-3"><?php dynamic_sidebar('sidebar-2'); ?></div>
<div id="sidebar" class="col-md-3 col-sm-3"><?php dynamic_sidebar('sidebar-3'); ?></div>
</div>
<?php }else if($left_right == 'Grid Layout'){ ?>
<div class="row">
<div id="our-services" class="row services col-md-8 col-sm-8">
<?php
the_archive_title( '<h1 class="page-title">', '</h1>' );
the_archive_description( '<div class="taxonomy-description">', '</div>' );
?>
<?php if ( have_posts() ) :
/* Start the Loop */
while ( have_posts() ) : the_post();
get_template_part( 'template-parts/grid-layout' );
endwhile;
else :
get_template_part( 'no-results' );
endif;
?>
<div class="navigation">
<?php
// Previous/next page navigation.
the_posts_pagination( array(
'prev_text' => __( 'Previous page', 'multipurpose-blog' ),
'next_text' => __( 'Next page', 'multipurpose-blog' ),
'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'multipurpose-blog' ) . ' </span>',
) );
?>
<div class="clearfix"></div>
</div>
</div>
<div class="col-md-4 col-sm-4"><?php get_sidebar(); ?></div>
</div>
<?php }?>
</div>
<div class="clearfix"></div>
<?php get_footer(); ?>
\ No newline at end of file
/*!
Theme Name: CDE - ULB
Theme URI: http://example.com/radix-child/
Description: Education Hub Pro Child
Author: Lore Mipsum
Template: education-hub-pro
Version: 1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: light, white, one-column, two-columns, left-sidebar, right-sidebar, fixed-layout, custom-background, custom-colors, custom-menu, featured-images, full-width-template, post-formats, sticky-post, translation-ready, responsive-layout, theme-options, threaded-comments
Text Domain: eduhubchild
*/#slider .slide-cap a.read-more{border-color:gold;display:inline-block}
/*# sourceMappingURL=style.css.map */
{
"version": 3,
"mappings": "AAAA;;;;;;;;;;;EAWE,AAEF,8BAA+B,CAC3B,YAAY,CAAC,IAAI,CACjB,OAAO,CAAE,YAAY",
"sources": ["../../multipurpose-blog-child_dev/sass/style.scss"],
"names": [],
"file": "style.css"
}
\ No newline at end of file
<?php
/**
* The template for displaying the footer.
*
* Contains the closing of the #content div and all content after
*
* @package multipurpose blog
*/
?>
<div class="footer-wp">
<div class="container">
<div class="row">
<div class="col-md-3 col-sm-3">
<?php dynamic_sidebar('footer-1');?>
</div>
<div class="col-md-3 col-sm-3">
<?php dynamic_sidebar('footer-2');?>
</div>
<div class="col-md-3 col-sm-3">
<?php dynamic_sidebar('footer-3');?>
</div>
<div class="col-md-3 col-sm-3">
<?php dynamic_sidebar('footer-4');?>
</div>
</div>
</div>
</div>
<div class="inner">
<div class="copyright-wrapper">
<?php dynamic_sidebar('footer-b');?>
</div>
<div class="clear"></div>
</div>
<?php wp_footer(); ?>
</body>
</html>
\ No newline at end of file
<?php
/**
* Voisins solidaires - Multipurpose blog child functions and definitions.
*
* @link https://codex.wordpress.org/Functions_File_Explained
*
* @package voisinssolidaires-child
*/
function voisinssolidaires_setup() {
load_child_theme_textdomain( 'voisinssolidaires', get_stylesheet_directory() . '/languages' );//Loads the child theme textdomain.
}
add_action( 'after_setup_theme', 'voisinssolidaires_setup' );
?>
<?php
/*enqueue_scripts*/
add_action( 'wp_enqueue_scripts', 'my_parent_theme_css' );
function my_parent_theme_css() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'bootstrap', get_template_directory_uri() . '/css/bootstrap.css');
wp_enqueue_style( 'child-style', get_stylesheet_uri(), array( 'parent-style,bootstrap' ) );
}
/*enqueue_styles*/
// hook in late to make sure the parent theme's registration has fired so you can undo it. Otherwise the parent will simply enqueue its script anyway.
add_action('wp_enqueue_scripts', 'my_parent_theme_js', 100);
function my_parent_theme_js()
{
wp_dequeue_script('parent_theme_script_handle');
wp_enqueue_script('child_theme_script_handle', get_stylesheet_directory_uri().'/js/jquery.nivo.slider.js', array('jquery'));
}
?>
<?php
add_action( 'after_setup_theme', 'vs_thumbs' );
function vs_thumbs() {
add_theme_support( 'post-thumbnails' );
//set_post_thumbnail_size( 300, 150, true ); // default Post Thumbnail dimensions (cropped)
// additional image sizes
add_image_size( 'imagebox', 600, 400, true );
add_image_size( 'pagethumb', 760, 200 ); //soft proportional crop mode
}
?>
<?php
/* Theme Widgets Setup */
function vs_widgets_init() {
register_sidebar( array(
'name' => __( 'Tob bandeau left', 'voisinssolidaires' ),
'description' => __( 'On the very top - left', 'voisinssolidaires' ),
'id' => 'top_border_left',
'before_widget' => '<span id="%1$s" class="widget %2$s">',
'after_widget' => '</span>',
'before_title' => '<b class="widget-title">',
'after_title' => '</b>',
) );
register_sidebar( array(
'name' => __( 'Tob bandeau left 2', 'voisinssolidaires' ),
'description' => __( 'On the very top - left 2', 'voisinssolidaires' ),
'id' => 'top_border_left2',
'before_widget' => '<span id="%1$s" class="widget %2$s">',
'after_widget' => '</span>',
'before_title' => '<b class="widget-title">',
'after_title' => '</b>',
) );
register_sidebar( array(
'name' => __( 'Tob bandeau right', 'voisinssolidaires' ),
'description' => __( 'On the very top - right', 'voisinssolidaires' ),
'id' => 'top_border_right',
'before_widget' => '<span id="%1$s" class="widget %2$s">',
'after_widget' => '</span>',
'before_title' => '<b class="widget-title">',
'after_title' => '</b>',
) );
register_sidebar( array(
'name' => __( 'Bottom footer', 'voisinssolidaires' ),
'description' => __( 'On the very bottom', 'voisinssolidaires' ),
'id' => 'footer-b',
'before_widget' => '<div>',
'after_widget' => '</div>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
) );
}
add_action( 'widgets_init', 'vs_widgets_init' );
?>
<?php
// taxonomies
function vs_page_taxonomie() {
$labels = array(
'name' => _x( 'Special functions', 'taxonomy general name', 'voisinssolidaires' ),
'singular_name' => _x( 'Special function', 'taxonomy singular name', 'voisinssolidaires' ),
'all_items' => __( 'All Special functions', 'voisinssolidaires' ),
'parent_item' => null,
'parent_item_colon' => null,
'search_items' => __( 'Search Special functions', 'voisinssolidaires' ),
'edit_item' => __( 'Edit Special function', 'voisinssolidaires' ),
'update_item' => __( 'Update Special function', 'voisinssolidaires' ),
'add_new_item' => __( 'Add New Special function', 'voisinssolidaires' ),
'new_item_name' => __( 'New special function Name', 'voisinssolidaires' ),
'menu_name' => __( 'Special functions' )
);
$capabilities = array (
'manage_terms' => 'manage_options', //by default only admin
'edit_terms' => 'manage_options',
'delete_terms' => 'manage_options',
'assign_terms' => 'edit_posts'
);
$args = array(
'hierarchical' => false,
'labels' => $labels,
'show_ui' => true,
'show_admin_column' => true,
'query_var' => true,
'public' => true, //needs to be public for the radio-button plugin to work
'rewrite' => false,
'capabilities' => $capabilities
);
register_taxonomy( 'pagetaxo', array( 'page' ), $args );
}
add_action( 'init', 'vs_page_taxonomie',0 );
function vs_metaboxes() {
// Add category metabox to page
register_taxonomy_for_object_type('pagetaxo', 'page');
}
add_action( 'init', 'vs_metaboxes' );
?>
<?php
function redirect_non_logged_users_to_specific_page() {
if ( !is_user_logged_in() && $_SERVER['PHP_SELF'] != '/wp-admin/admin-ajax.php' ) {
wp_redirect( 'http://voisinssolidaires.be/index_dev.html', 301 );
exit;
}
}
//add_action( 'template_redirect', 'redirect_non_logged_users_to_specific_page' );
?>
<?php
// https://seventhqueen.com/blog/code-snippets/restrict-guest-users-from-accessing-buddypress-or-bbpress-pages.html
/**
* Redirect buddypress and bbpress pages to registration page
*/
function vs_page_template_redirect()
{
//if not logged in and on a bp page except registration or activation
if( ! is_user_logged_in() &&
( ( ! bp_is_blog_page() && ! bp_is_activation_page() && ! bp_is_register_page() ) || is_bbpress() )
)
{
wp_redirect( home_url( '/register/' ) );
exit();
}
}
add_action( 'template_redirect', 'vs_page_template_redirect' );
?>
<?php
// supprimer intitulé "catégorie" "tag" "autheur" https://wordpress.stackexchange.com/questions/179585/remove-category-tag-author-from-the-archive-title#answer-179590
add_filter( 'get_the_archive_title', function ($title) {
if ( is_category() ) {
$title = single_cat_title( '', false );
} elseif ( is_tag() ) {
$title = single_tag_title( '', false );
} elseif ( is_author() ) {
$title = '<span class="vcard">' . get_the_author() . '</span>' ;
}
return $title;
});
// disable access to wp-admin for non-administrators
function block_wp_admin_access() {
if ( is_admin() && ! current_user_can( 'administrator' ) && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
wp_redirect( home_url() );
exit;
}
}
//add_action( 'init', 'block_wp_admin_access' );
<?php
/**
* The Header for our theme.
*
* Displays all of the <head> section and everything up till <div id="content">
*
* @package multipurpose blog
*/
?><!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width">
<link rel="profile" href="http://gmpg.org/xfn/11">
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<div id="header">
<div class="top_headbar row">
<div class="top-contact col-md-3 col-xs-12 col-sm-4">
<?php if ( is_active_sidebar( 'top_border_left' ) ) : ?>
<span id="primary-sidebar" class="primary-sidebar widget-area" role="complementary">
<?php dynamic_sidebar( 'top_border_left' ); ?>
</span><!-- #primary-sidebar -->
<?php endif; ?>
</div>
<div class="top-contact col-md-3 col-xs-12 col-sm-4">
<?php if ( is_active_sidebar( 'top_border_left2' ) ) : ?>
<span id="primary-sidebar" class="primary-sidebar widget-area" role="complementary">
<?php dynamic_sidebar( 'top_border_left2' ); ?>
</span><!-- #primary-sidebar -->
<?php endif; ?>
</div>
<div class="col-md-6 socialbox">
<?php if ( is_active_sidebar( 'top_border_right' ) ) : ?>
<span id="primary-sidebar" class="primary-sidebar widget-area" role="complementary">
<?php dynamic_sidebar( 'top_border_right' ); ?>
</span><!-- #primary-sidebar -->
<?php endif; ?>
</div>
<div class="clearfix"></div>
</div>
<div class="logo_bar">
<div class="logo">
<?php if( has_custom_logo() ){ multipurpose_blog_the_custom_logo();
}else{ ?>
<h1><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php esc_attr(bloginfo( 'name' )); ?></a></h1>
<?php $description = get_bloginfo( 'description', 'display' );
if ( $description || is_customize_preview() ) : ?>
<p class="site-description"><?php echo esc_html($description); ?></p>
<?php endif; }?>
</div>
</div>
<div class="container">
<div class="menus">
<div class="toggle"><a class="toggleMenu" href="#"><?php esc_html_e('Menu','multipurpose-blog'); ?></a></div>
<div class="menubox header">
<div class="nav">
<?php wp_nav_menu( array('theme_location' => 'primary') ); ?>
</div>
<div class="clearfix"></div>
</div>
</div>
</div>
<div class="clearfix"></div>
</div>
\ No newline at end of file
/*
* jQuery Nivo Slider v3.2
* http://nivo.dev7studios.com
*
* Copyright 2012, Dev7studios
* Free to use and abuse under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
*/
(function($) {
var NivoSlider = function(element, options){
// Defaults are below