Twenty Fifteen: Add credit for featured image

Featured Theme Forums TwentyFifteen Plus Twenty Fifteen: Add credit for featured image

This topic contains 12 replies, has 2 voices, and was last updated by  Signe 6 months ago.

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
  • #17650


    I’ve purchased the Twenty Fifteen Plus and am really happy with it, as it addresses almost all of the fixes I needed for the default version, such as sidebar, post excerpts etc. You’ve done a splendid job!

    However, before I switch to it, I do need to address two more fixes, and thought maybe you could help me with advice.

    1) Featured image credit: On my current blog I’ve edited the code of content-single.php and the CSS to be able to display the credit on featured blog images using the Caption field from the Media gallery. This is an absolute must-have for me; do you have any advice how I could implement this into Twenty Fifteen Plus while still maintaining the ability to receive future child theme updates?

    2) Is it at all possible to swap the Comment box and the Previous/Next box, so that Previous/Next appear right under the post content? I edited a screenshot of the theme’s demo to give you an idea of what I mean. I don’t think I know how I would go about doing this.

    Thank you very much for your time!



    Hi Signe, here’s how you can move the post nav above the comment area.

    1. Copy single.php from Twenty Fifteen to the Twenty Fifteen Plus directory
    2. Open it and find this section of code

    // If comments are open or we have at least one comment, load up the comment template.
    	if ( comments_open() || get_comments_number() ) :

    3. Cut that section of code out and move it under the line that reads

    // End the loop.

    Make sure it’s between that and the closing php tag.
    4. Save and close it.
    I’ve done it for you in this pastbin if you would rather just copy it

    Since Twenty Fifteen Plus doesn’t include this template file it won’t be overwritten if you upgrade.

    As for the featured image credit if you have made changes to content.php you’ll need to backup those changes when you update unless you’ve somehow hooked into the content file.

    The custom CSS could be added using many different custom CSS plugins such as or if you use Jetpack it comes with a custom CSS module, either of these would allow you to keep CSS changes through udpates.

    PS: I’m going to be releasing a small update to twenty Fifteen Plus in the next few days which fixes padding above the featured image that was accidentally left over and a few other small items.If you want to remove the padding yourself open style.css and find

    /* Optional padding above featured image and credits alignment */
    .hentry.has-post-thumbnail {
        padding-top: 8.3333%;

    and remove it.

    Whenever I release an update for any theme I’ll list what template files have been changed, I doubt there will ever be any changes to content.php so more than likely you’ll be able to skip that file when updating.




    thanks so much for all the help! I’ve implemented the changes as you suggested, and it’s working brilliantly. I also did the CSS fix, and it does indeed look better without that padding.

    Because my featured image caption code required changes to functions.php I expect I’ll need to update it at some point, but it’s totally worth it, given how nice this theme is!

    I did run into another snag, though. My old blog theme had a special template for the posts page with a custom header, so that it would show the site title and description as the blog name, not my own as it is on all other pages. Here’s an image to show what I mean.

    Due to WordPress changing how it treats the default page for posts, I wasn’t able to get this to work. I understand I need a home.php file that would call that custom header I have, but I failed at making one.

    I know this is out of your jurisdiction, but perhaps you have a tip?



    If the credits code is added through a function and no other template files are changed then it could be easily added with a functionality plugin.

    As for the custom header on blog post pages I’d need to see the code you tried to use to achieve this. I would think it could be done with a simple if statement added to the header

    This would be a change you would need to backup in case of updates though.



    Thanks! The credits code also involved calling the function in content-single.php that I specifically created, as well as some custom CSS I added through the Jetpack module. I’m happy with it for now.

    Now, with the custom header it’s a bit more complex than that.

    Here’s how I did it before:
    1) create a header-blog.php template in which I substitute the site title and description with one that belongs to the blog (Here’s the relevant bit in pastebin);
    2) create a page-blog.php template, name it Blog, and make it retrieve my blog header I created, via the get_header function;
    3) assign the blog page template to the page in my WordPress that I’ve assigned to show my blog posts. This way the search, archive, and all other blog content carries the correct header.

    Now it’s only that last step that isn’t working any more. With this method I did get my Newsletter page to carry the custom header; however, the blog posts page doesn’t accept custom templates any more; according to this blog post at least, blog page is now designed via home.php, if I got that right. But I’m not sure how to make a home.php that would do the trick… I hope this makes sense.

    Edit: I’m on 4.2.1



    I’m a bit confused to what the custom header does. Does it display the post title instead of the blog title? Or does it show a predefined title for all single blog posts pages “a daily blog of 365 science stories”

    I’ll explain it better.

    On the homepage you want it to display the site title and description as it normally would, but after clicking on any blog post you want it to display
    “A Common Year
    A daily blog of 365 science stories”

    instead of the site title and description, is this correct?



    Hi, yes, that’s almost right! I’m trying my best not to be confusing :)

    The custom header changes the site title and description to display the blog title and description that I have specified manually in the template.

    It does so not just when you are on a single blog post, it’s when you are at any part of the blog section of my website – whether it’s search, archive, single post, or just the front page of the blog which shows a list of posts.

    As I said, previously I got that to work simply by using a page template – in fact right now I’m using a template like that to show the custom site title on my Newsletter page.

    But it appears that WordPress has done away with that option for the page assigned for displaying blog posts. You know, when you assign a static page to be the home page, and a different page to display the blog itself (on my website it’s

    I made a couple of screenshots of my CMS. You can see the Newsletter page has my blog header specified, and shows it up nicely when you visit it. But blog page doesn’t let me do this.



    I’m almost positive this can be done with a few lines of code. Could you post your home template to pastbin and let me know what the file name you used for it is.

    Just to be sure I have this right.

    Only the home template uses the regular site title and description, all other pages, single post pages, archives and blog post list use the hard coded one, do I have it right?



    Not quite. The way my website is set up is that it has a home page and several static pages (background, portfolio etc.) that all carry the regular site title and description.

    Then there is /blog, which is supposed to carry the blog title and description, hard-coded.

    As I understand this, in order to do what I’m trying to do, there needs to be a home.php template which would call for my custom header; because home.php is what WordPress now uses as a template for the Posts Page.

    My problem – I don’t know how to build the home.php template so that it works with Twenty Fifteen. Because once that is in place, it would indeed just be one line of code!



    Ok I think I got confused with all the talk about home.php and custom headers. You might be over-complicating it, WordPress will use any page you create as a front page or for the blog posts page, it doesn’t need to be named home.php, but WordPress will use home.php (front-page.php as well I believe) by default if it’s available.

    You don’t need a special front page template that calls for a separate custom header, you only need to add a conditional to the current header to display the titles the way you mentioned.

    If you’re happy with the way your front page looks now, then you only need the code in header.php. I added my own code to the header with a static page set on my local site and it seems to be working fine. make a backup of header.php then open the the one in Twenty Fifteen Plus and replace the code in it with this.
    Let me know if this gives you the titles you’re looking for on the front page, blog post page, portfolio etc. If I missed a template file it can be added easily.



    I just don’t know enough about php to come up with a smart solution like that :)

    I did exactly as you said, and double-checked that I haven’t missed any of the code, but I ended up with this error:

    Parse error: syntax error, unexpected 'endif' (T_ENDIF) in /home/pausetow/public_html/ on line 1

    What did I mess up now?



    Line 1 of header.php should not be endif, looks like a copy paste error.

    I’ve zipped the header file you can download it here backup your original header file and replace it with the one in the zip.

    If you don’t use FTP or are having problems getting it to work, use the contact link at the top of this site and I can do it for you if you want.



    That worked brilliantly! I don’t know what went wrong previously, I copied and pasted a few times and it looked just like the one in pastebin, but it turned up an error. This one worked fine.

    Thank you SO MUCH! My website is perfect now.

Viewing 13 posts - 1 through 13 (of 13 total)

You must be logged in to reply to this topic.