replugin the real starter to git and adding page.php

This commit is contained in:
Antoine 2023-03-16 15:53:19 +01:00
parent b138f60fc9
commit 2099113303
17 changed files with 169 additions and 91 deletions

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;
}

View File

@ -373,14 +373,17 @@ body {
max-width: 1280px max-width: 1280px
} }
.wp-block[data-align=wide] { .wp-block[data-align="wide"] {
max-width: 1280px max-width: 1280px
} }
.wp-block[data-align=full] { .wp-block[data-align="full"] {
max-width: 100% max-width: 100%
} }
.acf-block-component {
}
@media (min-width: 782px) { @media (min-width: 782px) {
.md\:my-6 { .md\:my-6 {
margin-top: 1.5rem; margin-top: 1.5rem;
@ -448,4 +451,4 @@ body {
font-size: 3rem; font-size: 3rem;
line-height: 1 line-height: 1
} }
} }

View File

@ -57,7 +57,7 @@ function tailpress_enqueue_scripts()
function enqueue_gutenberg_back_styles() function enqueue_gutenberg_back_styles()
{ {
// wp_enqueue_style( 'tailpress_back', tailpress_asset( 'css/app.css' ), array() ); wp_enqueue_style('tailpress_back', tailpress_asset('css/app.css'), array());
} }
add_action('enqueue_block_editor_assets', 'enqueue_gutenberg_back_styles'); add_action('enqueue_block_editor_assets', 'enqueue_gutenberg_back_styles');
@ -131,6 +131,8 @@ add_filter('nav_menu_submenu_css_class', 'tailpress_nav_menu_add_submenu_class',
require_once(__DIR__ . '/includes/blocks.php'); require_once(__DIR__ . '/includes/blocks.php');
require_once(__DIR__ . '/includes/post_types.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/taxonomy.php');
// require_once( __DIR__ . '/includes/errorlog.php'); // require_once( __DIR__ . '/includes/errorlog.php');
// require_once( __DIR__ . '/includes/logos.php'); // require_once( __DIR__ . '/includes/logos.php');

28
includes/admin.php Normal file
View File

@ -0,0 +1,28 @@
<?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');

View File

@ -2,20 +2,21 @@
// ##### Blocks Category 🡒 Déclaration de la catégorie de blocks custom // ##### Blocks Category 🡒 Déclaration de la catégorie de blocks custom
function client_add_block_categories( $categories ) { function client_add_block_categories($categories)
{
return array_merge( return array_merge(
[
[ [
[ 'slug' => 'client_blocks',
'slug' => 'client_blocks', 'title' => __('Mon titre ', 'client-blocks'),
'title' => __( 'Mon titre ', 'client-blocks' ), 'icon' => 'heart',
'icon' => 'heart',
],
], ],
$categories ],
$categories
); );
} }
add_action( 'block_categories_all', 'client_add_block_categories', 10, 2 ); add_action('block_categories_all', 'client_add_block_categories', 10, 2);
// ##### Blocks 🡒 Déclaration des blocks acf custom // ##### Blocks 🡒 Déclaration des blocks acf custom
@ -29,7 +30,7 @@ function acf_custom_client_blocks_init()
'name' => 'home_header', 'name' => 'home_header',
'title' => __("Home — Section d'accueil"), 'title' => __("Home — Section d'accueil"),
'description' => __("Brique pour la section d'acccueil"), 'description' => __("Brique pour la section d'acccueil"),
'render_template' => 'template-parts/blocks/home/home_header/home_header.php', 'render_template' => 'template-blocks/home/home_header/home_header.php',
'category' => 'client_blocks', 'category' => 'client_blocks',
'multiple' => false, 'multiple' => false,
'mode' => 'auto', 'mode' => 'auto',
@ -51,9 +52,9 @@ function acf_custom_client_blocks_init()
// ##### Home 🡒 Latest Articles // ##### Home 🡒 Latest Articles
acf_register_block_type(array( acf_register_block_type(array(
'name' => 'latest_articles', 'name' => 'latest_articles',
'title' => __("Home — Derniers Articles"), 'title' => __("Derniers Articles"),
'description' => __("Brique pour afficher les derniers articles publiés sur le site"), 'description' => __("Brique pour afficher les derniers articles publiés sur le site"),
'render_template' => 'template-parts/blocks/home/latest_articles/latest_articles.php', 'render_template' => 'template-blocks/generics/latest-post-query.php',
'category' => 'client_blocks', 'category' => 'client_blocks',
'multiple' => false, 'multiple' => false,
'mode' => 'auto', 'mode' => 'auto',
@ -66,7 +67,6 @@ function acf_custom_client_blocks_init()
// }, // },
)); ));
} }
} }
add_action('acf/init', 'acf_custom_client_blocks_init'); add_action('acf/init', 'acf_custom_client_blocks_init');
@ -78,8 +78,4 @@ add_action('acf/init', 'acf_custom_client_blocks_init');
// function block_newsfeed_add_editor_styles() { // function block_newsfeed_add_editor_styles() {
// add_editor_style( get_stylesheet_directory_uri() . '/template-parts/blocks/editor.css' ); // add_editor_style( get_stylesheet_directory_uri() . '/template-parts/blocks/editor.css' );
// } // }
// add_action( 'admin_init', 'block_newsfeed_add_editor_styles' ); // add_action( 'admin_init', 'block_newsfeed_add_editor_styles' );
?>

View File

