SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast Marcellpurham's Avatar
    Join Date
    Jan 2009
    Location
    chicago
    Posts
    70
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    wordpress single line code help!

    I am having a problem with one thing. Whenever I paste the code below into my wordpress theme it just shows words but I would like it to show just the number count

    Here is my the code for wordpress. I would like to have just the number show in the comment like this

    I am currently using the wordpress one which is

    <?php comments_number('zero', 'one', 'more'); ?>

    If you know how to solve this problem please help!

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    16,445
    Mentioned
    160 Post(s)
    Tagged
    1 Thread(s)
    The comments_number function is in the wp-includes/comment-template.php file.
    PHP Code:
     * @param string $zero Text for no comments
     
    * @param string $one Text for one comment
     
    * @param string $more Text for more than one comment 
    and
    PHP Code:
    function comments_number$zero false$one false$more false$deprecated '' ) {
    .....
    $output str_replace('%'number_format_i18n($number), ( false === $more ) ? __('% Comments') : $more);
    .....
    $output = ( false === $zero ) ? __('No Comments') : $zero;
    .....
    $output = ( false === $one ) ? __('1 Comment') : $one
    So what you pass as aguments will get used instead of the default "# Comment(s)".

    If you want only the number without the text, try passing only the "%" placeholder as the argument.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •