finished comment integration, it should be working now

This commit is contained in:
2026-03-17 13:47:55 +01:00
parent 76eb96666b
commit f58248a8e7
10 changed files with 689 additions and 29 deletions

View File

@@ -59,9 +59,8 @@ class Partnerexpo_Core_Public {
public function comments_shortcode($atts) {
wp_enqueue_style( $this->plugin_name . '-comments-css' );
wp_enqueue_script('jquery');
wp_enqueue_script( $this->plugin_name . '-comments-js' );
// wp_enqueue_style( $this->plugin_name . '-multiselect-css' );
// wp_enqueue_script( $this->plugin_name . '-multiselect-js' );
$atts = shortcode_atts( array(
'post_id' => get_the_ID(),
@@ -264,6 +263,15 @@ class Partnerexpo_Core_Public {
$this->version,
true
);
wp_register_script(
$this->plugin_name . '-comments-js',
plugin_dir_url( __FILE__ ) . 'js/comments.js',
[ 'jquery' ],
$this->version,
true
);
}

View File

@@ -46,13 +46,13 @@
width: max-content;
will-change: transform;
animation: scrolling 20s linear infinite;
gap: 100px;
}
.pexpo-core-comment-group {
display: flex;
gap: 100px;
width: max-content;
}
.pexpo-core-comment {
@@ -149,6 +149,28 @@
}
}
.pexpo-core-com-consent {
display: flex;
flex-direction: column;
gap: 10px;
justify-content: left;
font-size: 1.3rem;
& div {
display: flex;
gap: 5px;
& input[type="checkbox"] {
width: auto;
transform: scale(1.2);
&:focus {
outline: none;
}
}
}
}
.pexpo-core-no-comments {
text-align: center;
font-size: 1.2rem;
@@ -177,6 +199,6 @@
@keyframes scrolling {
to {
transform: translate3d(-50%,0,0);
transform: translate3d(-50%, 0, 0);
}
}

10
public/js/comments.js Normal file
View File

@@ -0,0 +1,10 @@
jQuery( document ).ready( function( $ ) {
const wrapper = $('.pexpo-core-comment-groups-wrapper').first();
const group = wrapper.find('.pexpo-core-comment-group').first();
let childrenCount = group.children().length;
if (childrenCount > 3) {
wrapper.css('animation', 'scrolling ' + group.children().length * 5 + 's linear infinite');
}
});

View File

@@ -10,6 +10,8 @@
* @subpackage Partnerexpo_Core/public/partials
*/
$complience_url = "rendszerepito.hu/adatkezeles";
?>
<div class="pexpo-core-comments" id="pexpo-core-comments">
@@ -40,14 +42,14 @@
<?php echo get_comment_text( $comment ); ?>
</div>
<div class="pexpo-core-comment-said_by">
<?php if ( get_comment_meta( $comment->comment_ID, 'author', true ) ): ?>
<?php if ( get_comment_meta( $comment->comment_ID, 'first_name', true ) && get_comment_meta( $comment->comment_ID, 'last_name', true ) ): ?>
<div class="pexpo-core-comment-author">
<p><?php echo get_comment_meta( $comment->comment_ID, 'author', true ); ?></p>
<p><?php echo esc_html( get_comment_meta( $comment->comment_ID, 'first_name', true ) ); ?> <?php echo esc_html( get_comment_meta( $comment->comment_ID, 'last_name', true ) ); ?></p>
</div>
<p>-</p>
<?php endif; ?>
<div class="pexpo-core-comment-business">
<p><?php echo get_comment_meta( $comment->comment_ID, 'company', true ); ?></p>
<p><?php echo esc_html( get_comment_meta( $comment->comment_ID, 'company', true ) ); ?></p>
</div>
</div>
</div>
@@ -69,13 +71,23 @@
<div class="pexpo-core-com-form-wrapper">
<h2 class="pexpo-core-com-form-title"><?php echo esc_html_x( 'Visszajelzés küldése', 'partnerexpo_core' ); ?></h2>
<p class="pexpo-core-com-field">
<label for="author"><?php echo esc_html_x( 'Kitöltő neve', 'partnerexpo_core' ); ?></label><br />
<input type="text" id="author" name="author" aria-required="true" required>
<label for="last_name"><?php echo esc_html_x( 'Vezetéknév', 'partnerexpo_core' ); ?></label><br />
<input type="text" id="last_name" name="last_name" aria-required="true" required>
</p>
<p class="pexpo-core-com-field">
<label for="email"><?php echo esc_html_x( 'Email cím', 'partnerexpo_core' ); ?></label><br />
<input type="email" id="email" name="email" aria-required="true" required>
<label for="first_name"><?php echo esc_html_x( 'Keresztnév', 'partnerexpo_core' ); ?></label><br />
<input type="text" id="first_name" name="first_name" aria-required="true" required>
</p>
<p class="pexpo-core-com-field">
<label for="mail"><?php echo esc_html_x( 'Email cím', 'partnerexpo_core' ); ?></label><br />
<input type="mail" id="mail" name="mail" aria-required="true" required>
</p>
<p class="pexpo-core-com-field">
<label for="phone"><?php echo esc_html_x( 'Telefonszám', 'partnerexpo_core' ); ?></label><br />
<input type="tel" id="phone" name="phone" aria-required="true" required>
</p>
<p class="pexpo-core-com-field">
@@ -87,8 +99,13 @@
<label for="comment"><?php echo esc_html_x( 'Hozzászólás / Visszajelzés', 'partnerexpo_core' ); ?></label><br />
<textarea id="comment" name="comment" aria-required="true" maxlength="600" required></textarea>
</p>
<div><input type="hidden" name="comment_post_ID" value="<?php echo esc_attr( $post_id ); ?>" id="comment_post_ID"></div>
<div><input type="hidden" name="comment_parent" id="comment_parent" value="0"></div></div>
<div class="pexpo-core-com-consent">
<div><input type="checkbox" id="gdpr" name="gdpr" aria-required="true" maxlength="600" required>GDPR <a href="https://<?php echo esc_url( $complience_url ) ?>"><?php echo __( $complience_url ) ?></a> - <?php echo esc_html_x( 'Elfogadom', 'partnerexpo_core' ); ?></input></div>
<div><input type="checkbox" id="newsletter" name="newsletter" aria-required="true" maxlength="600"> <?php echo esc_html_x( 'Feliratkozom a hírlevélre.', 'partnerexpo_core' ); ?></input></div></div>
<div><input type="hidden" name="comment_post_ID" value="<?php echo esc_attr( $post_id ); ?>" id="comment_post_ID" aria-hidden></div>
<div><input type="hidden" name="comment_parent" id="comment_parent" value="0" aria-hidden></div></div>
<div class="pexpo-core-submit-wrapper">
<button type="submit" name="submit" id="submit" class="submit"><?php _e( 'Küldés', 'partnerexpo-core' ); ?></button>
</div>