@ -1,20 +1,34 @@
<?php <?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 // AJOUT D'UN ESPACE LOGO CUSTOM
// ############################# // #############################
function add_logo_customizer_settings($wp_customize) { // function add_logo_customizer_settings($wp_customize)
$wp_customize->add_setting('logo_semlex_dark'); // {
// $wp_customize->add_setting('logo_semlex_dark');
// Add a control to upload the hover logo // // Add a control to upload the hover logo
$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'logo_semlex_dark', array( // $wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'logo_semlex_dark', array(
'label' => 'Logo Semlex Sombre', // 'label' => 'Logo Semlex Sombre',
'section' => 'title_tagline', //this is the section where the custom-logo from WordPress is // 'section' => 'title_tagline', //this is the section where the custom-logo from WordPress is
'settings' => 'logo_semlex_dark', // 'settings' => 'logo_semlex_dark',
'priority' => 8 // show it just below the custom-logo // 'priority' => 8 // show it just below the custom-logo
))); // )));
} // }
add_action('customize_register', 'add_logo_customizer_settings');
// add_action('customize_register', 'add_logo_customizer_settings');

View File

@ -1,12 +1,5 @@
<?php <?php
// Removing Articles from the admin bar
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' );
// #### POST TYPES // #### POST TYPES
@ -33,5 +26,4 @@ function create_posttype() {
} }
add_action( 'init', 'create_posttype' ); add_action( 'init', 'create_posttype' );

View File

@ -14,16 +14,19 @@
"scripts": { "scripts": {
"production:css-app": "cross-env NODE_ENV=development tailwindcss -i ./resources/css/app.css -o ./css/app.css --postcss --minify", "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-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:js": "cross-env NODE_ENV=development ./node_modules/.bin/esbuild ./resources/js/app.js --bundle --outfile=./js/app.js --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-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-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:js": "cross-env NODE_ENV=development ./node_modules/.bin/esbuild ./resources/js/app.js --bundle --outfile=./js/app.js", "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-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-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:js": "cross-env NODE_ENV=development ./node_modules/.bin/esbuild ./resources/js/app.js --bundle --outfile=./js/app.js --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:js\"", "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:js\"",
"dev": "cross-env NODE_ENV=development concurrently \"npm run dev:css-app\" \"npm run dev:css-editor\" \"npm run dev: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:js\"",
"watch": "cross-env NODE_ENV=development concurrently \"npm run watch:css-app\" \"npm run watch:css-editor\" \"npm run watch: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:js\"",
"browser-sync": "cross-env NODE_ENV=development browser-sync start --proxy \"tailpress.test\" --host=\"tailpress.test\" --no-inject-changes --files=\"./\"", "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\"" "watch-sync": "cross-env NODE_ENV=development concurrently \"npm run browser-sync\" \"npm run watch\""
}, },
@ -40,4 +43,4 @@
"resolve-url-loader": "^3.1.2", "resolve-url-loader": "^3.1.2",
"tailwindcss": "^3.1.0" "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();

View File

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

View File

@ -18,4 +18,4 @@
/* ########### BLOCKS ############ */ /* ########### BLOCKS ############ */
/* Home */ /* Home */
@import "../../template-parts/blocks/home/home_header/home_header.css"; @import "../../template-blocks/home/home_header.css";

View File

@ -2,17 +2,27 @@
@import "tailwindcss/utilities"; @import "tailwindcss/utilities";
body { body {
@apply font-sans; @apply font-sans;
} }
.wp-block{ .wp-block {
@apply max-w-screen-xl; @apply max-w-screen-xl;
} }
.wp-block[data-align=wide] { .wp-block[data-align="wide"] {
@apply max-w-screen-xl; @apply max-w-screen-xl;
} }
.wp-block[data-align=full] { .wp-block[data-align="full"] {
@apply max-w-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

@ -0,0 +1,36 @@
<?php
// $latest_posts_details = get_field('latest_posts_details');
?>
<section class="section_latest_news">
<h2 class="section_title">Lastest Articles</h2>
<div class="articles_container">
<?php
$recent_posts = wp_get_recent_posts(array(
'numberposts' => 4, // Number of recent posts thumbnails to display
'post_status' => 'publish' // Show only the published posts
));
foreach ($recent_posts as $key => $post) {
$post_date = date_i18n('j F Y', strtotime($post['post_date']));
?>
<div class="article_card">
<p>qsdqsd</p>
<?php echo get_the_post_thumbnail($post['ID'], 'full', array('class' => 'article_thumbnail')); ?>
<div class="card_inner">
<h4 class="post_date"> <?php echo $post_date ?> </h4>
<h3 class="post_title"><?php echo $post['post_title'] ?></h3>
<p><?php echo $post['post_excerpt'] ?></p>
</div>
</div>
<?php
}
?>
</div>
</section>

View File

@ -1,35 +0,0 @@
<?php
// $latest_posts_details = get_field('latest_posts_details');
?>
<section class="section_latest_news">
<h2 class="section_title">Lastest Articles</h2>
<div class="articles_container">
<?php
$recent_posts = wp_get_recent_posts(array(
'numberposts' => 4, // Number of recent posts thumbnails to display
'post_status' => 'publish' // Show only the published posts
));
foreach ($recent_posts as $key => $post) {
$post_date = date_i18n('j F Y', strtotime($post['post_date']));
?>
<div class="article_card">
<?php echo get_the_post_thumbnail( $post['ID'], 'full',array('class' => 'article_thumbnail') ); ?>
<div class="card_inner">
<h4 class="post_date"> <?php echo $post_date ?> </h4>
<h3 class="post_title"><?php echo $post['post_title'] ?></h3>
<p><?php echo $post['post_excerpt'] ?></p>
</div>
</div>
<?php
}
?>
</div>
</section>