• Welcome to the all-new Kolakube support, the official place to get help for Marketers Delight, XFtoWP, CryptoWP, and other WordPress products! Please login with your account details to access private support forums.

Comment Count and Comment Replay Box?

andi7879

Member
Messages
11
Reaction score
0
Hi guys, I've just installed XFtoWP and I've got the site and forum hooked up so that a post create a thread which is awesome. But I've ran into a few issues.

1) Comments count is not updating when I add replies.
2) The thread section below each article only gives the option to reply which takes readers to the forum first. Is there another option that allows users to reply directly from the WP post page?

Thanks
 

Alex

MD developer
Staff member
Md
XFtoWP
Messages
6,546
Reaction score
1,847
Can anyone help ? Comment count is not updating on the homepage on my website
Looks like an issue with the way Elementor shows comments on your site's front page. We hook into the recommended WordPress filter get_comments_number() to add the forum reply count to the post comments and if they use something else here XFtoWP isn't able to reach it.

I can take a closer look if you are OK to send me a WP admin login and see if there is a workaround.

2) The thread section below each article only gives the option to reply which takes readers to the forum first. Is there another option that allows users to reply directly from the WP post page?
There currently isn't an option to post comments from WP, but that is a very popular suggestion here and one we will look at after XFtoWP 1.3 is released.
 
Comment

andi7879

Member
Messages
11
Reaction score
0
Looks like an issue with the way Elementor shows comments on your site's front page. We hook into the recommended WordPress filter get_comments_number() to add the forum reply count to the post comments and if they use something else here XFtoWP isn't able to reach it.

I can take a closer look if you are OK to send me a WP admin login and see if there is a workaround.


There currently isn't an option to post comments from WP, but that is a very popular suggestion here and one we will look at after XFtoWP 1.3 is released.
Hi thanks for the reply, I'll send you a DM
 
Comment

Alex

MD developer
Staff member
Md
XFtoWP
Messages
6,546
Reaction score
1,847
I see a possible workaround with the custom fields setting:

Screen Shot 2021-09-25 at 1.45.01 AM.png

...but the comments count should really show in the first place.
 
Comment

andi7879

Member
Messages
11
Reaction score
0
I spoke with Elementor today and they have looked through my site but say the issue is because my WP comments table isn't showing comments, so it is unable to load the comment count to the homepage. Is there are way to solve this? Perhaps have XFtoWP copy comments from XF into the WP database?
 
Comment

Alex

MD developer
Staff member
Md
XFtoWP
Messages
6,546
Reaction score
1,847
I spoke with Elementor today and they have looked through my site but say the issue is because my WP comments table isn't showing comments, so it is unable to load the comment count to the homepage. Is there are way to solve this? Perhaps have XFtoWP copy comments from XF into the WP database?
That's an odd answer to me as regardless of whether there are any comments, using the proper get_comments_number in their comments template should produce the same comment count. That also doesn't explain why it works on single and not homepage.
 
Comment

andi7879

Member
Messages
11
Reaction score
0
Any suggestions on where I can find the Comment code in Elemenotor to see if they are using the proper get_comments_number?
 
Comment

andi7879

Member
Messages
11
Reaction score
0
That's an odd answer to me as regardless of whether there are any comments, using the proper get_comments_number in their comments template should produce the same comment count. That also doesn't explain why it works on single and not homepage.
I found this code looks like they use the correct method of getting comments. What do you think?

CSS:
<?php
namespace ElementorPro\Modules\DynamicTags\Tags;

use Elementor\Controls_Manager;
use ElementorPro\Modules\DynamicTags\Tags\Base\Tag;
use ElementorPro\Modules\DynamicTags\Module;

if ( ! defined( 'ABSPATH' ) ) {
    exit; // Exit if accessed directly
}

class Comments_Number extends Tag {

    public function get_name() {
        return 'comments-number';
    }

    public function get_title() {
        return __( 'Comments Number', 'elementor-pro' );
    }

    public function get_group() {
        return Module::COMMENTS_GROUP;
    }

    public function get_categories() {
        return [
            Module::TEXT_CATEGORY,
            Module::NUMBER_CATEGORY,
        ];
    }

    protected function register_controls() {
        $this->add_control(
            'format_no_comments',
            [
                'label' => __( 'No Comments Format', 'elementor-pro' ),
                'default' => __( 'No Responses', 'elementor-pro' ),
            ]
        );

        $this->add_control(
            'format_one_comments',
            [
                'label' => __( 'One Comment Format', 'elementor-pro' ),
                'default' => __( 'One Response', 'elementor-pro' ),
            ]
        );

        $this->add_control(
            'format_many_comments',
            [
                'label' => __( 'Many Comment Format', 'elementor-pro' ),
                'default' => __( '{number} Responses', 'elementor-pro' ),
            ]
        );

        $this->add_control(
            'link_to',
            [
                'label' => __( 'Link', 'elementor-pro' ),
                'type' => Controls_Manager::SELECT,
                'default' => '',
                'options' => [
                    '' => __( 'None', 'elementor-pro' ),
                    'comments_link' => __( 'Comments Link', 'elementor-pro' ),
                ],
            ]
        );
    }

    public function render() {
        $settings = $this->get_settings();

        $comments_number = get_comments_number();

        if ( ! $comments_number ) {
            $count = $settings['format_no_comments'];
        } elseif ( 1 === $comments_number ) {
            $count = $settings['format_one_comments'];
        } else {
            $count = strtr( $settings['format_many_comments'], [
                '{number}' => number_format_i18n( $comments_number ),
            ] );
        }

        if ( 'comments_link' === $this->get_settings( 'link_to' ) ) {
            $count = sprintf( '<a href="%s">%s</a>', get_comments_link(), $count );
        }

        echo wp_kses_post( $count );
    }
}
 
Comment

Alex

MD developer
Staff member
Md
XFtoWP
Messages
6,546
Reaction score
1,847
Nice digging but it's not enough for me to say where an issue would be. It would more come down to the actual template rendering to know, and also the context of the loop in the frontend (also part of the template).

I have a workaround idea to include the reply count as a post meta key so you can at least use the custom field value if the default comment count doesn't work for the Frontpage. I'll have to send it out in the next update which I am closing in on.
 
Comment

andi7879

Member
Messages
11
Reaction score
0
Nice digging but it's not enough for me to say where an issue would be. It would more come down to the actual template rendering to know, and also the context of the loop in the frontend (also part of the template).

I have a workaround idea to include the reply count as a post meta key so you can at least use the custom field value if the default comment count doesn't work for the Frontpage. I'll have to send it out in the next update which I am closing in on.
Awesome looking forward to getting this solved👍 Thanks for you time
 
Comment
Top