Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 8 of 8
  1. #1
    Junior Member
    Join Date
    Dec 2010
    Posts
    4
    Member #
    25527
    Hi people my name is Vincent and Im new here, nice to meet you all, I need help with something, tried to find the solution but nobody seems to know what the heck Im talking about, maybe someone here will be able to help me with my problem.

    I am doing some re design on a WP theme and everything is going well but on my home page , every POST titles do not have the exemple: 22 comments usually on the top right of each post that shows visitors the amount of comments for each post that they can click and enter the actual post to comment , the only thing my visitors see is the TITLE of the post so they click it less then if I had the amount of COMMENTS showing next to the tittle.

    Anyone know what pluggin or widget I need to show the NUMBER of comments that were made per Post?? PLEASE HELP I'm going crazy with this.

    thank you in advance.

  2.  

  3. #2
    Junior Member
    Join Date
    Nov 2010
    Posts
    21
    Member #
    25283
    Quote Originally Posted by spinvin View Post
    I need to show the NUMBER of comments that were made per Post
    A quick and easy solution is:

    <?php
    comments_number('No Comments', '1 Comment', '% Comments');
    ?>

  4. #3
    Junior Member
    Join Date
    Dec 2010
    Posts
    4
    Member #
    25527
    Thank you for the Info

    Thank you Axon for taking time to reply to my post, but Im really new with WP and not sure where to put your code in my functions.php file, I found this code wich I believe to be for the Posts in my function.php file but not sure where to add your code, can you please let me know where Im suppose to add this code of yours by any chance?

    function cats_to_select()
    {
    $categories = get_categories('hide_empty=0');
    $categories_array[] = array('value'=>'0', 'title'=>'Select');
    foreach ($categories as $cat) {
    if($cat->category_count == '0') {
    $posts_title = 'No posts!';
    } elseif($cat->category_count == '1') {
    $posts_title = '1 post';
    } else {
    $posts_title = $cat->category_count . ' posts';
    }
    $categories_array[] = array('value'=> $cat->cat_ID, 'title'=> $cat->cat_name . ' ( ' . $posts_title . ' )');
    }
    return $categories_array;
    }

    thats the code I have installed right now just not sure where to insert the code you reffered me too.

  5. #4
    Junior Member
    Join Date
    Nov 2010
    Posts
    21
    Member #
    25283
    Quote Originally Posted by spinvin View Post
    can you please let me know where Im suppose to add this code...
    Hi spinvin,
    I am guessing that the function you are looking at - cats_to_select()
    is a function used in your template. So best not to start adjusting the code in there. All you need to do is paste the following in the page that is displaying your wp comments.

    <?php
    comments_number('No Comments', '1 Comment', '% Comments');
    ?>

    This is normally index.php. Look for the comment footer and just drop this simple code there.

    This is a call to wp function that gets the number of comments for each post, and returns it after it has suitably parsed the argument you provide in the call to the function.

    You can probably work out that the arguments you provide relate to zero, one or more comments. So, if you alter the call to say:

    comments_number('Nobody bothered to answer', 'Only 1 person answered', '% Comments on this interesting post');

    the function returns the string "Nobody bothered to answer" where zero comments are found, "Only 1 person answered", where exactly one comment is found and the number of comments concatenated with the string
    " Comments on this interesting post", where more than one comment is found.

    I hope this helps clarify things for you.

  6. #5
    Junior Member
    Join Date
    Dec 2010
    Posts
    4
    Member #
    25527
    It works but needs extra Code for redirect to post comments

    Thank you so much for your help Axon you steered me into the right direction I appreciate that!!, so After totally destroying my Index.php*yes you can laugh* I made it work well, the only problem is that when I click on the lets say ( 14 Comments) it doesn't take me inside the post where the comments are, My Noob senses tell me I am missing a part of code to implement redirect from button to actual post....

    Thanks again Axon!! I am closer to solve this thanks to you.

    Cheers..

  7. #6
    Junior Member
    Join Date
    Nov 2010
    Posts
    21
    Member #
    25283
    Quote Originally Posted by spinvin View Post
    Thank you so much for your help Axon you steered me into the right direction I appreciate that!!, so After totally destroying my Index.php*yes you can laugh* I made it work well, the only problem is that when I click on the lets say ( 14 Comments) it doesn't take me inside the post where the comments are, My Noob senses tell me I am missing a part of code to implement redirect from button to actual post....

    Thanks again Axon!! I am closer to solve this thanks to you.

    Cheers..
    Ok, you now know where the code needs to go. Now simply replace the code I gave you with:

    <?php comments_popup_link(__('No Comments ', 'kubrick'), __('1 Comment ', 'kubrick'), __('% Comments ', 'kubrick'), '', __('Comments Closed', 'kubrick') ); ?>

    This should provide the functionality. The details of the link to posts etc. is encapsulated within the function comments_popup_link().

    The main thing to remember is that while you are learning, take small steps and don't alter any wp code.

  8. #7
    Junior Member
    Join Date
    Dec 2010
    Posts
    4
    Member #
    25527
    you are my HERO

    So I put the new code that you gave me and VOILA!!! worked absolutly perfect on the first try exactly like I wanted it too! it's now clikable and brings the visitors right into the comments like It should had been already been coded by the Theme creator*but that's another story*

    Thank you so Much Axon , it's working awesome , you are my Hero!! thank you for sharing your knowledge with me. you Rock:-D

    have a great day and I will surely come back from great advice!! WP is challenging for me but love the learning part. Thanks again

  9. #8
    Junior Member
    Join Date
    Nov 2010
    Posts
    21
    Member #
    25283
    Quote Originally Posted by spinvin View Post
    So I put the new code that you gave me and VOILA!!! worked absolutly perfect on the first try exactly like I wanted it too! it's now clikable and brings the visitors right into the comments like It should had been already been coded by the Theme creator*but that's another story*

    Thank you so Much Axon , it's working awesome , you are my Hero!! thank you for sharing your knowledge with me. you Rock:-D

    have a great day and I will surely come back from great advice!! WP is challenging for me but love the learning part. Thanks again
    No problem . I am sure as you learn more, you will enjoy even more. The code that did the magic for you is pure wp code that comes with the installation. It's really wp that rocks, not me :-), just happy to help...


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 06:34 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com