replaced comment form for a custom one
This commit is contained in:
@@ -178,15 +178,6 @@ class Partnerexpo_Core_User_Fields extends Partnerexpo_Core {
|
||||
'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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,12 +57,19 @@ class Partnerexpo_Core_Public {
|
||||
return ob_get_clean();
|
||||
}
|
||||
|
||||
public function comments_shortcode() {
|
||||
public function comments_shortcode($atts) {
|
||||
wp_enqueue_style( $this->plugin_name . '-comments-css' );
|
||||
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(),
|
||||
), $atts );
|
||||
|
||||
// This variable is now scoped and ready for the partial
|
||||
$post_id = intval( $atts['post_id'] );
|
||||
|
||||
ob_start();
|
||||
include plugin_dir_path( __FILE__ ) . 'partials/partnerexpo-core-public-comments.php';
|
||||
return ob_get_clean();
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
#pexpo-custom-comment-form {
|
||||
width: 100%;
|
||||
padding: 20px;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.pexpo-core-comments-title {
|
||||
text-align: center;
|
||||
font-size: 2rem;
|
||||
@@ -105,6 +115,7 @@
|
||||
border-radius: 15px;
|
||||
padding: 20px;
|
||||
height: fit-content;
|
||||
margin-top: 50px;
|
||||
|
||||
& .pexpo-core-com-form-title {
|
||||
margin: 0 0 20px 0;
|
||||
@@ -146,6 +157,24 @@
|
||||
margin: 50px 0;
|
||||
}
|
||||
|
||||
.pexpo-core-submit-wrapper {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin: 40px;
|
||||
|
||||
& .submit {
|
||||
background-image: linear-gradient(rgb(178, 34, 34) 21%, rgb(149, 0, 0) 87%);
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 15px;
|
||||
padding: 10px 20px;
|
||||
font-size: 1rem;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.3s ease;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@keyframes scrolling {
|
||||
to {
|
||||
|
||||
@@ -379,9 +379,11 @@ class PartnerExpoSearch {
|
||||
div.className = "pexpo-core-card";
|
||||
div.innerHTML = `
|
||||
<div class="pexpo-core-imageWrap">
|
||||
<a href="${this.escapeHtml(r.url)}" target="_self" rel="noopener noreferrer">
|
||||
<img src="${this.escapeHtml(r.image || '')}"
|
||||
alt="${this.escapeHtml(r.title)}"
|
||||
style="width:100%; border-radius:10px; object-fit:cover;" />
|
||||
</a>
|
||||
</div>
|
||||
<div class="pexpo-core-cardTop">
|
||||
<a href="${this.escapeHtml(r.url)}" class="pexpo-core-title">${this.escapeHtml(r.title)}</a>
|
||||
|
||||
@@ -9,10 +9,10 @@
|
||||
* @package Partnerexpo_Core
|
||||
* @subpackage Partnerexpo_Core/public/partials
|
||||
*/
|
||||
|
||||
?>
|
||||
|
||||
<div class="pexpo-core-root pexpo-core-shell" id="pexpo-core-comments-shell">
|
||||
<div class="pexpo-core-comments" id="pexpo-core-comments">
|
||||
<div class="pexpo-core-comments" id="pexpo-core-comments">
|
||||
<div class="pexpo-core-comments-header">
|
||||
<h2 class="pexpo-core-comments-title"><?php echo esc_html__('Visszajelzések', 'partnerexpo-core'); ?></h2>
|
||||
</div>
|
||||
@@ -40,9 +40,9 @@
|
||||
<?php echo get_comment_text( $comment ); ?>
|
||||
</div>
|
||||
<div class="pexpo-core-comment-said_by">
|
||||
<?php if ( get_comment_meta( $comment->comment_ID, 'name', true ) ): ?>
|
||||
<?php if ( get_comment_meta( $comment->comment_ID, 'author', true ) ): ?>
|
||||
<div class="pexpo-core-comment-author">
|
||||
<p><?php echo get_comment_meta( $comment->comment_ID, 'name', true ); ?></p>
|
||||
<p><?php echo get_comment_meta( $comment->comment_ID, 'author', true ); ?></p>
|
||||
</div>
|
||||
<p>-</p>
|
||||
<?php endif; ?>
|
||||
@@ -64,26 +64,32 @@
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
$comments_args = array(
|
||||
'label_submit' => __( 'Küldés', 'partnerexpo-core' ),
|
||||
'title_reply' => '',
|
||||
'comment_notes_after' => '',
|
||||
'must_log_in' => '',
|
||||
'logged_in_as' => '',
|
||||
'comment_field' => '
|
||||
|
||||
<form action="<?php echo site_url( '/wp-comments-post.php' ); ?>" method="post" id="pexpo-custom-comment-form">
|
||||
<div class="pexpo-core-com-form-wrapper">
|
||||
<h2 class="pexpo-core-com-form-title">' . _x( 'Visszajelzés küldése', 'partnerexpo_core' ) . '</h2>
|
||||
<p class="pexpo-core-com-field"><label for="name">' . _x( 'Kitöltő neve', 'partnerexpo_core' ) . '</label><br />
|
||||
<input type="text" id="name" name="name" aria-required="true"></p>
|
||||
<p class="pexpo-core-com-field"><label for="company">' . _x( 'Cég név', 'partnerexpo_core' ) . '</label><br />
|
||||
<input type="text" id="company" name="company" aria-required="true"></p>
|
||||
<p class="pexpo-core-com-field"><label for="comment">' . _x( 'Hozzászólás', 'partnerexpo_core' ) . '</label><br />
|
||||
<textarea id="comment" name="comment" aria-required="true" maxlength="600"></textarea></p>
|
||||
<h2 class="pexpo-core-com-form-title"><?php echo esc_html_x( 'Visszajelzés küldése', 'partnerexpo_core' ); ?></h2>
|
||||
<div 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>
|
||||
</div>
|
||||
',
|
||||
);
|
||||
comment_form( $comments_args );
|
||||
?>
|
||||
|
||||
<div class="pexpo-core-com-field">
|
||||
<label for="company"><?php echo esc_html_x( 'Cég név', 'partnerexpo_core' ); ?></label><br />
|
||||
<input type="text" id="company" name="company" aria-required="true" required>
|
||||
</div>
|
||||
|
||||
<div class="pexpo-core-com-field">
|
||||
<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>
|
||||
</div>
|
||||
|
||||
<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-submit-wrapper">
|
||||
<button type="submit" name="submit" id="submit" class="submit"><?php _e( 'Küldés', 'partnerexpo-core' ); ?></button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
Reference in New Issue
Block a user