Forums

[NSFW] Post image is showing in custom sidebar which displays a page (7 posts)

  1. geezerd
    Member
    Posted 1 year ago #

    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!

  2. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

    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.

  3. geezerd
    Member
    Posted 1 year ago #

    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.

  4. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

    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 );
  5. geezerd
    Member
    Posted 1 year ago #

    Nope. Still there.

  6. geezerd
    Member
    Posted 1 year ago #

    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.

  7. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

    My guess is that it's a Loop issue.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags