WordPress.org

Support

Support » Themes and Templates » Twenty Twelve » [Resolved] Image attachment page missing sidebar?

[Resolved] Image attachment page missing sidebar?

  • While making a child theme I noticed that the image attachment page was missing the sidebar. Either that or it should be 100% wide, it’s at 65% or something without a sidebar showing.

    Adding this fixes it, it looks odd at 65%

    .attachment .site-content {
        margin-left: auto;
        width: 100%;
    }

    I couldn’t check this on the demo page as it’s using jetpacks carousal, so if it’s just something I did, ignore this.

Viewing 14 replies - 1 through 14 (of 14 total)
  • you saved my tail .. I spent hours trying to figure out why the attachment images wouldn’t display correctly.

    Thank you.

    paulwpxp

    @paulwp

    Font hero

    @walkinman

    You don’t need that fix, it’s all good in TwentyTwelve latest, make sure you have the latest version. Also, there is no sidebar missing, it’s just the design decision, most themes do this on attachment page.

    Hey paulwp

    Thanks .. I do have the latest version of the theme .. in fact, I even downloaded a completely clean version 2 days ago and installed that .. had exactly the same problem. As soon as I added that code to the .css file, it resolved.

    I understand there is no sidebar, as the image.php file doesn’t call one .. but it appears, at least on my site, that the attachment page limited the width of the column to 65%, and all the content inside it as well.

    What was most bizarre is that a new page, with a brand newly created gallery, would work fine, when I previewed the page before publishing it. Once published, the attachment pages would consistently display the way described above.

    Thanks.

    @paulwp – if interested you can see my thread here:

    post

    paulwpxp

    @paulwp

    Font hero

    Hi walkinman

    http://core.trac.wordpress.org/browser/tags/3.5/wp-content/themes/twentytwelve/style.css#L1444

    body.template-front-page .site-content,
    body.single-attachment .site-content,
    body.full-width .site-content {
        width: 100%;
    }

    That above is from #L1441 to #L1445 of 2012 v.1.1 shipped with WP3.5

    It’s down below inside the @media screen and (min-width: 600px) which means anything wider than 600px the .site-content will be 100% width.

    at least on my site, that the attachment page limited the width of the column to 65%, and all the content inside it as well.

    If you got 65% width, then there is something wrong with your theme, you can check the body class of the attachment page see if it has .single-attachment in it or not.

    Also, I can’t find the 65% reference in the css too, where does that number come from ?

    Hey paulwp

    Thanks for your input. I got the 65% number from this thread .. to me, it’s a rough approximation.

    I found the code you posted above. When I add “.attachment .site-content” to it, things work correctly.

    body.template-front-page .site-content,
    body.single-attachment .site-content,
    .attachment .site-content ,
    body.full-width .site-content {
        width: 100%;
    }

    When I remove it, and just have the code as it comes with the theme, it does not work correctly.

    For me, either adding “.attachment .site-content” to the class you referenced, or adding it as listed in the OP above, things work correctly. And if I remove it, the problem returns.

    I don’t mean to sound like I’m arguing – I don’t know anything about code. But my theme is pretty clean – I haven’t changed anything at all, other than this specific snippet.

    fwiw – I’m also finding something weird with the way the images display as thumbnails, then move to the larger page:

    On this page,
    wildlife photos, you can see the grizzly bear photo is the final thumbnail … but if you click it, it doesn’t have a link to “previous”, and it as a link to “next”, which goes to the loon, the first image on the page. the porcupine photo, which is 2nd last on the page, doesn’t have a link to “next”. It seems like the attachment page displays are a little out of sync with the thumbs – even though each thumb is linked to the correct attachment.

    I know that’s off-topic, I just thought I’d mention it as I saw it just now.

    Thanks.

    paulwpxp

    @paulwp

    Font hero

    Your body class is missing .single-attachment this is the problem, and I have no idea what could have done this.

    On the separate subject you mentioned:
    The next/previous link on attachment page is not at fault here, what you see as a wrong order is because you see the order of images from the final gallery, but that’s not the real order, the way WP3.5 manages gallery is taking the ids and disregard the attachment’s order.

    There is a ticket working on next/privious link but it’s due for WP3.6

    Meanwhile, if you want to use and see the correct order, you have to manually arrange the order in media module, then use plain gallery shortcode ( without ids, the same way before WP3.5 )

    Hey paulwp

    Thanks – I’ll try manually uploading the css file for the theme and see if it is any different – but I did reinstall the theme completely already, so it could just be missing from the file?

    I wondered if something like you describe was going on with the gallery. It’s no big deal to me right now, this site is in its early stages and that’s far from an issue for me. Just thought I’d mention it.

    Excellent help, thank, you.

    paulwpxp

    @paulwp

    Font hero

    Just so you know, the .single-attachment is not anything hardcoded into the theme, the theme put these classes into <body> by calling the body_class() function.

    body_class() is WP’s core, to be exact it’s from wp-includes/post-template.php , So if you have this file healthy (normal) then the theme must have all the classes in <body> tag for each page.

    Chances are there is plugin conflict, something that messes with this, or you got a corrupted wp-includes/post-template.php during upgrade, can’t tell for sure.

    In the first version the attachment page content was only 65% or so, basically the same layout as the main pages, but the sidebar was missing.

    I don’t know if it was intentional or not, I didn’t see a reason to use only 65% of the page unless the sidebar was shown, that’s why i posted this.

    In the newest version it’s showing 100% width no sidebar and looks fine.

    I’m working on a new website and instantaneously clicked the upgrade link for 3.5 version. Then my sidebar disappeared… and only the Home icon, Dashboard and Profile was left. This was the 2011 Theme. I can’t see Posts, Pages, Appearance, and so I can’t do anything. It was normal prior to clicking on the upgrade link. And I have no child version of it. I’m not a techie. Please help. Here’s my domain: successmoneyonline.com

    Thank you.

    Totally different issue and theme, you should start a new topic

    I’m using Twenty Twelve. The sidebar disappears on the photo gallery attachment pages. I need it to remain. Does any one know how to make the adjustment for this?

    esmi

    @esmi

    Forum Moderator

    As per the Forum Welcome, please post your own topic.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘[Resolved] Image attachment page missing sidebar?’ is closed to new replies.
Skip to toolbar