Initial commit

This commit is contained in:
Antoine M 2023-05-10 11:42:44 +02:00
commit d4691a12f4
68 changed files with 9863 additions and 0 deletions

2
.gitattributes vendored Normal file
View File

@ -0,0 +1,2 @@
.gitattributes export-ignore
/.github/ export-ignore

7
.gitignore vendored Normal file
View File

@ -0,0 +1,7 @@
/node_modules
/.idea
/.vscode
.DS_Store
*/.DS_Store
Makefile
init_script.sh

6
.prettierrc Normal file
View File

@ -0,0 +1,6 @@
{
"tabWidth": 2,
"semi": true,
"singleQuote": true,
"printWidth": 60
}

24
404.php Normal file
View File

@ -0,0 +1,24 @@
<!DOCTYPE html>
<html <?php language_attributes(); ?> class="no-js">
<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 class="antialiased">
<div class="md:flex min-h-screen">
<div class="w-full md:w-1/2 flex items-center justify-center">
<div class="max-w-sm m-8">
<div class="text-5xl md:text-15xl text-gray-800 border-primary border-b">404</div>
<div class="w-16 h-1 bg-purple-light my-3 md:my-6"></div>
<p class="text-gray-800 text-2xl md:text-3xl font-light mb-8"><?php _e( 'Sorry, the page you are looking for could not be found.', 'tailpress' ); ?></p>
<a href="<?php echo get_bloginfo( 'url' ); ?>" class="bg-primary px-4 py-2 rounded text-white">
<?php _e( 'Go Home', 'tailpress' ); ?>
</a>
</div>
</div>
</div>
</body>
</html>

103
CHANGELOG.md Normal file
View File

@ -0,0 +1,103 @@
# Changelog
All notable changes to TailPress will be documented in this file.
## Unreleased
## 3.1.0
- Tailwind font sizes are now set as defined in `theme.json`.
- Breakpoints now based on WordPress defaults (https://developer.wordpress.org/block-editor/reference-guides/packages/packages-viewport/#usage).
- Providing `w-content`, `max-w-content`, `w-wide` and `max-w-wide` utility classes.
- Content width is now actually the width as defined in `theme.json`.
- Fixing align wide, width as defined in `theme.json`.
- Updating Tailwind CSS to version 3.1.0.
- Fix issues package.json scripts on Windows.
## 3.0.0 - 2021-12-14
- Updating Tailwind to 3.0.0.
### TailPress installer
- The TailPress installer (^0.2.0) now allows you to use Laravel Mix instead of esbuild by setting --compiler=mix.
- You may now also set dbname, dbuser, dbpass and dbhost.
## 2.0.0 - 2021-09-03
- Switching to Tailwind CLI and esbuild instead of LaraveL Mix.
- Removing `theme` subdirectory setup as it is no longer needed with the new build setup.
- Removing `TailPress` class and it's functions (`tailpress()->get_header()` etc.) throughout the theme.
- New `tailpress_asset` function to get the URL of an asset (previously `tailpress_mix`).
- `tailpress_asset` function thaty appends a `time` parameter if [wp_get_environment_type()](https://developer.wordpress.org/reference/functions/wp_get_environment_type/) does not return `production` for cache busting (instead of the previously used versioned assets through `mix-manifest.json`).
- Update screenshot.png.
- Remove `block-editor.css`, only use `editor-style.css`.
- Moving `editor-style.css` from root to `css` directory.
- Update readme.
## 1.0.0 - 2021-08-25
- Replace `tailpress.json` with `theme.json` as used by WordPress core.
- Move template files into `theme` subdirectory.
- Move tailwind plugin to a [separate repository](https://github.com/jeffreyvr/tailwindcss-tailpress).
- Update readme and adding section on using installer.
## 0.1.0 - 2021-06-17
- No longer depending on jQuery.
- Fixes text color classes for the Block Editor.
- Use safelist.txt to prevent WP classes from being purged.
- Readme changes.
- MIT License.
## 0.0.9 - 2021-04-05
- Updating to Tailwind CSS v2.1 which includes the JIT engine in core among other things.
## 0.0.8 - 2021-03-23
- Using TailwindCSS JIT for way faster compiling.
- Updated readme.
- Fix loading styling in block editor.
- Check if mix-manifest.json file exists to prevent warning message.
## 0.0.7 - 2021-02-15
- Adding the option to apply submenu_class to the wp_nav_menu args.
- Adding the option to apply classes on li_class and submenu_class on specific depths, like: li_class_0.
### 0.0.6 - 2021-02-08
- Fixes issue on Windows.
## 0.0.5 - 2020-12-24
- Set selectors on single line since this seems to cause issues (nested CSS) with production build (#241a612).
## 0.0.4 - 2020-12-23
- Add nested CSS support for PostCSS.
- Minor readme changes.
## 0.0.3 - 2020-12-22
- Update Laravel Mix from version 5^ to 6^.
- Removing Laravel Mix Tailwind, defining plugins within webpack.mix.js instead.
- Switching from Sass to PostCSS for faster compiling.
- Moved TailPress colors and font size settings to tailpress.json file.
- Use tailpress.json to populate editor-color-palette and editor-font-sizes theme support automatically.
- New screenshot.
- Update readme.
- Other minor fixes and improvements.
## 0.0.2 - 2020-11-24
- Adding basic support for the block editor Gutenberg by generating alignment, font size and color classes.
Contains four theme colors out of the box, being primary, secondary, dark and light. This is adjustable of course.
- Loading a editor-style.css.
- Removing double slashes on resulting manifest asset URLs.
- Modified template files to have a better starting point (including horizontal main navigation, footer always at the bottom for short pages).
- Added a basic 404 page template.
## 0.0.1 - 2020-11-19
- Init release.

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) Jeffrey van Rossum <jeffrey@vanrossum.dev>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

3
README.MD Normal file
View File

@ -0,0 +1,3 @@
A custom Theme made by Deligraph using Tailwind and Laravel Mix
https://deligraph.com/

74
comments.php Normal file
View File

@ -0,0 +1,74 @@
<?php
/**
* If the current post is protected by a password and
* the visitor has not yet entered the password we will
* return early without loading the comments.
*/
if ( post_password_required() ) {
return;
}
?>
<div id="comments" class="comments-area my-8">
<?php if ( have_comments() ) : ?>
<h2 class="comments-title">
<?php
printf(
_nx( 'One comment', '%1$s comments', get_comments_number(), 'comments title', 'tailpress' ),
number_format_i18n( get_comments_number() ),
get_the_title()
);
?>
</h2>
<ol class="comment-list">
<?php
wp_list_comments(
array(
'style' => 'ol',
'short_ping' => true,
'avatar_size' => 56,
)
);
?>
</ol>
<?php endif; ?>
<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : ?>
<nav class="comment-navigation" id="comment-nav-above">
<h1 class="screen-reader-text"><?php esc_html_e( 'Comment navigation', 'tailpress' ); ?></h1>
<?php if ( get_previous_comments_link() ) { ?>
<div class="nav-previous">
<?php previous_comments_link( __( '&larr; Older Comments', 'tailpress' ) ); ?>
</div>
<?php } ?>
<?php if ( get_next_comments_link() ) { ?>
<div class="nav-next">
<?php next_comments_link( __( 'Newer Comments &rarr;', 'tailpress' ) ); ?>
</div>
<?php } ?>
</nav><!-- #comment-nav-above -->
<?php endif; ?>
<?php if ( ! comments_open() && get_comments_number() && post_type_supports( get_post_type(), 'comments' ) ) : ?>
<p class="no-comments"><?php esc_html_e( 'Comments are closed.', 'tailpress' ); ?></p>
<?php endif; ?>
<?php
comment_form(
array(
'class_submit' => 'bg-primary text-white cursor-pointer rounded font-bold py-2 px-4',
'comment_field' => '<textarea id="comment" name="comment" class="bg-gray-200 w-full py-2 px-3" aria-required="true"></textarea>',
)
);
?>
</div>

7
css/admin-style.css Normal file
View File

@ -0,0 +1,7 @@
/* body {
background: red !important;
} */
#menu-posts {
border-top: 1px solid rgba(255, 255, 255, 0.2) !important;
}

1414
css/app.css Normal file

File diff suppressed because it is too large Load Diff

365
css/editor-style.css Normal file
View File

@ -0,0 +1,365 @@
.container {
width: 100%;
padding-right: 1rem;
padding-left: 1rem
}
@media (min-width: 480px) {
.container {
max-width: 480px
}
}
@media (min-width: 600px) {
.container {
max-width: 600px;
padding-right: 2rem;
padding-left: 2rem
}
}
@media (min-width: 782px) {
.container {
max-width: 782px
}
}
@media (min-width: 960px) {
.container {
max-width: 960px;
padding-right: 0rem;
padding-left: 0rem
}
}
@media (min-width: 1280px) {
.container {
max-width: 1280px
}
}
@media (min-width: 1440px) {
.container {
max-width: 1440px
}
}
.m-8 {
margin: 2rem
}
.my-3 {
margin-top: 0.75rem;
margin-bottom: 0.75rem
}
.my-8 {
margin-top: 2rem;
margin-bottom: 2rem
}
.mx-auto {
margin-left: auto;
margin-right: auto
}
.mb-8 {
margin-bottom: 2rem
}
.mb-4 {
margin-bottom: 1rem
}
.mb-1 {
margin-bottom: 0.25rem
}
.mb-12 {
margin-bottom: 3rem
}
.block {
display: block
}
.flex {
display: flex
}
.h-1 {
height: 0.25rem
}
.min-h-screen {
min-height: 100vh
}
.w-full {
width: 100%
}
.w-16 {
width: 4rem
}
.max-w-sm {
max-width: 24rem
}
.max-w-screen-md {
max-width: 782px
}
.flex-grow {
flex-grow: 1
}
.cursor-pointer {
cursor: pointer
}
.flex-col {
flex-direction: column
}
.items-center {
align-items: center
}
.justify-center {
justify-content: center
}
.justify-between {
justify-content: space-between
}
.rounded {
border-radius: 0.25rem
}
.border {
border-width: 1px
}
.border-b {
border-bottom-width: 1px
}
.border-primary {
--tw-border-opacity: 1;
border-color: rgb(47 1 84 / var(--tw-border-opacity))
}
.bg-primary {
--tw-bg-opacity: 1;
background-color: rgb(47 1 84 / var(--tw-bg-opacity))
}
.bg-white {
--tw-bg-opacity: 1;
background-color: rgb(255 255 255 / var(--tw-bg-opacity))
}
.px-4 {
padding-left: 1rem;
padding-right: 1rem
}
.py-2 {
padding-top: 0.5rem;
padding-bottom: 0.5rem
}
.px-3 {
padding-left: 0.75rem;
padding-right: 0.75rem
}
.py-12 {
padding-top: 3rem;
padding-bottom: 3rem
}
.text-center {
text-align: center
}
.text-5xl {
font-size: 3rem;
line-height: 1
}
.text-2xl {
font-size: 1.5rem;
line-height: 2rem
}
.text-lg {
font-size: 1.125rem;
line-height: 1.75rem
}
.text-sm {
font-size: 0.875rem;
line-height: 1.25rem
}
.font-light {
font-weight: 300
}
.font-bold {
font-weight: 700
}
.font-extrabold {
font-weight: 800
}
.uppercase {
text-transform: uppercase
}
.leading-tight {
line-height: 1.25
}
.text-white {
--tw-text-opacity: 1;
color: rgb(255 255 255 / var(--tw-text-opacity))
}
.antialiased {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale
}
.alignfull {
margin: 2rem calc(50% - 50vw) !important;
max-width: 100vw !important;
width: 100vw
}
.alignwide {
margin: 2rem 0;
max-width: 1280px !important
}
.alignnone {
margin-left: 0px;
margin-right: 0px;
height: auto;
max-width: 100%
}
.aligncenter {
margin: 0.5rem auto;
display: block
}
@media (min-width: 600px) {
.alignleft:not(.wp-block-button) {
margin-right: 0.5rem;
float: left
}
.alignright:not(.wp-block-button) {
margin-left: 0.5rem;
float: right
}
.wp-block-button.alignleft a {
float: left;
margin-right: 1rem
}
.wp-block-button.alignright a {
float: right;
margin-left: 1rem
}
}
.wp-caption {
display: inline-block
}
.wp-caption img {
margin-bottom: 0.5rem;
line-height: 1
}
.wp-caption-text {
font-size: 0.875rem;
color: #718096
}
body {
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"
}
.wp-block {
max-width: 1280px
}
.wp-block[data-align="wide"] {
max-width: 1280px
}
.wp-block[data-align="full"] {
max-width: 100%
}
.wp-block.alignfull {
max-width: 100%
}
.acf-block-component {
/* @apply bg-red-500; */
}
.acf-block-fields {
margin-left: auto;
margin-right: auto;
max-width: 782px
}
@media (min-width: 782px) {
.md\:my-6 {
margin-top: 1.5rem;
margin-bottom: 1.5rem
}
.md\:flex {
display: flex
}
.md\:w-1\/2 {
width: 50%
}
.md\:text-3xl {
font-size: 1.875rem;
line-height: 2.25rem
}
}
@media (min-width: 960px) {
.lg\:flex {
display: flex
}
.lg\:items-center {
align-items: center
}
.lg\:justify-between {
justify-content: space-between
}
.lg\:text-5xl {
font-size: 3rem;
line-height: 1
}
}

37
css/login-style.css Normal file
View File

@ -0,0 +1,37 @@
body {
/* @apply bg-primary; */
}
#login h1 a,
.login h1 a {
background-image: url("../resources/img/logo_client.svg");
height: 100px;
width: 300px;
background-size: 300px 100px;
background-repeat: no-repeat;
padding-bottom: 10px;
}
#wp-submit {
--tw-border-opacity: 1;
border-color: rgb(47 1 84 / var(--tw-border-opacity));
--tw-bg-opacity: 1;
background-color: rgb(47 1 84 / var(--tw-bg-opacity));
}
#nav a,
#backtoblog a {
/* color: var(--red) !important; */
--tw-text-opacity: 1;
color: rgb(47 1 84 / var(--tw-text-opacity));
}
#loginform {
border: none;
}
.wp-pwd span {
--tw-text-opacity: 1;
color: rgb(47 1 84 / var(--tw-text-opacity));
/* color: var(--red) !important; */
}

22
footer.php Normal file
View File

@ -0,0 +1,22 @@
</main>
<?php do_action( 'tailpress_content_end' ); ?>
<?php do_action( 'tailpress_content_after' ); ?>
<footer id="colophon" class="site-footer bg-gray-50 py-12" role="contentinfo">
<?php do_action( 'tailpress_footer' ); ?>
<div class="container mx-auto text-center text-gray-500">
&copy; <?php echo date_i18n( 'Y' );?> - <?php echo get_bloginfo( 'name' );?>
</div>
</footer>
</div>
<?php wp_footer(); ?>
</body>
</html>

17
front-page.php Executable file
View File

@ -0,0 +1,17 @@
<?php get_header(); ?>
<?php if ( have_posts() ) : ?>
<?php
while ( have_posts() ) :
the_post();
the_content();
?>
<?php endwhile; ?>
<?php endif; ?>
<?php
get_footer();

13
functions.php Normal file
View File

@ -0,0 +1,13 @@
<?php
require_once(__DIR__ . '/includes/errorlog.php');
require_once(__DIR__ . '/includes/init.php');
require_once(__DIR__ . '/includes/blocks.php');
require_once(__DIR__ . '/includes/post_types.php');
require_once(__DIR__ . '/includes/admin.php');
require_once(__DIR__ . '/includes/logos.php');
require_once(__DIR__ . '/includes/taxonomy.php');
// require_once(__DIR__ . '/includes/widget.php');
// require_once( __DIR__ . '/includes/errorlog.php');
// require_once( __DIR__ . '/includes/logos.php');

85
header.php Normal file
View File

@ -0,0 +1,85 @@
<!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">
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>">
<?php wp_head(); ?>
</head>
<body <?php body_class('bg-white text-gray-900 antialiased'); ?>>
<?php
do_action('tailpress_site_before');
global $post;
?>
<div id="page-<?php echo $post->post_name ?>" class="min-h-screen flex flex-col">
<?php do_action('tailpress_header'); ?>
<header id="primary-header">
<div class="primary-menu-container lg:flex lg:justify-between lg:items-center">
<nav id="primary-menu-nav" class="flex justify-between items-center">
<!-- <div class="website_logo">
<?php if (has_custom_logo()) { ?>
<?php the_custom_logo(); ?>
<?php } else { ?>
<a href=" <?php echo get_bloginfo('url'); ?>" class="font-extrabold text-lg uppercase">
<?php echo get_bloginfo('name'); ?>
</a>
<p class="text-sm font-light text-gray-600">
<?php echo get_bloginfo('description'); ?>
</p>
<?php } ?>
</div> -->
<button id="burger-menu-toggle" aria-label="<?php echo esc_html_e("Ouvrir le menu", 'deligraph-theme') ?>">
<div class="menu-toggle-bar menu-toggle-bar--top"></div>
<div class="menu-toggle-bar menu-toggle-bar--middle"></div>
<div class="menu-toggle-bar menu-toggle-bar--bottom"></div>
<!-- <?php echo get_template_part('resources/svg/burger-menu-icon.svg'); ?> -->
</button>
<div id="primary-menu">
<?php
wp_nav_menu(
array(
'container' => 'false',
'theme_location' => 'homegrade',
'li_class' => 'menu-navlink',
'fallback_cb' => false,
)
); ?>
</div>
</nav>
</div>
<!-- qsdqds -->
</header>
<?php if (is_front_page()) { ?>
<?php } ?>
<?php do_action('tailpress_content_start'); ?>
<main id="content" class="site-content flex-grow">

41
includes/admin.php Normal file
View File

@ -0,0 +1,41 @@
<?php
// #### ADMIN STYLE
function my_custom_admin()
{
wp_enqueue_style('admin_styles', get_template_directory_uri() . '/css/admin-style.css');
}
add_action('admin_head', 'my_custom_admin');
// ##### REMOVE FROM ADMIN MENU
function custom_menu_page_removing()
{
// remove_menu_page('edit.php'); // Hide Articles
remove_menu_page('edit-comments.php'); // Hide Commentaires
}
add_action('admin_menu', 'custom_menu_page_removing');
// ##### Removes from admin bar
function mytheme_admin_bar_render()
{
global $wp_admin_bar;
$wp_admin_bar->remove_menu('comments');
}
add_action('wp_before_admin_bar_render', 'mytheme_admin_bar_render');
// ##### MODIFIER LE LIEN DU LOGO SUR LA BLADE DE CONNEXION À L'INTERFACE ADMIN
function change_login_logo_url($url)
{
return site_url();
}
add_filter('login_headerurl', 'change_login_logo_url');
// ##### ENQUEUE DU CSS BLADE LOGIN ADMIN
function enqueue_custom_login_stylesheet()
{
wp_enqueue_style('custom-login', get_stylesheet_directory_uri() . '/style-login.css');
}
add_action('login_enqueue_scripts', 'enqueue_custom_login_stylesheet');

51
includes/blocks.php Executable file
View File

@ -0,0 +1,51 @@
<?php
// ##### Blocks Category 🡒 Déclaration de la catégorie de blocks custom
function client_add_block_categories($categories)
{
return array_merge(
[
[
'slug' => 'homegrade-blocks',
'title' => 'Homegrade Generic Blocks ',
'icon' => 'heart',
],
],
$categories,
[
[
'slug' => 'homegrade-pages',
'title' => 'Homegrade Specific Page Blocks ',
'icon' => 'admin-page',
],
],
);
}
add_action('block_categories_all', 'client_add_block_categories', 10, 2);
function mywp_register_acf_blocks()
{
// Check availability of block editor
if (!function_exists('register_block_type')) {
return;
}
register_block_type(get_template_directory() . '/template-blocks/home/home-header');
register_block_type(get_template_directory() . '/template-blocks/home/latest-news');
}
add_action('init', 'mywp_register_acf_blocks');
// ##### Blocks style 🡒 Re-enqueue d'un style dans l'éditeur
// function block_newsfeed_add_editor_styles() {
// add_editor_style( get_stylesheet_directory_uri() . '/template-parts/blocks/editor.css' );
// }
// add_action( 'admin_init', 'block_newsfeed_add_editor_styles' );

19
includes/errorlog.php Executable file
View File

@ -0,0 +1,19 @@
<?php
// #################################
// FUNCTION ERROR LOG
// #################################
// Error log
if (!function_exists('write_log')) {
function write_log($log) {
if (true === WP_DEBUG) {
if (is_array($log) || is_object($log)) {
error_log(print_r($log, true));
} else {
error_log($log);
}
}
}
}

160
includes/init.php Normal file
View File

@ -0,0 +1,160 @@
<?php
/**
* Theme setup.
*/
function tailpress_setup()
{
// ##### Setup 🡒 Navigation
register_nav_menus(
array(
'homegrade' => __('Menu Homegrade', 'deliraph-theme'),
'renovateur' => __('Menu Rénovateur', 'deliraph-theme'),
)
);
// ##### Setup 🡒 Ajout des themes supports
add_theme_support(
'html5',
array(
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
)
);
// add_theme_support('title-tag');
add_theme_support('custom-logo');
add_theme_support('post-thumbnails');
add_theme_support('align-wide');
add_theme_support('wp-block-styles');
add_theme_support('editor-styles');
add_editor_style('css/editor-style.css');
add_theme_support('widgets');
// add_post_type_support( 'page', 'excerpt' );
}
add_action('after_setup_theme', 'tailpress_setup');
// ##### Menu Walker
// if (!function_exists('register_navwalker')) :
// function register_navwalker() {
// require('includes/navwalker.php');
// }
// endif;
// add_action('after_setup_theme', 'register_navwalker');
// ##### Walker to ReWrap li submenu parent with button instead of <a>
function wrap_parent_menu_item_buttons($output, $item, $depth, $args)
{
if ($args->theme_location === "homegrade" && in_array('menu-item-has-children', $item->classes, true)) {
$output = '<button type="button" class="menu-item-submenu-toggle" aria-expanded="false" aria-controls="sub-menu-' . $item->ID . '">' . $item->title . '</button>';
}
if ($args->theme_location === "footer" && in_array('menu-item-has-children', $item->classes, true)) {
$output = $item->title;
}
return $output;
}
add_filter('walker_nav_menu_start_el', 'wrap_parent_menu_item_buttons', 10, 4);
// ##### Enqueue Theme assets 🡒 Front
function tailpress_enqueue_scripts()
{
$theme = wp_get_theme();
wp_enqueue_style('tailpress', tailpress_asset('css/app.css'), array(), $theme->get('Version'));
wp_enqueue_script('tailpress', tailpress_asset('js/app.js'), array(), $theme->get('Version'));
}
// ##### Enqueue Theme assets 🡒 Back
function enqueue_gutenberg_back_styles()
{
wp_enqueue_style('tailpress_back', tailpress_asset('css/app.css'), array());
}
add_action('enqueue_block_editor_assets', 'enqueue_gutenberg_back_styles');
add_action('wp_enqueue_scripts', 'tailpress_enqueue_scripts');
/**
* Get asset path.
*
* @param string $path Path to asset.
*
* @return string
*/
function tailpress_asset($path)
{
if (wp_get_environment_type() === 'production') {
return get_stylesheet_directory_uri() . '/' . $path;
}
return add_query_arg('time', time(), get_stylesheet_directory_uri() . '/' . $path);
}
/**
* Adds option 'li_class' to 'wp_nav_menu'.
*
* @param string $classes String of classes.
* @param mixed $item The curren item.
* @param WP_Term $args Holds the nav menu arguments.
*
* @return array
*/
function tailpress_nav_menu_add_li_class($classes, $item, $args, $depth)
{
if (isset($args->li_class)) {
$classes[] = $args->li_class;
}
if (isset($args->{"li_class_$depth"})) {
$classes[] = $args->{"li_class_$depth"};
}
return $classes;
}
add_filter('nav_menu_css_class', 'tailpress_nav_menu_add_li_class', 10, 4);
/**
* Adds option 'submenu_class' to 'wp_nav_menu'.
*
* @param string $classes String of classes.
* @param mixed $item The curren item.
* @param WP_Term $args Holds the nav menu arguments.
*
* @return array
*/
function tailpress_nav_menu_add_submenu_class($classes, $args, $depth)
{
if (isset($args->submenu_class)) {
$classes[] = $args->submenu_class;
}
if (isset($args->{"submenu_class_$depth"})) {
$classes[] = $args->{"submenu_class_$depth"};
}
return $classes;
}
add_filter('nav_menu_submenu_css_class', 'tailpress_nav_menu_add_submenu_class', 10, 3);

34
includes/logos.php Executable file
View File

@ -0,0 +1,34 @@
<?php
/** ------------------------------
ENABLE SVG
------------------------------*/
/* <?xml version="1.0" encoding="utf-8"?> */
function cc_mime_types($mimes)
{
$mimes['svg'] = 'image/svg+xml';
return $mimes;
}
add_filter('upload_mimes', 'cc_mime_types');
// #############################
// AJOUT D'UN ESPACE LOGO CUSTOM
// #############################
// function add_logo_customizer_settings($wp_customize)
// {
// $wp_customize->add_setting('logo_semlex_dark');
// // Add a control to upload the hover logo
// $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'logo_semlex_dark', array(
// 'label' => 'Logo Semlex Sombre',
// 'section' => 'title_tagline', //this is the section where the custom-logo from WordPress is
// 'settings' => 'logo_semlex_dark',
// 'priority' => 8 // show it just below the custom-logo
// )));
// }
// add_action('customize_register', 'add_logo_customizer_settings');

28
includes/navwalker.php Normal file
View File

@ -0,0 +1,28 @@
<?php
class wp_nav_menu_walker extends Walker_Nav_menu
{
function start_lvl(&$output, $depth = 0, $args = null)
{
$tmp_class = "child-" . $depth;
$output .= "<ul class='" . $tmp_class . "'>";
}
function start_el(&$output, $item, $depth = 0, $args = null, $id = 0)
{
$output .= "<li>I like pie" . $item->title;
// var_dump($args);
}
function end_el(&$output, $item, $depth = 0, $args = null)
{
$output .= "...</li>";
}
}

144
includes/post_types.php Normal file
View File

@ -0,0 +1,144 @@
<?php
// Change Defaults Posts to "News" in menu bar
function cp_change_post_object()
{
$get_post_type = get_post_type_object('post');
$labels = $get_post_type->labels;
$labels->name = 'News';
$labels->singular_name = 'News';
$labels->add_new = 'Ajouter une Actu';
$labels->add_new_item = 'Ajouter une Actu';
$labels->edit_item = 'Editer l\'actualité';
$labels->new_item = 'News';
$labels->view_item = 'Voir l\'actualité';
$labels->search_items = 'Chercher une Actualité';
$labels->not_found = 'Pas de News trouvée';
$labels->not_found_in_trash = 'Pas de News trouvée dans la corbeille';
$labels->all_items = 'Toutes les Actus';
$labels->menu_name = 'News';
$labels->name_admin_bar = 'News';
}
add_action('init', 'cp_change_post_object');
// Change Defaults Posts Icon in menu bar
function change_menu_icon()
{
// Access global variables.
global $menu;
foreach ($menu as $key => $val) {
if (__('News', 'plugin-name') == $val[0]) {
$menu[$key][6] = 'dashicons-welcome-widgets-menus';
}
}
}
add_action('admin_menu', 'change_menu_icon');
// #### POST TYPES
function create_posttype()
{
register_post_type(
'fiche-questions',
array(
'labels' => array(
'name' => __('Fiches Question'),
'singular_name' => __('Fiche Question')
),
'public' => true,
'has_archive' => true,
'rewrite' => array('slug' => 'fiche-question'),
'show_in_rest' => true,
'menu_icon' => 'dashicons-admin-home',
'menu_position' => 4,
'supports' => array('title', 'custom-fields'),
)
);
register_post_type(
'fiche-conseils',
array(
'labels' => array(
'name' => __('Fiches Conseil'),
'singular_name' => __('Fiche Conseil')
),
'public' => true,
'has_archive' => true,
'rewrite' => array('slug' => 'fiche-conseil'),
'show_in_rest' => true,
'menu_icon' => 'dashicons-admin-home',
'menu_position' => 4,
'supports' => array('title', 'custom-fields'),
)
);
register_post_type(
'vocabulaire',
array(
'labels' => array(
'name' => __('Vocabulaire'),
'singular_name' => __('Vocabulaire')
),
'public' => true,
'has_archive' => true,
'rewrite' => array('slug' => 'fiche'),
'show_in_rest' => true,
// 'menu_icon' => 'dashicons-image-filter',
'menu_icon' => 'dashicons-format-status',
'menu_position' => 4,
'supports' => array('title', 'custxom-fields'),
)
);
}
add_action('init', 'create_posttype');
// function remove_editor()
// {
// if (isset($_GET['post'])) {
// $id = $_GET['post'];
// $template = get_post_meta($id, '_wp_page_template', true);
// switch ($template) {
// case 'template_01.php':
// case 'template_02.php':
// case 'template_03.php':
// case 'template_04.php':
// // the below removes 'editor' support for 'pages'
// // if you want to remove for posts or custom post types as well
// // add this line for posts:
// // remove_post_type_support('post', 'editor');
// // add this line for custom post types and replace
// // custom-post-type-name with the name of post type:
// // remove_post_type_support('custom-post-type-name', 'editor');
// remove_post_type_support('page', 'editor');
// break;
// default:
// // Don't remove any other template.
// break;
// }
// }
// }
// add_action('init', 'remove_editor');
// add_action( 'admin_init', 'hide_editor' );
// function hide_editor() {
// $post_id = $_GET['post'] ? $_GET['post'] : $_POST['post_ID'] ;
// if( !isset( $post_id ) ) return;
// $template_file = get_post_meta($post_id, '_wp_page_template', true);
// if($template_file == 'submit.php'){ // edit the template name
// remove_post_type_support('page', 'editor');
// }
// }

View File

@ -0,0 +1,209 @@
<?php
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
?>
// ##### Syntax
<?php if ($var) : ?>
<p><?php echo $var['title'] ?></p>
<?php endif; ?>
<?php if ($var) { ?>
<p><?php echo $var['title'] ?></p>
<?php }; ?>
<?php
// ##### Template parts 🡒 Get templates parts
get_template_part(
'template-parts/blocks/the-file',
null,
array(
'ID' => $my_post_id,
)
);
/** ------------------------------
QUERIES
------------------------------*/
// ##### Query 🡒 Get posts
$args = array(
'fields' => 'ids',
'post_type' => 'restaurants',
'posts_per_page' => -1
);
$posts = get_posts($args);
// ##### Query 🡒 Recent posts
$posts = wp_get_recent_posts([
'numberposts' => 4,
'post_status' => 'publish'
]);
// ##### Query 🡒 With Metaqueries
$args = array(
'post_type' => 'activities',
'post_status' => array('publish', 'future'),
'numberposts' => '3',
'meta_key' => 'date',
'orderby' => 'meta_value',
'order' => 'ASC',
// ######## Main
'meta_query' => array(
array(
'key' => 'date',
'value' => $today,
'compare' => '>='
)
)
);
$recent_activites = wp_get_recent_posts($args);
// ##### Query 🡒 Wordpress Global Query Loop
$args = array('posts_per_page' => 6, 'post_type' => 'post');
$the_query = new WP_Query($args);
if ($the_query->have_posts()) {
echo '<ul>';
while ($the_query->have_posts()) {
$the_query->the_post();
echo '<li>' . get_the_title() . '</li>';
}
echo '</ul>';
} else {
// no posts found
}
/* Restore original Post Data */
wp_reset_postdata();
/** ------------------------------
POST DATES
------------------------------*/
$post_date = date_i18n('j F Y', strtotime($post['post_date']));
/** ------------------------------
URL
------------------------------*/
// ##### URL 🡒 Home Url
echo home_url('/admission/');
// ##### URL 🡒 Site Url
echo site_url('/admission/', 'https');
/** ------------------------------
ENABLE SVG
------------------------------*/
/* <?xml version="1.0" encoding="utf-8"?> */
function cc_mime_types($mimes)
{
$mimes['svg'] = 'image/svg+xml';
return $mimes;
}
add_filter('upload_mimes', 'cc_mime_types');
/** ------------------------------
INIT WIDGET
------------------------------*/
function tailwind_widgets_init()
{
register_sidebar(
array(
'name' => esc_html__('Discover_next', 'tailwind'),
'id' => 'discover_next',
'description' => esc_html__('Add widgets here.', 'tailwind'),
'before_widget' => '<section id="%1$s" class="widget %2$s">',
'after_widget' => '</section>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
)
);
}
/** ------------------------------
POSTS
------------------------------*/
// Change Defaults Posts to "News" in menu bar
function cp_change_post_object()
{
$get_post_type = get_post_type_object('post');
$labels = $get_post_type->labels;
$labels->name = 'News';
$labels->singular_name = 'News';
$labels->add_new = 'Add News';
$labels->add_new_item = 'Add News';
$labels->edit_item = 'Edit News';
$labels->new_item = 'News';
$labels->view_item = 'View News';
$labels->search_items = 'Search News';
$labels->not_found = 'No News found';
$labels->not_found_in_trash = 'No News found in Trash';
$labels->all_items = 'All News';
$labels->menu_name = 'News';
$labels->name_admin_bar = 'News';
}
add_action('init', 'cp_change_post_object');
// Change Defaults Posts Icon in menu bar
function change_menu_icon()
{
// Access global variables.
global $menu;
foreach ($menu as $key => $val) {
if (__('News', 'plugin-name') == $val[0]) {
$menu[$key][6] = 'dashicons-welcome-widgets-menus';
}
}
}
add_action('admin_menu', 'change_menu_icon');
/** ------------------------------
HIDE EDITOR ON SPECIFIC PAGE
------------------------------*/
function remove_editor_init()
{
if (isset($_GET['post'])) {
$id = $_GET['post'];
if ($id == 7) {
remove_post_type_support('page', 'editor');
}
}
}
add_action('init', 'remove_editor_init');

93
includes/taxonomy.php Normal file
View File

@ -0,0 +1,93 @@
<?php
// ########## HIDE DEFAULT TAXONOMIES
function wpsnipp_remove_default_taxonomies()
{
global $pagenow;
// register_taxonomy('post_tag', array());
register_taxonomy('category', array());
// $tax = array('post_tag', 'category');
$tax = array('category');
if ($pagenow == 'edit-tags.php' && in_array($_GET['taxonomy'], $tax)) {
wp_die('Invalid taxonomy');
}
}
add_action('init', 'wpsnipp_remove_default_taxonomies');
// ########## OTHER THAN ADMIN CANNOT CREATE TAGS
add_action('create_term', 'undo_create_term', 10, 3);
function undo_create_term($term_id, $tt_id, $taxonomy)
{
if (!current_user_can('administrator')) {
if ($taxonomy == 'post_tag') {
wp_delete_term($term_id, $taxonomy);
}
}
}
// ########## REGISTER TAXONOMY
function add_custom_taxonomies()
{
// ————— Thématiques —————
register_taxonomy('thematiques', ['fiche-questions', 'fiche-conseils'], array(
// 'hierarchical' => true,
'labels' => array(
'name' => _x('Thématiques', 'taxonomy general name'),
'singular_name' => _x('Thématique', 'taxonomy singular name'),
'search_items' => __('Chercher une Thématique'),
'all_items' => __('Toutes les Thématiques'),
'parent_item' => __('Thématique Parent'),
'parent_item_colon' => __('Thématique Parent:'),
'edit_item' => __('Editer la Thématique'),
'update_item' => __('Mettre à jour la Thématique'),
'add_new_item' => __('Ajouter une Thématique'),
'new_item_name' => __('Nom de la nouvelle Thématique'),
'menu_name' => __('Thématiques'),
),
'hierarchical' => true, // This will allow URL's like "/locations/boston/cambridge/"
'rewrite' => array(
'slug' => 'thematiques', // This controls the base slug that will display before each term
// 'with_front' => false, // Don't display the category base before "/locations/"
),
));
// ————— —————
register_taxonomy('thematiques', ['fiche-questions', 'fiche-conseils'], array(
// 'hierarchical' => true,
// This array of options controls the labels displayed in the WordPress Admin UI
'labels' => array(
'name' => _x('Thématiques', 'taxonomy general name'),
'singular_name' => _x('Thématique', 'taxonomy singular name'),
'search_items' => __('Chercher une Thématique'),
'all_items' => __('Toutes les Thématiques'),
'parent_item' => __('Thématique Parent'),
'parent_item_colon' => __('Thématique Parent:'),
'edit_item' => __('Editer la Thématique'),
'update_item' => __('Mettre à jour la Thématique'),
'add_new_item' => __('Ajouter une Thématique'),
'new_item_name' => __('Nom de la nouvelle Thématique'),
'menu_name' => __('Thématiques'),
),
// Control the slugs used for this taxonomy
'rewrite' => array(
'slug' => 'thematiques', // This controls the base slug that will display before each term
// 'with_front' => false, // Don't display the category base before "/locations/"
'hierarchical' => true // This will allow URL's like "/locations/boston/cambridge/"
),
));
}
add_action('init', 'add_custom_taxonomies', 0);

13
includes/widget.php Normal file
View File

@ -0,0 +1,13 @@
<?php
register_sidebar(
array(
'name' => 'Experts',
'id' => 'widget_nos_experts',
'description' => 'Add widgets here.',
// 'before_widget' => '<section id="%1$s" class="widget %2$s">',
// 'after_widget' => '</section>',
// 'before_title' => '<h2 class="widget-title">',
// 'after_title' => '</h2>',
),
);

20
index.php Normal file
View File

@ -0,0 +1,20 @@
<?php get_header(); ?>
<div class="container mx-auto my-8">
<?php if ( have_posts() ) : ?>
<?php
while ( have_posts() ) :
the_post();
?>
<?php get_template_part( 'template-parts/content', get_post_format() ); ?>
<?php endwhile; ?>
<?php endif; ?>
</div>
<?php
get_footer();

57
init_script.sh Normal file
View File

@ -0,0 +1,57 @@
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
NC='\033[0m' # No Color
# ——— PROJECT NAME ———
echo "——${RED} Quel est le nom du client ?${NC} "
read clientName
projectName="Deligraph_${clientName}"
# ——— RECONFIGURATION DE L'URL HOME LOCALE ———
echo "##### ${GREEN}RECONFIGURATION DE L'URL HOME LOCALE${NC} ##### "
# Manually change my db host sur ma machine pour wp-cli fonctionne en local (pour bien préciser le socket)
# define('DB_HOST', 'localhost:/Users/martoni_sato/Library/Application Support/Local/run/nFQk01MlZ/mysql/mysqld.sock');
# ——— PLUGINS ———
echo "##### ${GREEN}INSTALLATION DES PLUGINS ${NC} #####"
wp plugin install ./wp-database-tools-main.zip --activate
wp plugin install duplicator --activate
wp plugin install advanced-custom-fields-pro --activate
composer require wpengine/advanced-custom-fields-pro
wp plugin activate advanced-custom-fields-pro
wp eval 'acf_pro_update_license("b3JkZXJfaWQ9NTg3Nzd8dHlwZT1kZXZlbG9wZXJ8ZGF0ZT0yMDE1LTA2LTI1IDA4OjE5OjUx");'
# ——— LANGUE ———
wp language core install fr_FR
wp language core activate fr_FR
# ——— THEME ———
echo "##### ${GREEN}INSTALLATION DU THEME ${NC} #####"
git clone https://gitlab.com/deligraph/wp_starter.git
mv wp_starter $projectName
cd $projectName
sed -i "s/Deligraph_theme/$projectName/g" style.css
wp theme activate projectName
# ——— DEFAULT CONTENT ———
wp post create --post_type=page --post_title='Home' --post_status='publish'
wp post create --post_type=page --post_title='News' --post_status='publish'
wp option update show_on_front "page"
wp option update page_on_front "4"
# wp option update page_for_posts "5"
# ——— DESCATIVER LES COMMENTAIREs———
# make all comments disabled
wp option update disable_comments_options --format=json '{"disabled_post_types":["post","page","attachment"],"remove_everywhere":true,"permanent":false,"extra_post_types":false,"db_version":6}'
wp menu create "Main Menu"
wp menu location assign main-menu primary

44
js/app.js Normal file
View File

@ -0,0 +1,44 @@
(() => {
// resources/js/header.js
function menuInit() {
let main_navigation = document.querySelector("#primary-menu");
const header = document.querySelector("#primary-header");
const primary_menu = header.querySelector("#primary-menu");
const burgerMenuToggle = header.querySelector("#burger-menu-toggle");
const submenuToggles = primary_menu.querySelectorAll(".menu-item-submenu-toggle");
burgerMenuToggle.addEventListener("click", function(e) {
e.preventDefault();
header.classList.toggle("nav-open");
burgerMenuToggle.toggleAttribute("aria-expanded");
gsap.from(primary_menu, {
opacity: 20,
y: "-100vh",
duration: 0.5,
ease: Power4.easeOut
});
});
document.addEventListener("focusin", (e) => {
const header2 = document.querySelector("#primary-header");
console.log(header2.contains(document.activeElement));
if (header2.classList.contains("nav-open") && !header2.contains(document.activeElement)) {
header2.classList.remove("nav-open");
burgerMenuToggle.setAttribute("aria-expanded", false);
burgerMenuToggle.focus();
}
}, true);
submenuToggles.forEach((button) => {
button.addEventListener("click", function(e) {
let isExpanded = button.getAttribute("aria-expanded") === "true";
button.setAttribute("aria-expanded", !isExpanded);
button.parentElement.querySelector(".sub-menu").classList.toggle("sub-menu-open");
});
});
}
// resources/js/app.js
console.log("menuInit");
console.log("menuIniteeeee");
window.addEventListener("load", function() {
menuInit();
});
})();

5710
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

49
package.json Normal file
View File

@ -0,0 +1,49 @@
{
"name": "tailpress",
"version": "3.0.0",
"description": "Boilerplate WordPress theme with Tailwind CSS.",
"author": "Jeffrey van Rossum",
"repository": {
"type": "git",
"url": "https://github.com/jeffreyvr/tailpress"
},
"theme_uri": "https://github.com/jeffreyvr/tailpress",
"author_uri": "https://vanrossum.dev",
"text_domain": "tailpress",
"license": "MIT",
"scripts": {
"production:css-app": "cross-env NODE_ENV=development tailwindcss -i ./resources/css/app.css -o ./css/app.css --postcss --minify",
"production:css-editor": "cross-env NODE_ENV=development tailwindcss -i ./resources/css/editor-style.css -o ./css/editor-style.css --postcss --minify",
"production:css-admin": "cross-env NODE_ENV=development tailwindcss -i ./resources/css/admin-style.css -o ./css/admin-style.css --postcss --minify",
"production:css-login": "cross-env NODE_ENV=development tailwindcss -i ./resources/css/login-style.css -o ./css/login-style.css --postcss --minify",
"production:js": "cross-env NODE_ENV=development ./node_modules/.bin/esbuild ./resources/js/app.js --bundle --outfile=./js/app.js --minify",
"dev:css-app": "cross-env NODE_ENV=development tailwindcss -i ./resources/css/app.css -o ./css/app.css --postcss",
"dev:css-editor": "cross-env NODE_ENV=development tailwindcss -i ./resources/css/editor-style.css -o ./css/editor-style.css --postcss",
"dev:css-admin": "cross-env NODE_ENV=development tailwindcss -i ./resources/css/admin-style.css -o ./css/admin-style.css --postcss",
"dev:css-login": "cross-env NODE_ENV=development tailwindcss -i ./resources/css/login-style.css -o ./css/login-style.css --postcss",
"dev:js": "cross-env NODE_ENV=development ./node_modules/.bin/esbuild ./resources/js/app.js --bundle --outfile=./js/app.js",
"watch:css-app": "cross-env NODE_ENV=development tailwindcss -i ./resources/css/app.css -o ./css/app.css --postcss --watch",
"watch:css-editor": "cross-env NODE_ENV=development tailwindcss -i ./resources/css/editor-style.css -o ./css/editor-style.css --postcss --watch",
"watch:css-admin": "cross-env NODE_ENV=development tailwindcss -i ./resources/css/admin-style.css -o ./css/admin-style.css --postcss --watch",
"watch:css-login": "cross-env NODE_ENV=development tailwindcss -i ./resources/css/login-style.css -o ./css/login-style.css --postcss --watch",
"watch:js": "cross-env NODE_ENV=development ./node_modules/.bin/esbuild ./resources/js/app.js --bundle --outfile=./js/app.js --watch",
"production": "cross-env NODE_ENV=production concurrently \"npm run production:css-app\" \"npm run production:css-editor\" \"npm run production:css-admin\" \"npm run production:css-login\" \"npm run production:js\"",
"dev": "cross-env NODE_ENV=development concurrently \"npm run dev:css-app\" \"npm run dev:css-admin\" \"npm run dev:css-editor\" \"npm run dev:css-login\" \"npm run dev:js\"",
"watch": "cross-env NODE_ENV=development concurrently \"npm run watch:css-app\" \"npm run watch:css-editor\" \"npm run watch:css-admin\" \"npm run watch:css-login\" \"npm run watch:js\"",
"browser-sync": "cross-env NODE_ENV=development browser-sync start --proxy \"tailpress.test\" --host=\"tailpress.test\" --no-inject-changes --files=\"./\"",
"watch-sync": "cross-env NODE_ENV=development concurrently \"npm run browser-sync\" \"npm run watch\""
},
"devDependencies": {
"@jeffreyvr/tailwindcss-tailpress": "^2.0.0",
"autoprefixer": "^10.4.0",
"browser-sync": "^2.26.14",
"concurrently": "^6.2.1",
"cross-env": "^6.0.3",
"esbuild": "^0.12.24",
"postcss": "^8.4.4",
"postcss-import": "^14.0.0",
"postcss-nested-ancestors": "^2.0.0",
"resolve-url-loader": "^3.1.2",
"tailwindcss": "^3.1.0"
}
}

16
page.php Normal file
View File

@ -0,0 +1,16 @@
<?php get_header(); ?>
<?php if (have_posts()) : ?>
<?php
while (have_posts()) :
the_post();
the_content();
?>
<?php endwhile; ?>
<?php endif; ?>
<?php get_footer();

8
postcss.config.js Normal file
View File

@ -0,0 +1,8 @@
module.exports = {
plugins: [
require('postcss-nested-ancestors'),
require('postcss-import'),
require('tailwindcss/nesting'),
require('tailwindcss')
]
}

View File

@ -0,0 +1,6 @@
/* body {
background: red !important;
} */
#menu-posts {
border-top: 1px solid rgba(255, 255, 255, 0.2) !important;
}

25
resources/css/app.css Normal file
View File

@ -0,0 +1,25 @@
@import 'tailwindcss/base';
@import 'tailwindcss/components';
@import 'tailwindcss/utilities';
@import 'custom.css';
/* ########### BASE ############ */
@import './base/typography.css';
/* ########### COMPONENTS ############ */
@import './components/cta.css';
@import './components/post-card.css';
@import './components/section-titling.css';
/* ########### LAYOUT ############ */
@import './layout/nav.css';
@import './layout/footer.css';
@import './layout/section.css';
@import './layout/gutenberg.css';
/* ########### BLOCKS ############ */
/* Home */
@import '../../template-blocks/home/home-header/home-header.css';
@import '../../template-blocks/home/latest-news/latest-news.css';

View File

@ -0,0 +1,4 @@
body {
font-family: 'Raleway', sans-serif;
@apply font-normal;
}

View File

View File

@ -0,0 +1,25 @@
.post-card {
@apply bg-white shadow-lg rounded-3xl;
&__thumbnail {
@apply rounded-t-3xl
h-[190px]
object-cover;
}
&__inner {
@apply p-8;
}
&__tag {
@apply bg-secondary-light
text-secondary
w-fit
px-4 py-1
rounded-xl
mb-4;
}
&__title {
@apply text-2xl font-bold mb-4 text-secondary;
line-height: 1.1;
}
}

View File

@ -0,0 +1,16 @@
.section_titling {
@apply text-center pb-8;
&__title {
@apply text-secondary
font-bold
text-xl
uppercase
tracking-widest;
}
&__subtitle {
@apply text-black
font-bold
text-4xl;
}
}

0
resources/css/custom.css Normal file
View File

View File

@ -0,0 +1,28 @@
@import "tailwindcss/components";
@import "tailwindcss/utilities";
body {
@apply font-sans;
}
.wp-block {
@apply max-w-screen-xl;
}
.wp-block[data-align="wide"] {
@apply max-w-screen-xl;
}
.wp-block[data-align="full"] {
@apply max-w-full;
}
.wp-block.alignfull {
@apply max-w-full;
}
.acf-block-component {
/* @apply bg-red-500; */
}
.acf-block-fields {
@apply max-w-screen-md mx-auto;
}

View File

View File

@ -0,0 +1,45 @@
article > *:not(.entry-content),
.entry-content > * {
@apply mx-auto max-w-content;
}
.entry-content,
.block-editor-block-list__layout {
h1 {
@apply text-2xl;
}
h2 {
@apply text-xl;
}
h3 {
@apply text-lg;
}
p,
ul,
ol {
a {
@apply text-blue-500 underline;
&:hover {
@apply no-underline;
}
}
@apply mb-8;
}
ul:not(.block-editor-block-variation-picker__variations) {
li {
@apply list-disc list-inside;
}
}
ol {
li {
@apply list-decimal list-inside;
}
}
}

View File

@ -0,0 +1,268 @@
.primary-menu-container {
@apply mx-auto
bg-primary
text-white
relative
h-fit
py-8
px-8
2xl:px-32
my-0;
nav#primary-menu-nav {
@apply max-w-screen-2xl w-full mx-auto;
}
.logo {
@apply mr-12
w-[190px]
xl:w-[222px];
}
#primary-menu {
@apply flex
flex-col
w-full
lg:flex-row
items-center
justify-around
lg:justify-end;
ul {
@apply lg:flex
gap-x-2
lg:gap-x-4
xl:gap-x-8
pr-0;
}
/* Highlight using list element */
li.current-page-parent > a,
li.current_page_item > a {
@apply font-medium
text-white
decoration-secondary
underline
underline-offset-8;
}
li.menu-item {
@apply font-medium
text-sm
text-center;
&:hover > a,
a:focus {
@apply cursor-pointer
underline
underline-offset-8
text-secondary;
}
a:focus {
text-decoration: none;
}
/* IF SUBMENU CHILD */
.menu-item-submenu-toggle {
&:hover,
&:focus {
@apply text-secondary;
}
@apply relative pr-4;
&:after {
@apply absolute right-0;
content: '▼';
position: absolute;
display: inline-block;
line-height: 0.5;
height: 10px;
top: calc(50% - 4px);
width: 10px;
margin-left: 20px;
transform-origin: center;
background-repeat: no-repeat;
background-size: contain;
transition: all 0.3s ease-out;
}
}
.menu-item-submenu-toggle[aria-expanded='false']:after {
transform: rotate(0deg);
}
.menu-item-submenu-toggle[aria-expanded='true']:after {
transform: rotate(180deg);
}
}
/* li.menu-item.menu-item-has-children:hover {
@screen lg {
.menu-item-submenu-toggle:after {
transform: rotate(180deg);
}
.sub-menu {
display: block;
}
}
} */
/* submenus */
li .sub-menu {
@apply bg-primary
p-6
mx-auto
lg:mx-0
static
lg:absolute;
z-index: 999;
display: none;
&.sub-menu-open {
display: block;
}
li {
@apply py-2 lg:text-left;
}
> a::after {
transform: translateY(-2px) rotate(-90deg);
content: '';
display: inline-block;
height: 10px;
width: 10px;
margin-left: 20px;
background-image: url('../resources/img/arrow_down_white.svg');
background-repeat: no-repeat;
background-size: contain;
transition: all 0.3s ease-out;
}
}
}
#secondary-menu {
@apply flex bg-white;
}
}
button#burger-menu-toggle {
@apply lg:hidden
absolute
right-10
-translate-y-1/2
z-50
top-1/2;
width: 26px;
height: 26px;
.menu-toggle-bar {
@apply top-1/2
absolute
block
right-0
w-full
h-[2px]
/* bg-red-400 */
bg-white;
margin-top: -1px;
transition: all 0.3s ease;
&.menu-toggle-bar--top {
transform: translate(0, -7px);
}
&.menu-toggle-bar--middle {
}
&.menu-toggle-bar--bottom {
transform: translate(0, 7px);
}
.nav-open & {
@apply bg-secondary;
&.menu-toggle-bar--top {
transform: translate(0, 0) rotate(45deg);
}
&.menu-toggle-bar--middle {
opacity: 0;
}
&.menu-toggle-bar--bottom {
transform: translate(0, 0) rotate(-45deg);
}
}
}
&:hover {
path {
@apply fill-secondary;
}
}
}
/* RESPONSIVE */
@media (max-width: 960px) {
.primary-menu-container {
#primary-menu {
@apply bg-primary
mt-0
left-0
z-40
absolute
hidden;
/* transition: all 0.3s ease-out;
transform: translateY(-120vh); */
min-height: 100vh;
height: fit-content;
top: 0;
width: 100vw;
/* Rendu conditionnel de l'élément si contenu dans une classe de parent (nesting inversé) */
.nav-open & {
@apply flex;
}
> ul {
@apply max-w-xs
mx-auto;
/* min-height: 96vh; */
padding-top: 5vh;
}
li.menu-item {
@apply mt-0
text-center
text-white
font-medium
py-8
text-lg
!block
pb-0;
.sub-menu li {
@apply text-sm;
}
}
}
}
/* BURGER MENU */
body:has(.nav-open) {
@apply max-h-screen
overflow-hidden;
/* #content,
footer,
.wpml-ls-statics-footer {
@apply !hidden;
} */
}
.cta_plain_secondary,
.switch_language {
/* @apply self-end; */
}
}
@media (max-width: 960px) and (hover: none) {
/* ul {
@apply w-max mx-auto;
} */
.primary-menu-container {
li.menu-item {
@apply mx-auto
/* !text-left */;
}
}
}

View File

View File

@ -0,0 +1,30 @@
body {
/* @apply bg-primary; */
}
#login h1 a,
.login h1 a {
background-image: url("../resources/img/logo_client.svg");
height: 100px;
width: 300px;
background-size: 300px 100px;
background-repeat: no-repeat;
padding-bottom: 10px;
}
#wp-submit {
@apply bg-primary border-primary;
}
#nav a,
#backtoblog a {
/* color: var(--red) !important; */
@apply text-primary;
}
#loginform {
border: none;
}
.wp-pwd span {
@apply text-primary;
/* color: var(--red) !important; */
}

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="60.566" height="60.012" viewBox="0 0 60.566 60.012">
<path id="Tracé_766" data-name="Tracé 766" d="M0,0,30.42,60.012,60.566,0Z" transform="translate(0 0)" fill="#fff"/>
</svg>

After

Width:  |  Height:  |  Size: 227 B

View File

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="14.52" height="27.04" viewBox="0 0 14.52 27.04">
<path id="Tracé_139" data-name="Tracé 139" d="M24.565.354,12.459,12.46.354.354" transform="translate(1.061 25.979) rotate(-90)" fill="none" stroke="#fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"/>
</svg>

After

Width:  |  Height:  |  Size: 327 B

View File

@ -0,0 +1,6 @@
<svg xmlns="http://www.w3.org/2000/svg" width="329.871" height="329.87" viewBox="0 0 329.871 329.87">
<g id="Groupe_784" data-name="Groupe 784" transform="translate(19045.936 1289.935)">
<line id="Ligne_43" data-name="Ligne 43" y1="303" x2="303" transform="translate(-19032.5 -1276.5)" fill="none" stroke="#fff" stroke-linecap="round" stroke-width="19"/>
<line id="Ligne_44" data-name="Ligne 44" x1="303" y1="303" transform="translate(-19032.5 -1276.5)" fill="none" stroke="#fff" stroke-linecap="round" stroke-width="19"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 547 B

6
resources/js/app.js Normal file
View File

@ -0,0 +1,6 @@
import menuInit from './header';
console.log('menuInit');
console.log('menuIniteeeee');
window.addEventListener('load', function () {
menuInit();
});

62
resources/js/header.js Normal file
View File

@ -0,0 +1,62 @@
export default function menuInit() {
let main_navigation =
document.querySelector('#primary-menu');
const header = document.querySelector('#primary-header');
const primary_menu =
header.querySelector('#primary-menu');
const burgerMenuToggle = header.querySelector(
'#burger-menu-toggle'
);
const submenuToggles = primary_menu.querySelectorAll(
'.menu-item-submenu-toggle'
);
// #### Open/close burger nav
burgerMenuToggle.addEventListener('click', function (e) {
e.preventDefault();
header.classList.toggle('nav-open');
burgerMenuToggle.toggleAttribute('aria-expanded');
gsap.from(primary_menu, {
opacity: 20,
y: '-100vh',
duration: 0.5,
ease: Power4.easeOut,
});
});
// #### Close nav when reaching the end of the menu with tab
document.addEventListener(
'focusin',
(e) => {
const header = document.querySelector(
'#primary-header'
);
console.log(header.contains(document.activeElement));
if (
header.classList.contains('nav-open') &&
!header.contains(document.activeElement)
) {
header.classList.remove('nav-open');
burgerMenuToggle.setAttribute(
'aria-expanded',
false
);
burgerMenuToggle.focus();
}
},
true
);
submenuToggles.forEach((button) => {
button.addEventListener('click', function (e) {
let isExpanded =
button.getAttribute('aria-expanded') === 'true';
button.setAttribute('aria-expanded', !isExpanded);
button.parentElement
.querySelector('.sub-menu')
.classList.toggle('sub-menu-open');
});
});
}

8
safelist.txt Normal file
View File

@ -0,0 +1,8 @@
alignfull
alignwide
alignnone
aligncenter
alignright
wp-block-button
wp-caption
wp-caption-text

BIN
screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 682 KiB

28
single.php Normal file
View File

@ -0,0 +1,28 @@
<?php get_header(); ?>
<div class="container my-8 mx-auto">
<?php if ( have_posts() ) : ?>
<?php
while ( have_posts() ) :
the_post();
?>
<?php get_template_part( 'template-parts/content', 'single' ); ?>
<?php
// If comments are open or we have at least one comment, load up the comment template.
if ( comments_open() || get_comments_number() ) :
comments_template();
endif;
?>
<?php endwhile; ?>
<?php endif; ?>
</div>
<?php
get_footer();

7
style.css Normal file
View File

@ -0,0 +1,7 @@
/*
Theme Name: Homegrade_Theme
Author: Deligraph
Author URI: https://deligraph.com/
Version: 1.0.0
*/

36
tailwind.config.js Normal file
View File

@ -0,0 +1,36 @@
const theme = require('./theme.json');
const tailpress = require("@jeffreyvr/tailwindcss-tailpress");
module.exports = {
content: [
'./*.php',
'./**/*.php',
'./resources/css/*.css',
'./resources/js/*.js',
'./safelist.txt'
],
theme: {
container: {
padding: {
DEFAULT: '1rem',
sm: '2rem',
lg: '0rem'
},
},
extend: {
colors: tailpress.colorMapper(tailpress.theme('settings.color.palette', theme)),
fontSize: tailpress.fontSizeMapper(tailpress.theme('settings.typography.fontSizes', theme))
},
screens: {
'xs': '480px',
'sm': '600px',
'md': '782px',
'lg': tailpress.theme('settings.layout.contentSize', theme),
'xl': tailpress.theme('settings.layout.wideSize', theme),
'2xl': '1440px'
}
},
plugins: [
tailpress.tailwind
]
};

View File

