From 7f253bc452e2c5e50573f13e1f8a9cfcfd23ca0f Mon Sep 17 00:00:00 2001 From: Duskell Date: Wed, 11 Mar 2026 20:23:28 +0100 Subject: [PATCH] updated comments --- .../class-partnerexpo-core-user-fields.php | 16 ++ public/class-partnerexpo-core-public.php | 17 ++ public/css/comments.css | 147 ++++++++++++++++++ .../partnerexpo-core-public-comments.php | 49 ++++-- 4 files changed, 215 insertions(+), 14 deletions(-) create mode 100644 public/css/comments.css diff --git a/includes/class-partnerexpo-core-user-fields.php b/includes/class-partnerexpo-core-user-fields.php index 2abaf63..282a0f1 100644 --- a/includes/class-partnerexpo-core-user-fields.php +++ b/includes/class-partnerexpo-core-user-fields.php @@ -82,6 +82,22 @@ class Partnerexpo_Core_User_Fields extends Partnerexpo_Core { if ( empty( $_POST['company'] ) || ! empty( $_POST['company'] ) && trim( $_POST['company'] ) == '' ) { wp_delete_comment( $id, true ); wp_die( sprintf('%s: %s',__( 'Error', 'partnerexpo-core' ),__( 'Cég megadása kötelező!', 'partnerexpo-core' ) ) ); + return false; } + add_comment_meta( + $id, + 'company', + sanitize_text_field($_POST['company']) + ); + + if ( ! empty( $_POST['name'] ) && trim( $_POST['name'] ) != '' ) { + add_comment_meta( + $id, + 'name', + sanitize_text_field($_POST['name']) + ); + } + + return true; } } diff --git a/public/class-partnerexpo-core-public.php b/public/class-partnerexpo-core-public.php index b67e8b2..5158725 100644 --- a/public/class-partnerexpo-core-public.php +++ b/public/class-partnerexpo-core-public.php @@ -193,6 +193,14 @@ class Partnerexpo_Core_Public { 'all' ); + wp_register_style( + $this->plugin_name . '-comments-css', + plugin_dir_url( __FILE__ ) . 'css/comments.css', + [], + $this->version, + 'all' + ); + wp_register_style( $this->plugin_name . '-multiselect-css', plugin_dir_url( __FILE__ ) . 'css/multiselect.css', @@ -216,6 +224,15 @@ class Partnerexpo_Core_Public { true ); + wp_register_script( + $this->plugin_name . '-comments-js', + plugin_dir_url( __FILE__ ) . 'js/comments.js', + [], + $this->version, + true + ); + + wp_register_script( $this->plugin_name . '-multiselect-js', plugin_dir_url( __FILE__ ) . 'js/multiselect.js', diff --git a/public/css/comments.css b/public/css/comments.css new file mode 100644 index 0000000..2a39f74 --- /dev/null +++ b/public/css/comments.css @@ -0,0 +1,147 @@ +.pexpo-core-comments-title { + text-align: center; + font-size: 2rem; + color: #333; + margin-top: 50px; +} + +.pexpo-core-comments-body { + margin: 0 auto; + padding: 20px 0; + max-width: 1500px; + overflow: hidden; + -webkit-mask-image: linear-gradient( + to right, + transparent, + black 80px, + black calc(100% - 80px), + transparent +); + +mask-image: linear-gradient( + to right, + transparent, + black 80px, + black calc(100% - 80px), + transparent +); + + &:hover .pexpo-core-comment-groups-wrapper { + animation-play-state: paused; + } +} + +.pexpo-core-comment-groups-wrapper { + display: flex; + width: max-content; + will-change: transform; + animation: scrolling 20s linear infinite; +} + + +.pexpo-core-comment-group { + display: flex; + gap: 20px; + padding-right: 20px; +} + +.pexpo-core-comment { + position: relative; + flex: 0 0 auto; + width: 500px; + color: #333; + border-radius: 24px; + box-shadow: rgba(0,0,0,0.1) 5px 5px 20px 0; + padding: 20px 20px 50px 20px; + min-height: 200px; +} + +.pexpo-core-comment-content { + font-style: italic; + font-size: 1.2rem; + max-height: 250px; + overflow-x: hidden; + overflow-y: auto; + margin-bottom: 50px; +} + +.pexpo-core-comment-said_by { + position: absolute; + bottom: 20px; + right: 20px; + display: flex; + align-items: center; + gap: 10px; + font-size: 1.2rem; + font-weight: bold; + color: #555; + padding-left: 30px; + max-height: 50px; + + & p { + margin: 0; + } +} + + +.comment-form:has(> .pexpo-core-com-form-wrapper) { + display: flex; + align-items: center; + justify-content: center; + flex-direction: column; + margin-top: 100px; + + & .form-submit .submit { + border-radius: 10px; + } +} + +.pexpo-core-com-form-wrapper { + display: flex; + flex-direction: column; + width: 100%; + max-width: 500px; + box-shadow: #00000020 0px 5px 20px 0; + border-radius: 15px; + padding: 20px; + height: fit-content; + + & .pexpo-core-com-form-title { + margin: 0 0 20px 0; + font-size: 1.5rem; + color: #333; + text-align: center; + } + + & .pexpo-core-com-field { + display: flex; + flex-direction: column; + gap: 5px; + + & label { + font-weight: bold; + color: #555; + } + + & input, & textarea { + padding: 10px; + border-radius: 10px; + border: none; + background-color: #00000010; + font-size: 1rem; + resize: vertical; + + &:focus { + outline: none; + background-color: #00000020; + } + } + } +} + + +@keyframes scrolling { + to { + transform: translate3d(-50%,0,0); + } +} \ No newline at end of file diff --git a/public/partials/partnerexpo-core-public-comments.php b/public/partials/partnerexpo-core-public-comments.php index f9ed358..13e2724 100644 --- a/public/partials/partnerexpo-core-public-comments.php +++ b/public/partials/partnerexpo-core-public-comments.php @@ -14,7 +14,7 @@
-

+

get_the_ID(), 'status' => 'approve', ]); - + if ( ! empty( $comments ) ) { - foreach ( $comments as $comment ) { - ?> + echo '
'; + for ($i = 0; $i < 2; $i++) { + echo ''; } else { ?>

@@ -45,16 +61,21 @@
__( 'Send', 'partnerexpo-core' ), - 'title_reply' => __( 'Write a Reply or Comment', 'partnerexpo-core' ), + 'label_submit' => __( 'Küldés', 'partnerexpo-core' ), + 'title_reply' => '', 'comment_notes_after' => '', 'must_log_in' => '', 'logged_in_as' => '', 'comment_field' => ' -


-

-


-

+
+

' . _x( 'Visszajelzés küldése', 'partnerexpo_core' ) . '

+


+

+


+

+


+

+
', ); comment_form( $comments_args );