Issue with Moving Review Form

This topic contains 2 replies, has 2 voices, and was last updated by  Alex Rollin 6 years, 7 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #427433

    Joy
    Buyer
    Post count: 1076

    Hello, I’d like to move my review form above the reviews. For some reason, it works fine on my base cpt. But the review tab becomes blank on my other 2 cpts. If I revert back to the original ‘review.php’ content, all reviews functions are restored for all cpts – but of course, my review form is left at the bottom.

    I have checked and the other ctps do allow for comments and the listing itself does allow for comments as well. Since the reviews and form shows up fine with the original ‘review.php’ file, then I’m led to believe there’s some other issue. Can someone please take a look at this and see if I am doing something wrong here? Thank you.

    
    
    <?php
    /**
     * The template for displaying Comments.
     *
     * The area of the page that contains both current comments
     * and the comment form.
     *
     * @since 1.0.0
     * @since 1.5.4 Modified to fix review sorting.
     *
     * @package GeoDirectory
     */
    
    /*
     * If the current post is protected by a password and
     * the visitor has not yet entered the password we will
     * return early without loading the comments.
     */
    if (post_password_required())
        return;
    ?>
    
    <div id="comments" class="comments-area">
    
        <?php // You can start editing here -- including this comment! ?>
    
        <?php
        /**
         * Called before displaying reviews.
         *
         * If you would like to wrap reviews inside a div this is the place to print your open div. @see geodir_before_review_form to print your closing div.
         *
         * @since 1.5.7
         */
        do_action('geodir_before_review_list'); ?>
    
        <?php if (have_comments()) : ?>
            <h2 class="comments-title">
                <?php
                printf(_n('1 Review <span class="r-title-on">on</span> <span class="r-title">&ldquo;%2$s&rdquo;</span>', '%1$s Reviews <span>on</span> <span class="r-title"> &ldquo;%2$s&rdquo;</span>', get_comments_number(), 'geodirectory'),
                    number_format_i18n(get_comments_number()), get_the_title());
                ?>
            </h2>
    
            <?php
        /**
         * Called before displaying "Leave a review form".
         *
         * If you would like to wrap "review form" inside a div this is the best place to hook your open div. @see geodir_after_review_form to print your closing div.
         * Also If you would like to wrap "reviews" inside a div this is the best place to print your closing div. @see geodir_before_review_list to print your open div.
         *
         * @since 1.5.7
         */
        do_action('geodir_before_review_form'); ?>
    
        <?php
        /**
         * Filters comment form args
         *
         * If you would like to modify your comment form args, use this filter. @see https://codex.wordpress.org/Function_Reference/comment_form for accepted args.
         *
         * @since 1.0.0
         */
        $args = apply_filters('geodir_review_form_args', array(
            'title_reply' => __('Leave a Review', 'geodirectory'),
            'label_submit' => __('Post Review', 'geodirectory'),
            'comment_field' => '<p class="comment-form-comment"><label for="comment">' . __('Review text', 'geodirectory') . ' <span class="required">*</span></label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true" required></textarea></p>',
            'must_log_in' => '<p class="must-log-in">' . sprintf(__('You must be <a href="%s">logged in</a> to post a comment.', 'geodirectory'), geodir_login_url()) . '</p>'
        ));
        comment_form($args);
        ?>
    
        
        <?php
        /**
         * Called after displaying "Leave a review form".
         *
         * If you would like to wrap "review form" inside a div this is the best place to print your closing div. @see geodir_before_review_form to print your open div.
         *
         * @since 1.5.7
         */
        do_action('geodir_after_review_form'); ?>
    
    </div><!-- #comments .comments-area -->
    
            <?php
            /**
             * Called after displaying review listing title.
             *
             * @since 1.5.7
             */
            do_action('geodir_after_review_list_title'); ?>
    
            <ol class="commentlist">
                <?php $reverse_top_level = is_plugin_active('geodir_review_rating_manager/geodir_review_rating_manager.php') ? false : null; ?>
    			<?php wp_list_comments(array('callback' => 'geodir_comment', 'reverse_top_level' => $reverse_top_level, 'style' => 'ol'));
                ?>
            </ol><!-- .commentlist -->
    
            <?php if (get_comment_pages_count() > 1 && get_option('page_comments')) : // are there comments to navigate through ?>
                <nav id="comment-nav-below" class="navigation" role="navigation">
                    <h1 class="assistive-text section-heading"><?php _e('Review navigation', 'geodirectory'); ?></h1>
    
                    <div
                        class="nav-previous"><?php previous_comments_link(__('&larr; Older Reviews', 'geodirectory')); ?></div>
                    <div
                        class="nav-next"><?php next_comments_link(__('Newer Reviews &rarr;', 'geodirectory')); ?></div>
                </nav>
            <?php endif; // check for comment navigation ?>
    
            <?php
            /* If there are no comments and comments are closed, let's leave a note.
             * But we only want the note on posts and pages that had comments in the first place.
             */
            if (!comments_open() && get_comments_number()) : ?>
                <p class="nocomments"><?php _e('Reviews are closed.', 'geodirectory'); ?></p>
            <?php endif; ?>
    
        <?php endif; // have_comments() ?>
    
        
    
    
    #427434

    Joy
    Buyer
    Post count: 1076

    Sorry, I figured it out. If anyone else needs this:

    
    
    <?php
    
    /**
    
     * The template for displaying Comments.
    
     *
    
     * The area of the page that contains both current comments
    
     * and the comment form.
    
     *
    
     * @since 1.0.0
    
     * @since 1.5.4 Modified to fix review sorting.
    
     *
    
     * @package GeoDirectory
    
     */
    
    /*
    
     * If the current post is protected by a password and
    
     * the visitor has not yet entered the password we will
    
     * return early without loading the comments.
    
     */
    
    if (post_password_required())
    
        return;
    
    ?>
    
    <div id="comments" class="comments-area">
    
        <?php
    
        /**
    
         * Filters comment form args
    
         *
    
         * If you would like to modify your comment form args, use this filter. @see https://codex.wordpress.org/Function_Reference/comment_form for accepted args.
    
         *
    
         * @since 1.0.0
    
         */
    
        $args = apply_filters('geodir_review_form_args', array(
    
            'title_reply' => __('Leave a Review', 'geodirectory'),
    
            'label_submit' => __('Post Review', 'geodirectory'),
    
            'comment_field' => '<p class="comment-form-comment"><label for="comment">' . __('Review text', 'geodirectory') . ' <span class="required">*</span></label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true" required></textarea></p>',
    
            'must_log_in' => '<p class="must-log-in">' . sprintf(__('You must be <a href="%s">logged in</a> to post a comment.', 'geodirectory'), geodir_login_url()) . '</p>'
    
        ));
    
        comment_form($args);
    
        ?>
    
        <?php
    
        /**
    
         * Called before displaying reviews.
    
         *
    
         * If you would like to wrap reviews inside a div this is the place to print your open div. @see geodir_before_review_form to print your closing div.
    
         *
    
         * @since 1.5.7
    
         */
    
        do_action('geodir_before_review_list'); ?>
    
        <?php if (have_comments()) : ?>
    
            <h2 class="comments-title">
    
                <?php
    
                printf(_n('1 Review <span class="r-title-on">on</span> <span class="r-title">&ldquo;%2$s&rdquo;</span>', '%1$s Reviews <span>on</span> <span class="r-title"> &ldquo;%2$s&rdquo;</span>', get_comments_number(), 'geodirectory'),
    
                    number_format_i18n(get_comments_number()), get_the_title());
    
                ?>
    
            </h2>
    
            <?php
    
            /**
    
             * Called after displaying review listing title.
    
             *
    
             * @since 1.5.7
    
             */
    
            do_action('geodir_after_review_list_title'); ?>
    
            <ol class="commentlist">
    
                <?php $reverse_top_level = is_plugin_active('geodir_review_rating_manager/geodir_review_rating_manager.php') ? false : null; ?>
    
    			<?php wp_list_comments(array('callback' => 'geodir_comment', 'reverse_top_level' => $reverse_top_level, 'style' => 'ol'));
    
                ?>
    
            </ol><!-- .commentlist -->
    
            <?php if (get_comment_pages_count() > 1 && get_option('page_comments')) : // are there comments to navigate through ?>
    
                <nav id="comment-nav-below" class="navigation" role="navigation">
    
                    <h1 class="assistive-text section-heading"><?php _e('Review navigation', 'geodirectory'); ?></h1>
    
                    <div
    
                        class="nav-previous"><?php previous_comments_link(__('&larr; Older Reviews', 'geodirectory')); ?></div>
    
                    <div
    
                        class="nav-next"><?php next_comments_link(__('Newer Reviews &rarr;', 'geodirectory')); ?></div>
    
                </nav>
    
            <?php endif; // check for comment navigation ?>
    
            <?php
    
            /* If there are no comments and comments are closed, let's leave a note.
    
             * But we only want the note on posts and pages that had comments in the first place.
    
             */
    
            if (!comments_open() && get_comments_number()) : ?>
    
                <p class="nocomments"><?php _e('Reviews are closed.', 'geodirectory'); ?></p>
    
            <?php endif; ?>
    
        <?php endif; // have_comments() ?>
    
        <?php
    
        /**
    
         * Called before displaying "Leave a review form".
    
         *
    
         * If you would like to wrap "review form" inside a div this is the best place to hook your open div. @see geodir_after_review_form to print your closing div.
    
         * Also If you would like to wrap "reviews" inside a div this is the best place to print your closing div. @see geodir_before_review_list to print your open div.
    
         *
    
         * @since 1.5.7
    
         */
    
        do_action('geodir_before_review_form'); ?>
    
        
    
        <?php
    
        /**
    
         * Called after displaying "Leave a review form".
    
         *
    
         * If you would like to wrap "review form" inside a div this is the best place to print your closing div. @see geodir_before_review_form to print your open div.
    
         *
    
         * @since 1.5.7
    
         */
    
        do_action('geodir_after_review_form'); ?>
    
    </div><!-- #comments .comments-area -->
    #427452

    Alex Rollin
    Moderator
    Post count: 27815

    Hey Joy,

    thanks for sharing! Glad you got it working!

Viewing 3 posts - 1 through 3 (of 3 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount