Good morning, everyone!
I sure would love some help with this.
Thank you, kindly.
To save you some time, please know that I have already researched this in the forum. But there’s something I’m not quite understanding to make this happen correctly. I did go ahead and make my changes to the parent functions.php file. And it works. But I want to do this properly and put my changes in the child file instead. Thanks!
The function is pluggable, so you can paste it into your child theme and modify it.
function twentyeleven_posted_on() {
printf( __( '<span class="by-author"> <span class="sep">Posted by </span> <span class="author vcard"><a class="url fn n" href="%5$s" title="%6$s" rel="author">%7$s</a></span></span>', 'twentyeleven' ),
esc_url( get_permalink() ),
esc_attr( get_the_time() ),
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() ),
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
esc_attr( sprintf( __( 'View all posts by %s', 'twentyeleven' ), get_the_author() ) ),
get_the_author()
);
}
for instance
from the second line, I removed
Posted on </span><a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s" pubdate>%4$s</time></a>
which gets rid of the date. Understand that the printf line controls the output
the %1$s is a placeholder corresponding to the first line underneath, which is
esc_url( get_permalink() ),
Thank you. What I’m also wanting to modify is the date and time stamp. How do I move the date and time stamp to the line beneath the comment author? That really perplexes me.
The function above that we were working on has nothing to do with the comments. It is only for the actual post headers.
I just want to verify that we are now, in fact, talking about actual comments left on posts/pages?
Ugh, yes. My mistake in making this unclear. The first section of code I pasted into my OP was to show my existing child functions file. I needed to add the second section of code to that file, but couldn’t figure out which part to paste into it without getting an error message.
It’s the comment information I’m needing to modify … removing the link, etc. That’s easy enough. But I don’t know which part to paste into the child file. And I also can’t figure out how to place the date and time stamp underneath the comment author.
Sorry for the confusion.
YOu would need the entire twenty_elevn comments section
function twentyeleven_comment( $comment, $args, $depth ) {
through
<?php
break;
endswitch;
}
And the part you would focus on would be
/* translators: 1: comment author, 2: date and time */
printf( __( '%1$s on %2$s <span class="says">said:</span>', 'twentyeleven' ),
simply inserting a line break should work
http://test.rvoodoo.com/?p=1 is my testing site, wit those changes in place
http://pastebin.com/RJ7rksY3
is the code, including both changes we discussed. See line 40 for the line break I inserted
Very, very helpful. Thank you so much! Now I can just do these changes in my child functions file, which is much cleaner.
About breaking the time and date onto a new line, I added display: block to the css for time and it worked. 🙂
Thanks, again. The functions file is something I’ve tried avoiding, but obviously I’m at a point where I could defeat the purpose of having a child theme if I’m not consistently doing this will all of my files.
If I may be so bold as to approach you with another tool….
http://vudu.me/2uc
I disuss a functionality plugin here. If you are starting to dabble with functions.php, you should also know about this!
If you start getting more advanced with what you need to do with your theme, it’s good to know about the functionality plugin. Code that would work in your functions.php file will also work in a plugin
BUT, here’s how I think about it
If I am modifying the 2011 theme (or any theme) specifically, the function goes into functions.php. If the code won’t do anything away from the theme, functions.php is the right place for it.
But, if I’m making some sort of function that I want available regardless of theme, I put it into my plugin.
Basically all of the code we went through up above is specific to 2011, so you’ve done it exactly right. I just wanted to offer up some more info in case it is useful to you!
Awesome, Voodoo. This is something I never would have considered. You are absolutely right. This makes a lot of sense. Since I do plan on developing some blogs loosely based on my current blog’s design, creating my own plugins would be a great, great tool. For example, my comments will always be displayed in the same way, since this is a very personal design preference that I intend to replicate across all of my websites. But other things will be more unique to each design, and therefore there’s no need to create a plugin. This is just awesome.
And quickly (well, hopefully) … if you reading this, the last thing I need to do for my comments is move the date line for each comment below the comment text. I was able to successfully break the date line onto a new line and then right-align. But I am totally confounded as to how to accomplish what should be a fairly simple task. Any suggestions?
I’ll share a link to my blog once it’s up and running this Sunday, so you can see what I’ve done.
Thanks!
I think I have this figured out. I copied the entire meta footer and placed it beneath the comment-content div in the functions file. And now I just need to remove bits and pieces without causing any errors. I’ll post back once it’s done.
This is probably a hatch job, but it’s the best I could come up with. Once I found the comment-content div in the functions file, I copied the entire meta footer code and placed a copy beneath that div. And then I removed one small little bit of PHP within the printf function. But there is still remnant code that doesn’t need to be there. I’m just not sure what I can safely remove.
So now the comment author prints first, followed by their comment, followed by the comment date/time line. I’d love some input on how to clean this up, though:
[57 lines of code moderated as per the Forum Rules. The maximum number of lines of code that you can post in these forums is ten lines. Please use the pastebin]