• I’ve set up a sidebar section that displays the contents of a page in it.
    For some reason, when you click on an image (with a link to view a bigger version) the new page you go to has that image showing as the first paragraph in that section.

    Here is the site: http://www.seanborggoesla.com/

    Click on the first image (currently a half naked hottie. Sorry if offended, it’s not my site, I just do the back end).
    When you go to the new page, the image is in the sidebar, too, as a paragraph with the class of “attachment”.

    This is the code I used in the sidebar:

    <div id="diduhear">
    <?php
    $page_id = 19052;
    $page_data = get_page( $page_id );
    $content = $page_data->post_content;
    $title = $page_data->post_title;
    echo "<h3>" . $page_data->post_title . "</h3>";
    echo "<div id=\"thetext\">";
    echo apply_filters('the_content' , $page_data->post_content) . "</div>";
    ?>
    </div>

    Thanks in advance!

Viewing 6 replies - 1 through 6 (of 6 total)
  • On the assumption that you want to remove the image from the sidebar of that page, something like:

    <?php
    $page_id = 19052;
    if( !is_page($page_id) ) :?>
    <div id="diduhear">
    <?php
    $page_data = get_page( $page_id );
    $content = $page_data->post_content;
    $title = $page_data->post_title;
    echo "<h3>" . $page_data->post_title . "</h3>";
    echo "<div id=\"thetext\">";
    echo apply_filters('the_content' , $page_data->post_content) . "</div>";
    ?>
    </div>
    <?php endif;?>

    should work – although I’ve not tested it.

    Thread Starter geezerd

    (@geezerd)

    No, doesn’t do anything, image is still in there.

    When you click on any image in any post, it goes to a single post page and displays the bigger version of the image that you clicked on.

    It goes to single.php, I think. The theme has no image attachment page template.

    Oh – I think I know what it might be…

    $page_id = 19052;
    $page_data = get_page( $page_id );

    Try something like:

    $mypage_id = 19052;
    $page_data = get_page( $mypage_id );
    Thread Starter geezerd

    (@geezerd)

    Nope. Still there.

    Thread Starter geezerd

    (@geezerd)

    I just killed it with CSS, since it had a class.

    Still wondering why it does that, though.

    Probably something to do with the fact that the program is taking the image you clicked on and displaying it as the first paragraph in a blank page, and since that code in the sidebar is also a page, really, it puts it there, too, for some reason.

    My guess is that it’s a Loop issue.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[NSFW] Post image is showing in custom sidebar which displays a page’ is closed to new replies.