From c0e1393ad4be0bb2aebc778cb174e6054f02e1c9 Mon Sep 17 00:00:00 2001 From: EmmericIsaiah <47565274+EmmericIsaiah@users.noreply.github.com> Date: Thu, 25 Jun 2020 18:12:05 +0200 Subject: [PATCH] first commit --- assets/css/source.scss | 179 ++++++++-------------------- footer.php | 28 +++-- form.php | 76 ++++++++++++ functions.php | 151 +++++++---------------- header.php | 94 +++++++-------- index.php | 17 ++- js/app.js | 37 +++--- js/backup-prov-apps.js | 68 +++++++++++ sidebar.php | 2 + style.css | 10 +- template-parts/content.php | 24 ++-- template-parts/notification-bar.php | 28 ----- 12 files changed, 335 insertions(+), 379 deletions(-) create mode 100644 form.php create mode 100644 js/backup-prov-apps.js delete mode 100644 template-parts/notification-bar.php diff --git a/assets/css/source.scss b/assets/css/source.scss index 7e1cb15..abef977 100644 --- a/assets/css/source.scss +++ b/assets/css/source.scss @@ -1,28 +1,29 @@ // Bootstrap @import 'node_modules/bootstrap/scss/bootstrap'; @import url(https://fonts.googleapis.com/css2?family=Nunito:wght@200;300;700&display=swap); -@import 'node_modules/hover.css/scss/hover'; // Color Variables $color1-main: #ab394a; $color2-secondary: #eeeeee; $color3-hover: #c6e4ce; -$red1: #cb9ba3; -$red2: #c68792; -$red3: #ae99ae; // Font Variables $main-font: 'Nunito'; - - //Ici, il faut aussi variabiliser la graisse de police // General styling -article.home-article .entry-header .entry-title { - padding-left: 18px; - padding-top: 15px; - font-size: 30px; - font-weight: bold; - color: white; +h2.entry-title { + font-family: $main-font; + font-weight: 700; + padding: 1em; + a { + &:hover{ + text-decoration: none; + font-size: 40px; + } + &:focus{ + + } + } } p { @@ -30,10 +31,28 @@ p { padding: 1em; } -//General style, body -body { - overflow-x: hidden; +//ACF +.acf-field-5ed77549450e8{ + +} +.acf-field-5ed77561450e9{ + display: none; +} +.acf-field-5ed7705947aee{ + display: none; +} +.acf-field-5ed77578450ea{ + display: none; +} +.acf-field-5ed7769c0e7a9{ + display: none; } +input.acf-button.button.button-primary.button-large { + display: block; +} +//End ACF + + //Menus @@ -98,7 +117,7 @@ div#menu-container { .main-navigation div.nav-menu > ul { display: none; } - + .main-navigation ul.nav-menu.toggled-on, .menu-toggle { display: inline-block; @@ -107,7 +126,7 @@ div#menu-container { // CSS to use on mobile devices @media screen and (min-width: 800px) { - + .main-navigation ul.nav-menu, .main-navigation div.nav-menu > ul { display: inline-block !important; @@ -191,69 +210,18 @@ div#menu-container { .menu-toggle { display: none; } - - } - - + } /* Home */ -a#home-article-permalink { - text-decoration: none; -} - -article.home-article { - p { - color: white; - } - &.imagetext { - background-color: $red1; - } - &.text { - background-color: $red2; - img { - display:none; - } - } - &.image { - background-color: $red3; - p { - display: none; - } - } -} - -/*Notifications*/ - -h2#notification-title { - font-weight: 700; -} - -.row.notification-bar { - background-color: cadetblue; - color: white; -} - -a#cross-notification { - color: white; - font-weight: 700; - &:focus { - color: transparent; - } - &:hover { - color: transparent; - } -} - /*Logo*/ /*!! à améliorer en sass*/ img.attachment-post-thumbnail.size-post-thumbnail.wp-post-image { - width: 100%; - height: auto; - padding: 20px; + width: 100%; + height: auto; } img.custom-logo { @@ -304,10 +272,11 @@ section.widget { //End sidebar -section#grid-container article.home-article { - width: 28%; +section#grid-container article { + width: 30%; margin-left: 2em; margin-top: 2em; + background-color: #eaeaea; } .site-info { @@ -319,36 +288,32 @@ section#grid-container article.home-article { //Grid Responsive - @media screen and (max-width: 1200px) { - section#grid-container article.home-article { - width: 45%; + section#grid-container article { + width: 30%; margin-left: 1em; margin-top: 1em; + background-color: #eaeaea; } } @media screen and (max-width: 768px) { - section#grid-container article.home-article { + section#grid-container article { width: 100%; margin-left: 1em; margin-top: 1em; margin-right: 1em; } - #navdesktop { - display: none; - } } -@media screen and (min-width: 768px) { - #navmobile { - display: none; +@media screen and (max-width: 1200px) { + aside#secondary { + } } - /* -------------------------------------------------------------------------- */ /* 10. Blocks @@ -1086,49 +1051,3 @@ figure.wp-block-table.is-style-stripes { .wp-block-latest-posts.has-dates:not(.is-grid) li:first-child { margin-top: 0; } - -//hover effects - - -/* Bounce To Right */ -.hvr-bounce-to-right { - display: inline-block; - vertical-align: middle; - -webkit-transform: perspective(1px) translateZ(0); - transform: perspective(1px) translateZ(0); - box-shadow: 0 0 1px rgba(0, 0, 0, 0); - position: relative; - -webkit-transition-property: color; - transition-property: color; - -webkit-transition-duration: 0.5s; - transition-duration: 0.5s; -} -.hvr-bounce-to-right:before { - content: ""; - position: absolute; - z-index: -1; - top: 0; - left: 0; - right: 0; - bottom: 0; - background: $color1-main; - -webkit-transform: scaleX(0); - transform: scaleX(0); - -webkit-transform-origin: 0 50%; - transform-origin: 0 50%; - -webkit-transition-property: transform; - transition-property: transform; - -webkit-transition-duration: 0.5s; - transition-duration: 0.5s; - -webkit-transition-timing-function: ease-out; - transition-timing-function: ease-out; -} -.hvr-bounce-to-right:hover, .hvr-bounce-to-right:focus, .hvr-bounce-to-right:active { - color: white; -} -.hvr-bounce-to-right:hover:before, .hvr-bounce-to-right:focus:before, .hvr-bounce-to-right:active:before { - -webkit-transform: scaleX(1); - transform: scaleX(1); - -webkit-transition-timing-function: cubic-bezier(0.52, 1.64, 0.37, 0.66); - transition-timing-function: cubic-bezier(0.52, 1.64, 0.37, 0.66); -} \ No newline at end of file diff --git a/footer.php b/footer.php index 958bcd2..0c7986e 100644 --- a/footer.php +++ b/footer.php @@ -12,19 +12,21 @@ ?> diff --git a/form.php b/form.php new file mode 100644 index 0000000..0a59572 --- /dev/null +++ b/form.php @@ -0,0 +1,76 @@ + +//présentation du formulaire en front +public function output_shortcode() { + ob_start(); + + if ( ! function_exists( 'acf_form' ) ) { + return ob_get_clean(); + } + + // User is currently filling the form, we display it. + if ( ! $this->current_multiform_is_finished() ) { + $this->output_acf_form( [ + 'post_type' => $this->post_type, + ] ); + + // Form has been filled entirely, we display a thanks message. + } else { + _e( 'Thanks for your submission, we will get back to you very soon!' ); + } + + return ob_get_clean(); +} + +private function output_acf_form( $args = [] ) { + $requested_post_id = $this->get_request_post_id(); + $requested_step = $this->get_request_step(); + + $args = wp_parse_args( + $args, + [ + 'post_id' => $requested_post_id, + 'step' => 'new_post' === $requested_post_id ? 1 : $requested_step, + 'post_type' => 'post', + 'post_status' => 'publish', + ] + ); + + +//créer ou éditer un post + + $submit_label = $args['step'] < count( $this->metabox_ids ) ? __( 'Next step' ) : __( 'Finish' ); + $current_step_metaboxes = ( $args['post_id'] !== 'new_post' && $args['step'] > 1 ) ? $this->metabox_ids[ (int) $args['step'] - 1 ] : $this->metabox_ids[0]; + + acf_form( + [ + 'id' => $this->id, + 'post_id' => $args['post_id'], + 'new_post' => [ + 'post_type' => $args['post_type'], + 'post_status' => $args['post_status'], + ], + 'field_groups' => $current_step_metaboxes, + 'submit_value' => $submit_label, + 'html_after_fields' => $this->output_hidden_fields( $args ), + 'uploader' => 'basic', + ] + ); +} + + +//token aléatoire qui sert de sécurité + +public function process_acf_form( $post_id ) { + if ( is_admin() || ! isset( $_POST['ame-multiform-id'] ) || $_POST['ame-multiform-id'] !== $this->id ) { + return; + } + + $current_step = $this->get_request_step(); + + if ( $current_step === 1 ) { + $token = wp_generate_password( rand( 10, 20 ), false, false ); + update_post_meta( (int) $post_id, 'secret_token', $token ); + } + + ... +} \ No newline at end of file diff --git a/functions.php b/functions.php index 7f53983..340edca 100644 --- a/functions.php +++ b/functions.php @@ -139,7 +139,50 @@ function test_widgets_init() { } add_action( 'widgets_init', 'test_widgets_init' ); +function test_widgets_init2() { + register_sidebar( + array( + 'name' => esc_html__( 'Footer-1', 'test1' ), + 'id' => 'footer-1', + 'description' => esc_html__( 'Add widgets here.', 'test1' ), + 'before_widget' => '
', + 'after_widget' => '
', + 'before_title' => '

', + 'after_title' => '

', + ) + ); +} +add_action( 'widgets_init', 'test_widgets_init2' ); +function test_widgets_init3() { + register_sidebar( + array( + 'name' => esc_html__( 'Footer-2', 'test2' ), + 'id' => 'footer-2', + 'description' => esc_html__( 'Add widgets here.', 'test2' ), + 'before_widget' => '
', + 'after_widget' => '
', + 'before_title' => '

', + 'after_title' => '

', + ) + ); +} +add_action( 'widgets_init', 'test_widgets_init3' ); + +function test_widgets_init4() { + register_sidebar( + array( + 'name' => esc_html__( 'Footer-3', 'test3' ), + 'id' => 'footer-3', + 'description' => esc_html__( 'Add widgets here.', 'test3' ), + 'before_widget' => '
', + 'after_widget' => '
', + 'before_title' => '

', + 'after_title' => '

', + ) + ); +} +add_action( 'widgets_init', 'test_widgets_init4' ); @@ -244,111 +287,3 @@ function lh_acf_save_post( $post_id ) { } add_action( 'acf/save_post', 'lh_acf_save_post', 10, 1 ); -//Custom checkbox for home article wordpress - -/* Define the custom box */ -add_action( 'add_meta_boxes', 'wpse_61041_add_custom_box' ); - -/* Do something with the data entered */ -add_action( 'save_post', 'wpse_61041_save_postdata' ); - -/* Adds a box to the main column on the Post and Page edit screens */ -function wpse_61041_add_custom_box() { - add_meta_box( - 'wpse_61041_sectionid', - 'Article template', - 'wpse_61041_inner_custom_box', - 'post', - 'side', - 'high' - ); -} - -/* Prints the box content */ -function wpse_61041_inner_custom_box($post) -{ - // Use nonce for verification - wp_nonce_field( 'wpse_61041_wpse_61041_field_nonce', 'wpse_61041_noncename' ); - - // Get saved value, if none exists, "default" is selected - $saved = get_post_meta( $post->ID, 'article_type', true); - if( !$saved ) - $saved = 'default'; - - $fields = array( - 'imagetext' => __('Image & text', 'wpse'), - 'text' => __('Text', 'wpse'), - 'image' => __('Image', 'wpse'), - 'default' => __('Default', 'wpse'), - ); - - foreach($fields as $key => $label) - { - printf( - ''. - '
', - esc_attr($key), - esc_html($label), - checked($saved, $key, false) - ); - } -} - -/* When the post is saved, saves our custom data */ -function wpse_61041_save_postdata( $post_id ) -{ - // verify if this is an auto save routine. - // If it is our form has not been submitted, so we dont want to do anything - if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) - return; - - // verify this came from the our screen and with proper authorization, - // because save_post can be triggered at other times - if ( !wp_verify_nonce( $_POST['wpse_61041_noncename'], 'wpse_61041_wpse_61041_field_nonce' ) ) - return; - - if ( isset($_POST['article_type']) && $_POST['article_type'] != "" ){ - update_post_meta( $post_id, 'article_type', $_POST['article_type'] ); - } -} - - -//Custom post types for notifications - -// Our custom post type function -function create_posttype() { - - register_post_type( 'notifications', - // CPT Options - array( - 'labels' => array( - 'name' => __( 'Notifications' ), - 'singular_name' => __( 'Notifications' ) - ), - 'public' => true, - 'has_archive' => false, - 'rewrite' => array('slug' => 'movies'), - 'show_in_rest' => true, - - ) - ); -} -// Hooking up our function to theme setup -add_action( 'init', 'create_posttype' ); - -add_filter('use_block_editor_for_post_type', 'prefix_disable_gutenberg', 10, 2); -function prefix_disable_gutenberg($current_status, $post_type) -{ - // Use your post type key instead of 'product' - if ($post_type === 'notifications') return false; - return $current_status; -} - -//--------------------------------------------------------------------- - - -function HelloWorldShortcode() { - return '

Hello World!

'; -} -add_shortcode('helloworld', 'HelloWorldShortcode'); \ No newline at end of file diff --git a/header.php b/header.php index adc7567..801cb8e 100644 --- a/header.php +++ b/header.php @@ -1,3 +1,4 @@ + >
- - - } - ?> + - + +
- - - +
- + diff --git a/template-parts/notification-bar.php b/template-parts/notification-bar.php deleted file mode 100644 index 0a7b30f..0000000 --- a/template-parts/notification-bar.php +++ /dev/null @@ -1,28 +0,0 @@ -
- 'notifications', 'posts_per_page' => 10 ); - $the_query = new WP_Query( $args ); - ?> - have_posts() ) : $the_query->the_post(); ?> -
-

-
- -
-
- - -

- -

- -
- - -