• For some reason in twenty twelve, if you make a post as content type standard it will show the post title at the top of the post, most of the other ones (image, link etc) seems to show the title at the bottom of the post. I had someone help me create a customer PHP file so I could use the Gallery option from twenty eleven with my theme. All I want to do is make it so when I post a “Gallery” that it will show the post title on the TOP of the post rather than the bottom: here is my Content-Gallery.php – please let me know if you can help! Thanks!

    https://pastebin.com/4RgAjYtg

Viewing 10 replies - 1 through 10 (of 10 total)
  • from the template code (which looks like an unedited 2011 template which should actually cause error messages if used in a Twenty Twelve theme), I would assume to see the title at the top.

    might be a formatting issue for which it would really help to see a gallery post live in your site.

    it might also help if you can post the code of index.php and single.php of your (child theme of) Twenty Twelve.

    Thread Starter rileybetka

    (@rileybetka)

    you were the one who helped me create it! Nice to see you again! it’s https://www.daily-mash.com
    I have not changed anything in my index.php or single.php in my child theme but I would be more than happy to post them if that helps! let me know…thank you!

    I can see what you mean – example post ‘check out these cars’

    but what you see on top of the title is the ‘featured image’ of that post; and because the post has no content apart from the gallery shortcode, there is nothing shown below the title.

    the content-gallery.php does not seem to get triggered to show the gallery images.

    Twenty Twelve actually has not enabled the ‘post-format’ ‘gallery’;

    for this, edit functions.php of your child theme;
    add:

    function twentytwelvechild_setup_post_formats() {
    
    	// This theme supports a variety of post formats.
    	add_theme_support( 'post-formats', array( 'gallery', 'aside', 'image', 'link', 'quote', 'status' ) );
    }
    add_action( 'after_setup_theme', 'twentytwelvechild_setup_post_formats', 20 );

    then for each post with a gallery shortcode, edit the post, and tick ‘gallery’ under ‘Format’ in the right column (below the ‘publish’ box).

    this sets the post-format of that post to ‘gallery’ which then gets used in index.php and single.php to call the content-gallery.php template part.

    instead of a copy from Twenty Eleven, try this code for content-gallery.php in a child of Twenty Twelve: https://pastebin.com/7WbDs9v4

    possibly add this to style.css of your child theme (it is copied from Twenty Eleven):

    /* =Gallery
    ----------------------------------------------- */
    
    .format-gallery .gallery-thumb {
    	float: left;
    	display: block;
    	margin: .375em 1.625em 0 0;
    	max-width: 100%;
    }
    Thread Starter rileybetka

    (@rileybetka)

    I’m sorry I pasted the php from the wrong place earlier – this is the one that you set up for me: https://pastebin.com/1QF070wY

    so I should just add the css and it should move the post title to the top?

    so I should just add the css and it should move the post title to the top?

    you can add the css;
    this will only take effect when you also set the post to have the ‘gallery’ post-format.

    to be able to do this, you need to add the code to functions.php;

    then edit each post with a gallery shortcode, and set the ‘post-format’…

    Thread Starter rileybetka

    (@rileybetka)

    I understand everything except “edit each post with a gallery shortcode” I’m not sure what you mean by that – I remember you had me edit functions.php when we were setting up the content-gallery.php – the gallery function is working as I want it to and it will allow me to choose “gallery” as the post type – I entered the css and it didn’t make the post title go to the top so I am assuming it has to do with this shortcode that you speak of – thank you for all of your help!

    for the ‘content-gallery.php’ to get used for a post, this post must have the ‘post-format’ gallery – which you need to tick under dashboard – posts – edit post format

    Thread Starter rileybetka

    (@rileybetka)

    yeah I have been doing that part but the post title still shows at the bottom

    the order is:
    – featured image
    – post title
    – excerpt (or gallery image and excerpt)

    if your post does not have any text content, then the excerpt is empty and it might seem that the title is at the bottom )(which is not the case).

    if you want to have that output order different, you might need to move line 16 of your last posted pastebin:

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

    to after line 23:

    <?php endif; // is_single() ?>

    Thread Starter rileybetka

    (@rileybetka)

    oh ok – thank you very much!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Move post title for content-gallery.php to top of post’ is closed to new replies.