WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] gallery post format from twenty eleven in twenty twelve (13 posts)

  1. rileybetka
    Member
    Posted 1 year ago #

    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!

  2. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    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?

  3. rileybetka
    Member
    Posted 1 year ago #

    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

  4. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

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

    http://pastebin.com/C9j0wBPH

  5. rileybetka
    Member
    Posted 1 year ago #

    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!

  6. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    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() ) : ?>
  7. rileybetka
    Member
    Posted 1 year ago #

    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!

  8. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    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 } ?>
  9. rileybetka
    Member
    Posted 1 year ago #

    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.

  10. rileybetka
    Member
    Posted 1 year ago #

    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!

  11. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    the_post_thumbnail() takes the image size as a parameter:

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

  12. rileybetka
    Member
    Posted 1 year ago #

    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 } ?>

    ???

  13. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic