Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Comments, trackbacks & pings (http://forum.bytesforall.com/forumdisplay.php?f=19)
-   -   [SOLVED] How to style the comments title (http://forum.bytesforall.com/showthread.php?t=5299)

ahc Jan 14, 2010 04:56 AM

[SOLVED] How to style the comments title
 
How to style the comments title, putting the post's name in italic, for example? I mean: 1 comment to <em>the post title in italic</em> . Thanks

Zona Jan 27, 2010 02:04 AM

I'm having the same problem... Under the post (on the post page) I get the line "1 comment to [name of post]" followed by the comment that has been posted. I would like to change the text and formatting of this line.

Where does one do this?

Any advice is appreciated.

Thanks, Zona

juggledad Jan 27, 2010 06:11 AM

edit comments.php and change line 22 (version 3.4.5)
HTML Code:

        echo get_the_title() ?></h3>
to
HTML Code:

        echo '<i>'.get_the_title().'</i>'; ?></h3>

Zona Jan 27, 2010 03:34 PM

JD: Thanks for the reply. I tried editing comments.php with the text you gave me and I got the following where the phrase "1 comment to [name of post]" appeared:

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/thevega4/public_html/wp-content/themes/atahualpa/comments.php on line 24

I'm actually running Atahualpa 3.4.4 and the line you describe as 22 seems to be line 24 in this version given what came up in the error message.

Here is what I see in the preceding lines in my comments.php:

// You can start editing below:
?>

<?php // If there are any comments
if ( have_comments() ) : ?>

<a name="comments"></a><!-- named anchor for skip links -->
<h3 id="comments"><?php // Comment Area Title
comments_number(__('No comments yet to ', 'atahualpa'),
__('1 comment to ', 'atahualpa'), __('% comments to ', 'atahualpa'));
echo get_the_title(); ?></h3>

<?php bfa_next_previous_comments_links('Above'); ?>

I'd like the phrase on my blog to read:
[comment icon] comments (# of comments)

Any other ideas about how to possibly make this change?

Many thanks, Zona

pakacil Jan 28, 2010 10:42 PM

I tried to edit comments.php (line 19-22) and make change :

from...
HTML Code:

<h3 id="comments"><?php // Comment Area Title
comments_number(__('No comments yet to ', 'atahualpa'),
__('1 comment to ', 'atahualpa'), __('% comments to ', 'atahualpa'));
echo get_the_title(); ?>
</h3>

to...
HTML Code:

<h3 id="comments"><?php // Comment Area Title
comments_number(__('No comments yet to ', 'atahualpa'),
__('1 comment to ', 'atahualpa'), __('% comments to ', 'atahualpa'));?>

<em><?php echo get_the_title(); ?></em></h3>

it works like you want: 1 comment to the post title

is it a right php coding technique or not? I don't know :confused: but it works :)

tried with:
• WordPress 2.9.1
• Atahualpa 3.4.5.1
• Local (offline)

juggledad Jan 29, 2010 07:20 AM

pakacil,
HTML Code:

<em><?php echo get_the_title(); ?></em></h3>
will work the same as
HTML Code:

<?php echo '<em>'.get_the_title().'</em>'; ?></h3>
or
HTML Code:

<?php echo '<em>'.get_the_title().'</em></h3>'; ?>
it all has to do with knowing if you are putting the HTML inside or outside the <?php.......?>
If you are inside, use the ECHO and put the HTML in quotes, if you are outside, just put the HTML up.


Zona,
if I understand what you want, change the code to this
HTML Code:

<?php // If there are any comments
if ( have_comments() ) : ?>


<a name="comments"></a><!-- named anchor for skip links -->
<h3 id="comments"><?php // Comment Area Title
comments_number(__('No comments yet to ', 'atahualpa'),
__('comments (1) ', 'atahualpa'), __('comments(%) ', 'atahualpa'));
echo get_the_title(); ?>
</h3>

<?php bfa_next_previous_comments_links('Above'); ?>


pakacil Jan 29, 2010 09:21 PM

Quote:

Originally Posted by juggledad (Post 24112)
it all has to do with knowing if you are putting the HTML inside or outside the <?php.......?>
If you are inside, use the ECHO and put the HTML in quotes, if you are outside, just put the HTML up.

thanks juggledad...
now I know, why I messed-up mine when insert some custome code inside. I always missed the quotes. :o
because, even with very minimal skill, i just want to try and try :)

Zona Jan 31, 2010 05:48 PM

Thanks for the coding Juggledad. When I use your new coding I see the following:

"comments (#) [post title]"
This appears for any comment number 1 or more... when there are no comments nothing appears.

This looks good. I'd like to additionally remove the title. How would I code for that? Would something like this work?:

<?php // If there are any comments
if ( have_comments() ) : ?>

<a name="comments"></a><!-- named anchor for skip links -->
<h3 id="comments"><?php // Comment Area Title
comments_number(__('comments (1) ', 'atahualpa'), __('comments(%) ', 'atahualpa')); ?></h3>

<?php bfa_next_previous_comments_links('Above'); ?>


Many many thanks for all your help!

Zona Feb 3, 2010 11:57 PM

I've decided to take the "comment title" line out all together. How do I do that?

I tried deleting the entire section below from comments.php but that didn't work:

<?php // If there are any comments
if ( have_comments() ) : ?>

<a name="comments"></a><!-- named anchor for skip links -->
<h3 id="comments"><?php // Comment Area Title
comments_number(__('No comments yet to ', 'atahualpa'),
__('1 comment to ', 'atahualpa'), __('% comments to ', 'atahualpa'));
echo get_the_title(); ?></h3>


Anyone have ideas? Thanks, Zona

juggledad Feb 4, 2010 04:36 AM

Zona, what is your url pointing to an example. I just want to make sure we are talking about the same commens area?
What version of Atahualpa and WP?

Zona Feb 4, 2010 03:32 PM

When I open Editor>comments.php I see this in my browser's url:

http://vegansprout.com/wp-admin/them...heme=Atahualpa

Thanks JD

juggledad Feb 4, 2010 05:26 PM

sorry, let me rephrase (I just reread what I wrote and see how it could be misread)

Please list athe URL of one of your pages in your blog. Then tell me where on that page I can see the word Comment' that you want to change.

Zona Feb 4, 2010 08:44 PM

Hi JD:

Here you go is the page:

http://vegansprout.com/?p=432


This line only appears on the PAGE VIEW of a post and ONLY if there are COMMENTS. As my blog is new and I have no comments :(... yet, I put in a test comment to the post "Mushroom Barley Soup."

The line I am referring to is below the post after the line: "| Category: Soups | One comment [comment gif]"

It reads:
"1 comment to [Blog title]"

Thank you for the help!

juggledad Feb 5, 2010 05:31 AM

Ahhh this is the problem of multiple people posting in the same thread at the same time about what seems to be the same thing but isn't (wow, that was a mouth full)

If you want to get rid of the line '1 comment to Mushroom Barley Soup' you have to edit comment.php and locate the following lines (19-22 in version 3.4.5.1)
HTML Code:

        <h3 id="comments"><?php // Comment Area Title
        comments_number(__('No comments yet to ', 'atahualpa'),
    __('1 comment to ', 'atahualpa'), __('% comments to ', 'atahualpa'));
        echo '<i>'.get_the_title().'</i>'; ?>
</h3>

and remove them.

If you wanted to change the wording so it read ''Mushroom Barley Soup has 1 comment', you could change that code to this:
HTML Code:

        <h3 id="comments"><?php // Comment Area Title
        echo '<i>'.get_the_title().'</i> has ';
        comments_number(__('No comments yet to ', 'atahualpa'),
    __('1 comment', 'atahualpa'), __('% comments', 'atahualpa'));?>
</h3>


Zona Feb 5, 2010 08:10 PM

Beautiful JD! I deleted the line -- your instructions worked perfectly.
Thank you again and again and again.

All the best, Zona


All times are GMT -6. The time now is 02:08 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.