On 5 sep, 11:16, Colin <[email protected]> wrote:
> Hi mindlube
>
> My comments are in line.
>
> On Wed, Sep 1, 2010 at 9:49 PM, mindlube <[email protected]> wrote:
> > Howdy all, Habari looks pretty cool and the admin interface is really
> > nice. I'm happy that my web host seems to meet all the requirements.
> > Two things not clear after trying the demo and reading  docs:
>
> > 1) I created a Page and disabled comments. The site however still
> > shows "0 comments" below the page. Is there a way to turn that  0
> > Comments off for Pages? This doesn't make sense for static content
> > like a Contact or Support type of page.
>
> This is going to be a "feature" of the theme you've selected.  Different
> themes do things in different ways.  If you're using the Habari supplied K2
> theme, then the simplest way of removing this is to comment out the
> following line in the page.single.php:
>
> <?php $theme->display ( 'comments' ); ?>
>
> This will of course remove this from ALL pages.  If you want to only disable
> this for pages with comments disabled, you'll need to delve into the
> comments.php file.
>
> If you're using another theme, let us know which one and we'll be able to
> direct you to the lines of code you need to change or remove for that theme.
>

Here's an exemple from my own theme.

Note that I'm far from being an expert at coding and there's probably
better ways to handle this...

First I replaced <?php $theme->display ( 'comments' ); ?> by <?php
$theme->comments_link($post); ?>
in home.php, entry.single.php, page.single.php, etc.

Then I added my own comments_link() function in theme.php:

        public function comments_link( $post )
        {
                // Get number of comments for this post
                $comment_count = $post->comments->approved->count;

                if ( $comment_count > 0 ) {

                        // If number of comments for this post is greater than 
zero

                        echo "<a href=\"{$post->permalink}#comments\">"
                         . "{$comment_count} " . _n('comment', 'comments',
$comment_count ) . "</a>";


                } else if ( !$post->info->comments_disabled ) {

                        // If zero comments and comments are NOT disabled

                        echo "<a href=\"{$post->permalink}#comments\">"
                         . "Add a comment</a>";

                } else {

                        // If zero comments and comments are disabled

                        echo "Comments disabled";

                }
        }

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/habari-users

Reply via email to