• Resolved Dutchg

    (@dutchg)


    Yesterday, member jayseae taught me how to create my own text links for “share to facebook” and “share to twitter.” I love ’em. They are links that I put into my Twenty Twelve child single.php and index.php templates.

    See them in action here.

    Right now they’re at the bottom of the page. And that’s the reason for this post. I want to move them up so that they’re with the “Leave a reply” link. Ideally, the bottom of each post would look something like this:

    leave a reply
    share to twitter
    share to facebook

    This entry was posted in Uncategorized on December 5, 2013.

    I’m really green, but I’m not shy about trying new things (in the child templates), but I can’t figure out how to move those links up to where I want them. It seems that “leave a reply” function is a more complicated affair than I was expecting. I can’t even really find it in the php templates.

    Any ideas on how I might fine-tune the placement of those twitter and facebook links and get them up there with “leave a reply”?

    THANKS

Viewing 6 replies - 1 through 6 (of 6 total)
  • Getting adventurous now, eh? ??

    Okay – this is where it gets a bit more complicated.

    Very important. Make sure you are still in your child theme. See in the single.php template, where it has this line:

    <?php comments_template( '', true ); ?>

    That loads the comments template. It may not output much at all – and this is where it gets tricky. The comments template for your theme is comments.php. Copy that over to the child theme and start looking, if you want to mess with it. You can always remove it if you decide not to do anything.

    In comments.php, there is a line that looks like this:

    <h1 class="assistive-text section-heading"><?php _e( 'Comment navigation', 'twentytwelve' ); ?></h1>

    That line calls the language file to render the text, which will say (wait for it): Leave a reply.

    So if you want to add something, that’s where you would put it. However, notice that you have another couple lines in there, that talk about “older comments” and “newer comments”? You probably want to be careful with those, or you may interrupt that flow. Perhaps it would be best to move your Facebook and Twitter links prior to the “Leave a Comment” text. Or after the whole shebang?

    Thread Starter Dutchg

    (@dutchg)

    I’m ready to give anything a try. Thanks for the new info. A few questions:

    1) I loaded a child comments.php, and I found that line. You say it “calls the language file.” What exactly is that file, and where is it coming from?

    2) I’m happy not to potentially interrupt the flow of the comments code. I would just like to put my twitter and facebook links in the general vicinity of either “Leave a reply” or the “This entry was posted…” line. So I’m up for putting them in a place that’s easier (less potentially troublesome).

    As it stands now–and I just created a second entry so you can see–the twitter and facebook links are right on top of the previous blog entry’s title. I would like to move them up so they’re more clearly associated with the proper post.

    THANKS for all the help!

    Couple of things…

    First, I was looking at the wrong template (series of templates, actually). One important reason why child themes are important! So some of this may not apply. Sorry about that. Still, it may have some useful information, so:

    The language file (for you) is twentytwelve.pot, found in the languages directory under your theme directory (technically, in your parent theme directory, since you haven’t made any changes to it).

    You can read more about doing that here, in case you want to add it to your child theme and make any changes.

    The function that says:

    <?php _e( 'Comment navigation', 'twentytwelve' );

    Is actually calling the language function for “Comment Navigation”, and returning the localized string for that text – so if you have your language set to some other language, it would return that string instead.

    In the single.php template, you’ll see a line like this:

    <?php get_template_part( 'content', get_post_format() ); ?>

    This calls loads the content, into the posting format. What is the posting format? Well, it depends. The default one for that theme is in content.php. But you can define alternate templates. In that case, you would need to look and use that template instead.

    In content.php, however, you will see a line that looks like this:

    <?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a reply', 'twentytwelve' ) . '</span>', __( '1 Reply', 'twentytwelve' ), __( '% Replies', 'twentytwelve' ) ); ?>

    In a somewhat confusing fashion, it is named comments_popup_link. I don’t have statistics, but I suspect for most people, it just points further down the page. Regardless, this is likely where your link comes from – however, the default content.php looks a lot different than your page.

    For instance, the default one has that link in the header, where yours is in the footer. So perhaps you’ve already made some changes. Regardless, this is where you would want to make the changes, not where I was pointing you, so sorry for the misdirection!

    Thread Starter Dutchg

    (@dutchg)

    Excellent, jayseae! They’re just where I want ’em, now. Just need to do some fine-tuning. Thanks once again for your time and expertise!

    I did move that link into the footer back when I first got this thing going (December, I think)… I can’t recall how I did that. And the site’s been sitting idle since then, so just getting back to it.

    Again, thanks.

    Great, glad that it worked – I think the header/footer is what threw me off in the first place, but totally my fault for sending you down the wrong path. Hope I didn’t get you too lost, and glad that you’ve got it set now!

    Thread Starter Dutchg

    (@dutchg)

    Yeah, I just poked around a bit trying to see how I’d made that change back in December. Looks like it was some customization in the child content.php file. Something someone helped me with, no doubt. I’m more or less just flailing around with this–learning in tiny increments, but when I toy with it only every six months, I don’t always remember things very well. ?? Hopefully I’ll stick with it for a while now and keep learning…

    Thanks again. You were a tremendous help.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘move twitter, facebook links up near comment link’ is closed to new replies.