Forums

Make an image show in the sidebar on the blog pages only (9 posts)

  1. danaldinho
    Member
    Posted 2 weeks ago #

    Hey everyone,

    I want to add an image to my sidebar, but I don't want the image to show in the sidebar on my blog's homepage ( http://www.lilwaynehq.com ).

    So for example, when you view a page or a single post on my blog, I want the image to show in the sidebar.

    Does anyone know how I would do this?

    Also, this is the code which makes an image show on the homepage only:

    <?php if (is_home()) { ?>
    CODE HERE
    <?php } ?>

    So I think maybe it's just a little editing of the above code to get this to work.

    Thanks, appreciate it.

  2. samboll
    moderator
    Posted 2 weeks ago #

    Pages are controlled by your theme's page.php and single posts with single.php

  3. danaldinho
    Member
    Posted 2 weeks ago #

    Yes that's right, but there must be some code which I can add around my image to stop it displaying on the homepage right?

    That's what I am asking

    Thanks

  4. danaldinho
    Member
    Posted 2 weeks ago #

    Anyone got any ideas?

  5. sulaeman
    Member
    Posted 2 weeks ago #

    <?php if (is_single()) : ?>
    
    <?php endif; ?>
    <?php if (is_page()) : ?>
    
    <?php endif; ?>
  6. danaldinho
    Member
    Posted 2 weeks ago #

    Thanks sulaeman, but is there a way to make it so it's just one code for example:

    <?php if (is_single())&is_page()) : ?>
    
    <?php endif; ?>

    Thanks again, appreciate it

  7. doc4
    Member
    Posted 2 weeks ago #

    danaldinho,

    I believe you are looking for:

    <?php if (is_single() && is_page()) : ?>
    
    <?php endif; ?>
  8. danaldinho
    Member
    Posted 2 weeks ago #

    @doc4 - That didn't work mate.

    The image's aren't displaying on any of the pages or single posts?

  9. danaldinho
    Member
    Posted 1 week ago #

    Does anyone know the code to make something show on the single post and pages only?

    This code didn't work:

    <?php if (is_single() && is_page()) : ?>
    
    <?php endif; ?>

    Thanks

Reply

You must log in to post.

About this Topic

Tags

No tags yet.