@ -0,0 +1,21 @@
{
"name": "acf/home-header",
"title": "Home | Section d'accueil",
"category": "homegrade-pages",
"multiple": false,
"icon": {
"foreground": "#DF1E1E",
"src": "schedule"
},
"keywords": [
"Couverture",
"home",
"Accueil",
"Section d'accueil",
"Header"
],
"acf": {
"mode": "auto",
"renderTemplate": "home-header.php"
}
}

View File

@ -0,0 +1,19 @@
<?php
$home_header = get_field('home_header_datas');
?>
<section class="home-header header_top">
<h1>qsdqsdd</h1>
<div class="home-header__content">
<h1 class="home-header__title">
<?php echo $home_header['title'] ?>
</h1>
<a class="cta" href="<?php echo $home_header['cta']['url'] ?>">
<?php echo $home_header['cta']['title'] ?>
</a>
</div>
<img class="home-header__cover" src='<?php echo $home_header['cover_illustration']['url'] ?>' alt=''>
</section>

View File

@ -0,0 +1,20 @@
{
"name": "acf/latest-news",
"title": "Home | Dernières News",
"category": "homegrade-pages",
"multiple": false,
"icon": {
"foreground": "#DF1E1E",
"src": "welcome-widgets-menus"
},
"keywords": [
"News",
"dernières",
"actus",
"latest"
],
"acf": {
"mode": "auto",
"renderTemplate": "latest-news.php"
}
}

View File

@ -0,0 +1,14 @@
.section_latest_news {
.section_titling {
@apply max-w-md mx-auto;
}
.articles_container {
@apply grid
grid-cols-4
max-w-screen-2xl
px-8
py-16
gap-8
mx-auto;
}
}

View File

@ -0,0 +1,43 @@
<?php
$block_titling_datas = get_field('block_titling_datas');
?>
<section class="section_latest_news">
<div class="section_titling">
<h2 class="section_titling__title"><?php echo $block_titling_datas['title'] ?></h2>
<h3 class="section_titling__subtitle"><?php echo $block_titling_datas['subtitle'] ?></h3>
</div>
<div class="articles_container">
<?php
$recent_posts = wp_get_recent_posts(array(
'post_type' => 'post',
'numberposts' => 4, // Number of recent posts thumbnails to display
'post_status' => 'publish' // Show only the published posts
));
foreach ($recent_posts as $key => $post) {
$post_taxonomies = wp_get_post_terms($post['ID'], array('tag', 'category'));
$post_thumbnail = get_the_post_thumbnail($post['ID'], 'full', array('class' => 'post-card__thumbnail'));
$post_tags = get_the_tags($post['ID']);
get_template_part(
'template-components/post-card',
null,
array(
'card_variant' => 'activite',
'post_ID' => $post['ID'],
'post_title' => $post['post_title'],
'post_thumbnail' => $post_thumbnail,
'activite_details' => $activite_details,
'post_taxonomies' => $post_taxonomies,
'post_tags' => $post_tags,
)
);
}
?>
</div>
</section>

View File

@ -0,0 +1,25 @@
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header mb-4">
<?php the_title( sprintf( '<h1 class="entry-title text-2xl lg:text-5xl font-extrabold leading-tight mb-1"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h1>' ); ?>
<time datetime="<?php echo get_the_date( 'c' ); ?>" itemprop="datePublished" class="text-sm text-gray-700"><?php echo get_the_date(); ?></time>
</header>
<div class="entry-content">
<?php the_content(); ?>
<?php
wp_link_pages(
array(
'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'tailpress' ) . '</span>',
'after' => '</div>',
'link_before' => '<span>',
'link_after' => '</span>',
'pagelink' => '<span class="screen-reader-text">' . __( 'Page', 'tailpress' ) . ' </span>%',
'separator' => '<span class="screen-reader-text">, </span>',
)
);
?>
</div>
</article>

View File

@ -0,0 +1,41 @@
<article id="post-<?php the_ID(); ?>" <?php post_class( 'mb-12' ); ?>>
<header class="entry-header mb-4">
<?php the_title( sprintf( '<h2 class="entry-title text-2xl md:text-3xl font-extrabold leading-tight mb-1"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' ); ?>
<time datetime="<?php echo get_the_date( 'c' ); ?>" itemprop="datePublished" class="text-sm text-gray-700"><?php echo get_the_date(); ?></time>
</header>
<?php if ( is_search() || is_archive() ) : ?>
<div class="entry-summary">
<?php the_excerpt(); ?>
</div>
<?php else : ?>
<div class="entry-content">
<?php
/* translators: %s: Name of current post */
the_content(
sprintf(
__( 'Continue reading %s', 'tailpress' ),
the_title( '<span class="screen-reader-text">"', '"</span>', false )
)
);
wp_link_pages(
array(
'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'tailpress' ) . '</span>',
'after' => '</div>',
'link_before' => '<span>',
'link_after' => '</span>',
'pagelink' => '<span class="screen-reader-text">' . __( 'Page', 'tailpress' ) . ' </span>%',
'separator' => '<span class="screen-reader-text">, </span>',
)
);
?>
</div>
<?php endif; ?>
</article>

View File

@ -0,0 +1,37 @@
<?php
$post_ID = $args['post_ID'];
$card_variant = $args['card_variant'];
$post_thumbnail = $args['post_thumbnail'];
$post_title = $args['post_title'];
$post_tags = $args['post_tags'];
?>
<div class="post-card <?php echo $card_variant ? 'post-card--' . $card_variant : '' ?> ">
<?php echo $post_thumbnail ?>
<div class="post-card__inner">
<p class="post-card__tag"><?php echo $post_tags[0]->name ?></p>
<h3 class="post-card__title"><?php echo $post_title ?></h3>
<p class="post-card__excerpt"><?php echo $activite_details['description'] ?> </p>
<a href="#" class="cta cta--read-more ">
<!-- cta-read-more -->
<span><?php echo __("Lire l'article", 'deligraph-theme') ?></span>
<img class="icon" src='<?php echo get_template_directory_uri() ?>/resources/svg/arrow-read-more.svg' alt=''>
</a>
</div>
</div>

141
theme.json Normal file
View File

@ -0,0 +1,141 @@
{
"version": 1,
"settings": {
"layout": {
"contentSize": "960px",
"wideSize": "1280px"
},
"color": {
"defaultPalette": false,
"custom": false,
"palette": [
{
"name": "Primaire",
"slug": "primary",
"color": "#2F0154"
},
{
"name": "Secondaire",
"slug": "secondary",
"color": "#DF1E1E"
},
{
"name": "Secondaire Light",
"slug": "secondary-light",
"color": "#FFEDEC"
},
{
"name": "Gris",
"slug": "gray",
"color": "rgb(239, 239, 239, 0.6)"
},
{
"name": "Gris Foncé",
"slug": "gray-dark",
"color": "#767575"
},
{
"name": "Acoustique / Copropriétés",
"slug": "acoustique-coproprietes",
"color": "#245EF2"
},
{
"name": "Acoustique / Copropriétés | Light",
"slug": "acoustique-coproprietes-light",
"color": "#DFF1FF"
},
{
"name": "Énergies / Urbanisme",
"slug": "energies-urbanisme",
"color": "#027E50"
},
{
"name": "Énergies / Urbanisme | Light",
"slug": "energies-urbanisme-light",
"color": "#E3FFF0"
},
{
"name": "Isolation / Quotidien",
"slug": "isolation-quotidien",
"color": "#C24503"
},
{
"name": "Isolation / Quotidien | Light",
"slug": "isolation-quotidien-light",
"color": "#FFFBEC"
},
{
"name": "Patrimoine / Rénovation",
"slug": "patrimoine-renovation",
"color": "#8B2FF7"
},
{
"name": "Patrimoine / Rénovation | Light",
"slug": "patrimoine-renovation-light",
"color": "#FFE5FD"
},
{
"name": "Location",
"slug": "location",
"color": "#DF002B"
},
{
"name": "Location | Light",
"slug": "location-light",
"color": "#FEE2E7"
}
]
},
"typography": {
"fontFamilies": [
{
"name": "Raleway",
"slug": "raleway",
"fontFace": [
{
"fontFamily": "Raleway",
"fontStretch": "auto",
"fontStyle": "auto",
"fontWeight": "100 900",
"src": [
"file:./resources/fonts/Raleway-VariableFont_wght.woff2"
]
}
]
}
],
"fontSizes": [
{
"name": "Small",
"slug": "small",
"size": "0.875rem"
},
{
"slug": "regular",
"name": "Regular",
"size": "1.5rem"
},
{
"slug": "large",
"name": "Large",
"size": "1.125rem"
},
{
"slug": "xl",
"name": "XL",
"size": "1.25rem"
},
{
"slug": "xxl",
"name": "2XL",
"size": "1.5rem"
},
{
"slug": "xxxl",
"name": "3XL",
"size": "1.875rem"
}
]
}
}
}