Support » Themes and Templates » gallery post format from twenty eleven in twenty twelve

  • Resolved rileybetka

    (@rileybetka)


    So I designed my website with the twenty twelve theme – I then learned that I want my gallery posts to look like the ones in twenty eleven (One photo showing in post that links to a gallery). It seems like there should be some way to copy that post format to the twenty twelve theme – I moved the content-gallery.php from twenty eleven to my twenty twelve folder with no success – can anyone help me figure this out!? Thanks in advance for the help!

Viewing 12 replies - 1 through 12 (of 12 total)
  • Michael

    (@alchymyth)

    Forum Moderator

    I moved the content-gallery.php from twenty eleven to my twenty twelve folder with no success

    what was the result?
    any error messages?

    did you adapt the content-gallery.php to match the functions and html structure of Twenty Twelve?

    can you post the full code of the adapted file?

    is the ‘post format’ set in your gallery posts?

    well I went into the functions.php and added “gallery” under the post formats – this will allow me to choose gallery when I make a post but something is definitely wrong because the post doesn’t look right and it makes everything else on my page disappear. I did not adapt content-gallery.php to match the functions and html structure of twenty twelve – I am don’t know enough about coding to do that – is that something that would be fairly simple or not? I have no idea…thanks

    Michael

    (@alchymyth)

    Forum Moderator

    a possible code for a content-gallery.php adapted from Twenty Eleven into a child theme of Twenty Twelve:

    http://pastebin.com/C9j0wBPH

    Awesome! It almost worked! It did everything I wanted it to except showing the featured image in the post. The post shows nothing but a post title – when you click on that it does what I want it to. Seems like maybe it just needs a minor change to work correctly – I have no idea what that change would be but… my url is http://www.daily-mash.com if you want to look at it. I really appreciate your help! Thanks!

    Michael

    (@alchymyth)

    Forum Moderator

    except showing the featured image in the post

    if you want the featured image at the same location as it shows in ‘normal’ posts, the code should go into here (line 16 of the pastebin code):

    <header class="entry-header">
    			<?php the_post_thumbnail(); ?>
    			<?php if ( is_single() ) : ?>

    YOU ARE THE MAN! thank you it worked!! So now one final question…can we make the image clickable also?? If not it’s ok but it would be nice if we could link the image to the gallery as well as the post title. Thanks again!

    Michael

    (@alchymyth)

    Forum Moderator

    to make the featured image link to the gallery (i.e. the full single post), change this line:

    <?php the_post_thumbnail(); ?>

    to:

    <?php if( is_single() ) { the_post_thumbnail(); } else { ?><a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(); ?></a><?php } ?>

    Awesome thank you so much!!! Apparently I need to learn php – I have been trying to read about it but seems to go over my head quickly.

    Could I ask you one more question? Is there a way to control the size of the featured image? for some reason it seems to want to show a full sized version and I would like it to display the “medium” picture size – any way I can specify that somewhere? Thanks for all of your help!

    Michael

    (@alchymyth)

    Forum Moderator

    the_post_thumbnail() takes the image size as a parameter:

    http://codex.wordpress.org/Function_Reference/the_post_thumbnail

    So I could go in and edit that line of php to look like this:
    <?php if( is_single() ) { the_post_thumbnail(medium); } else { ?>“><?php the_post_thumbnail(medium); ?><?php } ?>

    ???

    Michael

    (@alchymyth)

    Forum Moderator

    have you tried?

    should work – however, I can’t check the details of your code because it was posted without being marked as code, and was destroyed by the forum’s parser.

    how to post code – http://codex.wordpress.org/Forum_Welcome#Posting_Code

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘gallery post format from twenty eleven in twenty twelve’ is closed to new replies.