This topic has 9 replies, 2 voices, and was last updated 9 years by Andrei.

  • Author
  • #51157
     nilje
    Participant

    Hi,

    searched a while now, but can’t find an answer.
    I’m using ‘Content View Pro’ for the post layout. I would like to see the comment template after each post. I got that filter code from CV-Support:

    add_filter( ‘pt_cv_after_item’, ‘my_after_item’, 10, 2 );
    function my_after_item( $args, $post_id ) {

    }

    is there an easy way to get the original comment template with social share and everything what comes after the post into that code?

    And can I set in general to see just 5 comments and a page-navi for commemts at the end of each post?

    Best Regards,
    Dani

    #51755
     Andrei
    Moderator

    We’re using the default wordpress comments template which we have styled. This functionality that you requested should be provided by the author of the plugin you’re trying to use because it involves much more than a simple piece of code. I’m telling this because comments are mainly shown only in single pages, not inside a post listing.

    Please let me know if I can help you with something else.
    Cheers

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #51962
     nilje
    Participant

    Great, we could solve the problem
    That’s the code it works perfectly with:

    add_filter( ‘pt_cv_after_item’, ‘my_after_item’, 10, 2 );
    function my_after_item( $args, $post_id ) {
    // get post comment
    $args = array(
    ‘status’ => ‘approve’,
    ‘number’ => ‘1’,
    ‘post_id’ => $post_id,
    );

    ob_start();
    foreach($comments as $comment) :
    echo($comment->comment_author . ‘<br />’ . $comment->comment_content);
    endforeach;

    $social_share = get_template_part( ‘page-parts/posts-social-share’ );

    // Change global $post
    global $post;
    $gpost = $post;
    $post = get_post( $post_id );

    // Show comment form
    comments_template();

    // Recovery global $post
    $post = $gpost;

    $args = ob_get_clean();

    return $args;
    }

    I added this line: $social_share = get_template_part( ‘page-parts/posts-social-share’ );
    But I just see the social shares like facebook, twitter etc… how can I put the ‘kleo-like-item’ into it?

    Thanks!

    #52277
     Andrei
    Moderator

    I’m glad you found a way to deal with the comments template/form.
    For the like item to show you’ll probably have to enable this feature from Theme Options, or from each post settings.

    Let me know if I can help you with anything else.
    Cheers

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #52279
     nilje
    Participant

    It’s already enabled.. I see it at the single post pages too, but have to get it somehow into the ‘after-item’ filter of the post-layout plugin I’m using… I searched for the “$” and the path of kleo love item, but I couldn’t get it to work… like that, like I said:
    $social_share = get_template_part( ‘page-parts/posts-social-share’ );
    that works perfectly

    or is there maybe a solution with both, social share and kleo love item and its called ‘after-content’ or something like that, saw something too, but doesn’t work…

    #52281
     Andrei
    Moderator

    Can you provide a link to the page in which you’re trying to do all this, and also wp admin credentials and a ftp account ?

    Looking forward.
    Cheers

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #52283
     nilje
    Participant
    This reply has been set as private.
    #53264
     nilje
    Participant

    Hi,

    short update, the links at the mainsite works again.
    But I still don’t know how to get kleo love and social share into the add-filter-code

    Regards

    #53563
     nilje
    Participant

    oh, now I see it’s “not a support question”? what does that mean?
    I just don’t find the variable and path to create the code to put it into ‘add filter’, thought that would be easy for you to answer? I worked it out with the social share, but don’t know how to see ‘kleo love’ too, which is right next to ‘social share’ in the original.

    #53622
     Andrei
    Moderator

    The likes feature resides in the same template/file ( posts-social-share ). The reason it doesn’t work is because the comments aren’t a wp post loop/query and that means that the likes can’t be assigned to a post id, and that’s the reason why they won’t show up.

    Without some proper customization, you won’t be able to display them for each of your comments.

    Let me know if I can help you with anything else.
    Cheers

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
Viewing 10 posts - 1 through 10 (of 10 total)

The forum ‘KLEO’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?