define( 'WP_POST_REVISIONS', 5 );
-define( 'AUTOMATIC_UPDATER_DISABLED', true );
-
/* C'est tout, ne touchez pas à ce qui suit ! Bon blogging ! */
/** Chemin absolu vers le dossier de WordPress. */
define('ABSPATH', dirname(__FILE__) . '/');
/** Réglage des variables de WordPress et de ses fichiers inclus. */
-require_once(ABSPATH . 'wp-settings.php');
\ No newline at end of file
+require_once(ABSPATH . 'wp-settings.php');
--- /dev/null
+<?php
+/**
+ * Plugin Name: Custom site features
+ * Description: Loads all custom functionality such as new post types and taxonomies.
+ * Version: 1.0
+ * Author: Cubedesigners
+ * Author URI: https://www.cubedesigners.com
+ */
+
+namespace Cube;
+
+defined('ABSPATH') or die('Direct access blocked');
+
+// Folder name for all plugin files (needed because MU-plugins can't be in folders so we need to put the loader outside)
+$plugin_dir = 'cube';
+$autoloader = __DIR__ . "/$plugin_dir/vendor/autoload.php";
+
+// Namespaced constants for easier path and URL references
+define(__NAMESPACE__ . '\NS', __NAMESPACE__ . '\\'); // Namespace shortcut: NS
+define(NS . 'PLUGIN_PATH', trailingslashit(plugin_dir_path(__FILE__) . $plugin_dir));
+define(NS . 'PLUGIN_URL', trailingslashit(plugin_dir_url(__FILE__) . $plugin_dir));
+
+// Load Composer libraries
+if (file_exists($autoloader)) {
+ require_once $autoloader;
+}
+
+if (class_exists(NS . 'Init')) {
+ Init::register_classes();
+}
--- /dev/null
+{
+ "require": {
+ "htmlburger/carbon-fields": "^3.3",
+ "jjgrainger/posttypes": "^2.1"
+ },
+ "autoload": {
+ "psr-4": {
+ "Cube\\": "./src"
+ }
+ },
+ "scripts": {
+ "post-autoload-dump": [
+ ]
+ }
+}
--- /dev/null
+{
+ "_readme": [
+ "This file locks the dependencies of your project to a known state",
+ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
+ "This file is @generated automatically"
+ ],
+ "content-hash": "14acd0b499ebd7148225938e04026c43",
+ "packages": [
+ {
+ "name": "htmlburger/carbon-fields",
+ "version": "v3.3.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/htmlburger/carbon-fields.git",
+ "reference": "dd5663e14c6db365323b688dbae1cfbeaf14bee7"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/htmlburger/carbon-fields/zipball/dd5663e14c6db365323b688dbae1cfbeaf14bee7",
+ "reference": "dd5663e14c6db365323b688dbae1cfbeaf14bee7",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3"
+ },
+ "require-dev": {
+ "mockery/mockery": "^0.9.7",
+ "phpunit/phpunit": "~4.8"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Carbon_Fields\\": "core/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "GPL-2.0-only"
+ ],
+ "authors": [
+ {
+ "name": "htmlBurger",
+ "email": "wordpress@htmlburger.com",
+ "homepage": "https://htmlburger.com/",
+ "role": "Developer"
+ },
+ {
+ "name": "Miroslav Mitev",
+ "email": "mmitev.2create@gmail.com",
+ "role": "Developer"
+ },
+ {
+ "name": "Atanas Angelov",
+ "email": "atanas.angelov.dev@gmail.com",
+ "role": "Developer"
+ },
+ {
+ "name": "Georgi Stoyanov",
+ "email": "stoyanov.gs@gmail.com",
+ "role": "Developer"
+ },
+ {
+ "name": "Plamen Kostadinov",
+ "email": "pkostadinov.2create@gmail.com",
+ "homepage": "http://plasmen.info/",
+ "role": "Developer"
+ },
+ {
+ "name": "Stanimir Panchev",
+ "email": "Stan4omir@gmail.com",
+ "role": "Developer"
+ },
+ {
+ "name": "Marin Atanasov",
+ "email": "contact@marinatanasov.com",
+ "homepage": "http://marinatanasov.com/",
+ "role": "Developer"
+ },
+ {
+ "name": "Siyan Panayotov",
+ "homepage": "http://siyanpanayotov.com/",
+ "role": "Developer"
+ },
+ {
+ "name": "Peter Petrov",
+ "email": "peter.petrov89@gmail.com",
+ "role": "Developer"
+ },
+ {
+ "name": "Stanimir Stoyanov",
+ "email": "stanimir.k.stoyanov@gmail.com",
+ "role": "Developer"
+ },
+ {
+ "name": "Kaloyan Ivanov",
+ "email": "kaloyanxivanov@gmail.com",
+ "homepage": "http://vilepixels.com/",
+ "role": "Developer"
+ },
+ {
+ "name": "Georgi Popov",
+ "homepage": "http://magadanski.com/",
+ "role": "Developer"
+ },
+ {
+ "name": "German Velchev",
+ "email": "germozy@gmail.com",
+ "role": "Developer"
+ },
+ {
+ "name": "Rashko Petrov",
+ "email": "brutalenemy666@gmail.com",
+ "homepage": "http://errorfactory.com/",
+ "role": "Developer"
+ },
+ {
+ "name": "Alexander Panayotov",
+ "email": "alexander.panayotov@gmail.com",
+ "homepage": "http://alexanderpanayotov.com/",
+ "role": "Developer"
+ },
+ {
+ "name": "Viktor Vasilev",
+ "email": "liberalcho@gmail.com",
+ "role": "Developer"
+ },
+ {
+ "name": "Georgi Georgiev",
+ "email": "george.georgiev96@gmail.com",
+ "role": "Developer"
+ },
+ {
+ "name": "Atanas Vasilev",
+ "email": "atanasvasilev91@gmail.com",
+ "role": "Developer"
+ }
+ ],
+ "description": "WordPress developer-friendly custom fields for post types, taxonomy terms, users, comments, widgets, options and more.",
+ "homepage": "http://carbonfields.net/",
+ "support": {
+ "docs": "http://carbonfields.net/docs/",
+ "email": "wordpress@htmlburger.com",
+ "issues": "https://github.com/htmlburger/carbon-fields/issues",
+ "source": "https://github.com/htmlburger/carbon-fields"
+ },
+ "time": "2021-04-22T13:24:34+00:00"
+ },
+ {
+ "name": "jjgrainger/posttypes",
+ "version": "2.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/jjgrainger/PostTypes.git",
+ "reference": "a87584606e9ef726f7621c1d71a184fdf7282172"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/jjgrainger/PostTypes/zipball/a87584606e9ef726f7621c1d71a184fdf7282172",
+ "reference": "a87584606e9ef726f7621c1d71a184fdf7282172",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=7.2"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "8.*",
+ "squizlabs/php_codesniffer": "3.*"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "PostTypes\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Joe Grainger",
+ "email": "hello@jjgrainger.co.uk",
+ "homepage": "https://jjgrainger.co.uk"
+ }
+ ],
+ "description": "Simple WordPress custom post types.",
+ "homepage": "https://github.com/jjgrainger/posttype",
+ "support": {
+ "issues": "https://github.com/jjgrainger/PostTypes/issues",
+ "source": "https://github.com/jjgrainger/PostTypes/tree/v2.1"
+ },
+ "time": "2020-04-12T13:01:12+00:00"
+ }
+ ],
+ "packages-dev": [],
+ "aliases": [],
+ "minimum-stability": "stable",
+ "stability-flags": [],
+ "prefer-stable": false,
+ "prefer-lowest": false,
+ "platform": [],
+ "platform-dev": [],
+ "plugin-api-version": "2.1.0"
+}
--- /dev/null
+
+<?php if(empty($jobs)): ?>
+ <p>Il n'y a pas d'offres d'emploi actuellement.</p>
+<?php else: ?>
+ <hr class="force-full-width" style="margin-top: 0;">
+ <?php foreach($jobs as $job): ?>
+ <div class="job-offer">
+ <div class="job-offer-header">
+ <div class="job-offer-title">
+ <?= $job->post_title ?>
+ </div>
+ <div class="job-offer-contract">
+ <?= $job->contract_type ?>
+ </div>
+ <div class="job-offer-date">
+ <?= date('d-m-Y', strtotime($job->post_date)) ?>
+ </div>
+ <div class="job-offer-cta">
+ <button class="job-offer-button">Voir l'offre</button>
+ </div>
+ </div>
+ <div class="job-offer-content" style="display: none;">
+ <div class="row-fluid">
+ <div class="span8 span8-couzy">
+ <?= wpautop($job->post_content) ?>
+
+ <h2>Postuler à cette offre</h2>
+ <div class="job-offer-apply">
+ <div>
+ <a href="mailto:contact@mdryvescouzy.com?subject=Candidature <?= $job->post_title ?>">
+ <i class="fa fa-envelope"></i>
+ contact@mdryvescouzy.com
+ </a>
+ </div>
+ <div>
+ <a href="tel:+33467555520">
+ <i class="fa fa-phone"></i>
+ 04.67.55.55.20
+ </a>
+ </div>
+ </div>
+
+ </div>
+ <div class="span4 job-offer-content-sidebar">
+ <?php foreach($job->job_details as $detail): ?>
+ <div class="job-offer-content-sidebar-detail">
+ <h4><?= $detail['title'] ?></h4>
+ <p><?= $detail['details'] ?></p>
+ </div>
+ <?php endforeach; ?>
+ </div>
+ </div>
+
+
+ <button class="job-offer-button job-offer-button-collapse">
+ <img src="<?= get_theme_file_uri('images/up-arrows-white.png') ?>">
+ Retour
+ </button>
+
+
+ </div>
+ </div>
+ <hr class="force-full-width">
+ <?php endforeach; ?>
+
+<?php endif; ?>
--- /dev/null
+<?php
+
+namespace Cube\CPT;
+
+use PostTypes\PostType;
+use PostTypes\Taxonomy;
+use Carbon_Fields\Container;
+use Carbon_Fields\Field;
+
+
+class Jobs {
+
+ protected $post_type = [
+ 'name' => 'job-offer',
+ 'singular' => "Offre d'emploi",
+ 'plural' => "Offres d'emploi",
+ 'slug' => 'emplois'
+ ];
+
+ // Jobs are not like normal posts since we only want to use them to build the job listing widget
+ // Ref: https://wordpress.stackexchange.com/a/108658
+ protected $post_type_options = [
+ 'public' => false, // it's not public, so it shouldn't have its own permalink (used only to build jobs list)
+ 'publicly_queryable' => true, // still needs to be queryable
+ 'show_ui' => true, // editable in wp-admin
+ 'exclude_from_search' => true,
+ 'show_in_nav_menus' => false, // don't allow jobs to be added to menus
+ 'has_archive' => false, // it shouldn't have archive page
+ 'rewrite' => false, // it shouldn't have rewrite rules
+ ];
+
+
+ public function register() {
+
+ // Initialise custom post type
+ $jobs = new PostType($this->post_type, $this->post_type_options);
+ $jobs->icon('dashicons-groups');
+ $jobs->register();
+
+ // Register custom fields
+ add_action('carbon_fields_register_fields', [$this, 'fields']);
+
+ // Register [jobs-listing] shortcode
+ add_shortcode('jobs-listing', [$this, 'shortcode']);
+
+ // Set default content for editor to provide a flexible template
+ add_filter('default_content', function($content, $post) {
+ if ($post->post_type == $this->post_type['name']) {
+ $content = '<h2>Description du poste</h2>
+ ...
+ <h2>Notre établissement</h2>
+ ...
+ <h2>Missions</h2>
+ <ul>
+ <li>...</li>
+ </ul>';
+ }
+
+ return $content;
+ }, 10, 2);
+
+
+ }
+
+ public function fields() {
+
+ Container::make('post_meta', "Détails de l'offre d'emploi")
+ ->where('post_type', '=', $this->post_type['name'])
+ ->add_fields(
+ [
+ Field::make('text', 'contract_type', __('Type de contrat'))
+ ->set_attribute('placeholder', 'ex. CDI, CDD, Temps partiel...'),
+
+ Field::make('complex', 'job_details', __('Informations'))
+ ->add_fields([
+ Field::make('text', 'title', __('Intitulé')),
+ Field::make('textarea', 'details', __('Précisions'))->set_rows(3),
+ ])->set_header_template('<%- title %>')
+ ->set_default_value([ // Pre-populate repeater
+ [
+ 'title' => 'Votre profile',
+ 'details' => '',
+ ],
+ [
+ 'title' => 'Votre formation',
+ 'details' => '',
+ ],
+ [
+ 'title' => 'Expérience',
+ 'details' => '',
+ ],
+ [
+ 'title' => 'Remunération',
+ 'details' => '',
+ ],
+ ]),
+ ]
+ );
+ }
+
+
+ /**
+ * Shortcode handler for [jobs-listing]
+ * @param array $attributes
+ * @return string
+ */
+ function shortcode($attributes) {
+
+ wp_enqueue_script('job-offers', get_theme_file_uri('js/job-offers.js'), ['jquery'], null, true);
+
+ extract(shortcode_atts([
+ 'limit' => '', // Max items to return
+ ], $attributes));
+
+ // Prepare WordPress post query arguments
+ $args = [
+ //'post__not_in' => [get_the_ID()]
+ ];
+
+ // Allow limiting of posts
+ if (!empty($limit)) {
+ $args['posts_per_page'] = (int) $limit;
+ }
+
+ $jobs = $this->fetch($args);
+
+ // TODO: find a cleaner way of doing this. Ideally with Acorn + proper blade templates
+ include(dirname(__FILE__) . '/../../resources/jobs.php');
+ }
+
+ /**
+ * Fetch all job-offer posts
+ * @return array
+ */
+ public function fetch($overrides = array(), $get_meta = true, $get_terms = false) {
+
+ $defaults = [
+ 'post_type' => $this->post_type['name'],
+ 'post_status' => 'publish',
+ 'posts_per_page' => -1,
+ 'suppress_filters' => false, // Ensure WPML filters work (see: https://codex.wordpress.org/Template_Tags/get_posts#Parameters)
+ ];
+
+ $args = array_merge($defaults, $overrides);
+
+ $posts = get_posts($args);
+
+ // Is this just a simple fetch or do we need to get all the metadata?
+ if (!$get_meta) {
+ return $posts;
+ }
+
+ // Fetch meta and terms
+ $jobs = [];
+
+ foreach ($posts as $post) {
+
+ $post->contract_type = carbon_get_post_meta($post->ID, 'contract_type');
+ $post->job_details = carbon_get_post_meta($post->ID, 'job_details');
+
+ $jobs[$post->ID] = $post;
+ }
+
+ return $jobs;
+ }
+
+}
--- /dev/null
+<?php
+
+namespace Cube\Common;
+
+use Carbon_Fields\Carbon_Fields;
+
+class Setup {
+
+ /**
+ * Common setup, will be automatically triggered by Init class if included
+ */
+ public function register() {
+
+ // Initialise Carbon Fields library (used for custom fields in CPTs)
+ add_action('after_setup_theme', function() {
+ Carbon_Fields::boot();
+ });
+
+ }
+
+}
--- /dev/null
+<?php
+
+// Setup reference: https://www.youtube.com/watch?v=NdDRNiIfYDw
+
+namespace Cube;
+
+
+final class Init { // Marked as final because this class should never be extended (single init only!)
+
+ /**
+ * List of service classes to be used
+ * @return array Array of classes to be instantiated
+ */
+ public static function classes() {
+ return [
+ Common\Setup::class,
+ CPT\Jobs::class,
+ ];
+ }
+
+ /**
+ * Register all services (custom post types, custom fields, shortcodes etc)
+ */
+ public static function register_classes() {
+ foreach (self::classes() as $class) {
+ $service = self::instantiate($class);
+
+ // If the class has a register method, call it.
+ if (method_exists($service, 'register')) {
+ $service->register();
+ }
+ }
+ }
+
+ /**
+ * @param class $class Class from the services array
+ * @return class instance New instance of the class
+ */
+ private static function instantiate($class) {
+ return new $class();
+ }
+}
function cherry_stylesheets() {
if ( CURRENT_THEME != 'cherry' ) {
if ( file_exists( CHILD_DIR . '/main-style.css' ) ) {
- wp_enqueue_style( CURRENT_THEME, CHILD_URL . '/main-style.css', false, null, 'all' );
+ $cache_buster = filemtime(CHILD_DIR . '/main-style.css');
+ wp_enqueue_style( CURRENT_THEME, CHILD_URL . '/main-style.css', false, $cache_buster, 'all' );
}
if ( file_exists( CHILD_DIR . '/includes/widgets/my-flickr-widget.php' ) ) {
}
}
add_action('admin_enqueue_scripts', 'tz_admin_js', 10, 1);
-?>
\ No newline at end of file
+?>
--- /dev/null
+// Slide open job details
+jQuery(document).on('click', '.job-offer-header', function() {
+ jQuery(this).parents('.job-offer').find('.job-offer-content').slideToggle();
+});
+
+// Retour / close panel
+jQuery(document).on('click', '.job-offer-button-collapse', function() {
+ jQuery(this).parents('.job-offer-content').slideToggle();
+});
body {
color:#787878;
min-width:1000px;
+ overflow-x:hidden;
}
a, a:hover, a:focus { color:#787878; }
+hr {
+ height:1px;
+ background:#d8d8d8;
+ border:0;
+}
+.force-full-width {
+ width:100vw;
+ position:relative;
+ left:50%;
+ right:50%;
+ margin-left:-50vw;
+ margin-right:-50vw;
+}
.hr {
border-bottom:1px solid #d8d8d8;
width:100%;
}
.html5gallery-elem-img-0 a > div { display:none !important; }
.page-id-26 #custom_page_sidebar_3 { margin-top:1278px; }
+.job-offer-header {
+ display:flex;
+ align-items:center;
+ color:#6e6e6e;
+ font-family:'Open Sans', sans-serif;
+ cursor:pointer;
+}
+.job-offer-title {
+ font-size:20px;
+ font-weight:600;
+ flex-basis:46%;
+}
+.job-offer-contract, .job-offer-date, .job-offer-cta { flex-basis:18%; }
+.job-offer-date { text-align:center; }
+.job-offer-cta {
+ display:flex;
+ justify-content:flex-end;
+}
+.job-offer-button {
+ appearance:none;
+ border:0;
+ color:#fff;
+ font-weight:600;
+ text-transform:uppercase;
+ background-color:#9cc12a;
+ padding:0.75em;
+ font-size:1em;
+ text-align:center;
+ display:inline-flex;
+ align-items:center;
+ justify-content:center;
+ min-width:136px;
+}
+.job-offer-button img { margin-right:0.75em; }
+.job-offer-content {
+ position:relative;
+ padding-top:3em;
+ margin-bottom:3em;
+}
+.job-offer-content h2 {
+ color:#8daa34;
+ font-family:'Roboto Slab', serif;
+ font-size:24px;
+ font-weight:400;
+ line-height:1;
+ margin-bottom:0.75em;
+}
+.job-offer-content h2:not(:first-child) { margin-top:2em; }
+.job-offer-content p { margin-bottom:0; }
+.job-offer-content p:not(:last-child) { margin-bottom:1.5em; }
+.job-offer-content-sidebar { padding-bottom:4em; }
+.job-offer-content-sidebar > * + * { margin-top:1px; }
+.job-offer-content-sidebar-detail {
+ background-color:#9cc12a;
+ color:#fff;
+ padding:30px 35px;
+ font-weight:300;
+}
+.job-offer-content-sidebar-detail h4 {
+ color:#fff;
+ font-family:'Roboto Slab', serif;
+ font-size:24px;
+ font-weight:400;
+ margin-top:0;
+ margin-bottom:0.75em;
+}
+.job-offer-apply > * + * { margin-top:0.75em; }
+.job-offer-apply a, .job-offer-apply a:hover, .job-offer-apply a:focus {
+ font-weight:600;
+ text-decoration:none;
+}
+.job-offer-apply i.fa {
+ font-size:25px;
+ width:1em;
+ text-align:center;
+ margin-right:0.4em;
+ vertical-align:middle;
+}
+.job-offer-button-collapse {
+ position:absolute;
+ right:0;
+ bottom:0;
+}
.page-id-36 .content-holder { padding-bottom:0; }
input[type="text"], input[type="email"], textarea, .btn {
border-radius:0;
body {
color: #787878;
min-width: 1000px;
+ overflow-x: hidden;
}
a,
color: #787878;
}
+hr {
+ height: 1px;
+ background: #d8d8d8;
+ border: 0;
+}
+
+// Extend an element to full screen width outside its container
+.force-full-width {
+ width: 100vw;
+ position: relative;
+ left: 50%;
+ right: 50%;
+ margin-left: -50vw;
+ margin-right: -50vw;
+}
+
.hr {
border-bottom: 1px solid #d8d8d8;
width: 100%;
margin-top: 1278px;
}
+/* OFFRES D'EMPLOI PAGE */
+.job-offer {
+
+ &-header {
+ display: flex;
+ align-items: center;
+ color: #6e6e6e;
+ font-family: 'Open Sans', sans-serif;
+ cursor: pointer;
+ }
+
+ &-title {
+ font-size: 20px;
+ font-weight: 600;
+ flex-basis: 46%;
+ }
+
+ &-contract, &-date, &-cta {
+ flex-basis: 18%;
+ }
+
+ &-date {
+ text-align: center;
+ }
+
+ &-cta {
+ display: flex;
+ justify-content: flex-end;
+ }
+
+ &-button {
+ appearance: none;
+ border: 0;
+ color: #fff;
+ font-weight: 600;
+ text-transform: uppercase;
+ background-color: #9cc12a;
+ padding: 0.75em;
+ font-size: 1em;
+ text-align: center;
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ min-width: 136px;
+
+ img {
+ margin-right: 0.75em;
+ }
+ }
+
+ &-content {
+ position: relative;
+ padding-top: 3em;
+ margin-bottom: 3em;
+
+ h2 {
+ color: #8daa34;
+ font-family: 'Roboto Slab', serif;
+ font-size: 24px;
+ font-weight: 400;
+ line-height: 1;
+ margin-bottom: 0.75em;
+
+ &:not(:first-child) {
+ margin-top: 2em;
+ }
+ }
+
+ p {
+ margin-bottom: 0;
+
+ &:not(:last-child) {
+ margin-bottom: 1.5em;
+ }
+ }
+
+ &-sidebar {
+ padding-bottom: 4em; // Space for ^ Retour button
+
+ > * + * { // Spacing between child elements
+ margin-top: 1px;
+ }
+
+ &-detail {
+ background-color: #9cc12a;
+ color: #fff;
+ padding: 30px 35px;
+ font-weight: 300;
+
+ h4 {
+ color: #fff;
+ font-family: 'Roboto Slab', serif;
+ font-size: 24px;
+ font-weight: 400;
+ margin-top: 0;
+ margin-bottom: 0.75em;
+ }
+ }
+ }
+
+ }
+
+ &-apply {
+
+ > * + * {
+ margin-top: 0.75em;
+ }
+
+ a, a:hover, a:focus {
+ font-weight: 600;
+ text-decoration: none;
+ }
+
+ i.fa {
+ font-size: 25px;
+ width: 1em;
+ text-align: center;
+ margin-right: 0.4em;
+ vertical-align: middle;
+ }
+ }
+
+ &-button-collapse {
+ position: absolute;
+ right: 0;
+ bottom: 0;
+ }
+}
+
/* CONTACT PAGE */
.page-id-36 .content-holder {
padding-bottom: 0;