WordPress.org

Ready to get started?Download WordPress

Forums

Want image to only appear on one page not all. (10 posts)

  1. fawkesblog2
    Member
    Posted 2 months ago #

    I have an image that appears on my pages. I would like to only have it appear on the landing page.

    it is the png file to the left of the screen at http:www.chrisfawkes.net

    Right now I have this in my page template.php

    <div class="frontpage"><img alt="" class="alignnone size-full wp-image-6993" height="508" src="http://chrisfawkes.net/artprints/wp-content/uploads/2014/01/frontpage.png" width="250" />
    </div>

    then this in my css to place it where I want on the screen.

    .frontpage {
        top:0;
        position:fixed;
        z-index:100;
        _position:absolute;
        _top:expression(eval(document.documentElement.scrollTop+
            (document.documentElement.clientHeight-this.offsetHeight)));
    margin-top: 170px;
        height:25px;
    float:right;
    left:-23px;
    }

    Only issue it appears on all pages. Appreciate any help just getting it on the landing page.

  2. fawkesblog2
    Member
    Posted 2 months ago #

    Sorry, direct link to my site is http://www.chrisfawkes.net

  3. Peninah
    Member
    Posted 2 months ago #

    I'm not seeing the picture in question, even when I look up just the picture url (using your source code)...

  4. wiresplus
    Member
    Posted 2 months ago #

    check the image file Chris - it's just a blank or transparent 250 x 508 png at the moment.

    What you need to do is use conditional tags.

    Codex

    How good are you at modifying the php files? beginner - moderate - expert?

    I'd put the php conditional tags in your theme's page template, with a condition to display only if it's the front page. Or, create a custom sidebar widget with the image in it.

  5. fawkesblog2
    Member
    Posted 2 months ago #

    Thanks wire plus. I have just been playing trying to add the tag to the page.php but I must be putting it in the wrong place.

    This is my page php

    <?php get_header(); ?>
    
    <div id="content" class="">
    		<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    		<div class="post" id="post-<?php the_ID(); ?>">
    
    			<div class="entry">
    				<?php the_content('<p class="serif">Read the rest of this page »</p>'); ?>
    				<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
    			</div>
    
    		</div>
    		<?php endwhile; endif; ?>
    	<?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?> 
    
     <div class="frontpage" ><img alt=""class="alignnone size-full wp-image-6993" height="508" src="http://chrisfawkes.net/artprints/wp-content/uploads/2014/01/frontpage.png" width="250"/>
    </div>
    	</div>
    <div class="logo"><a href="http://chrisfawkes.net/"><img alt="" class="alignnone size-full wp-image-5699" height="131" src="http://chrisfawkes.net/artprints/wp-content/uploads/2012/09/fwklogo4.png"  width="195" />
    </div>
    
    <div class="pagelink"><?php wp_link_pages('pagelink=Page %'); ?></div>

    Any heads up appreciated.

  6. wiresplus
    Member
    Posted 2 months ago #

    what's the number/pageID of the landing page?

  7. wiresplus
    Member
    Posted 2 months ago #

    assuming you mean the home or default page...

    <?php get_header(); ?>
    
    <div id="content" class="">
    		<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    		<div class="post" id="post-<?php the_ID(); ?>">
    
    			<div class="entry">
    				<?php the_content('<p class="serif">Read the rest of this page »</p>'); ?>
    				<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
    			</div>
    
    		</div>
    		<?php endwhile; endif; ?>
    	<?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?> 
    
     <?php if(is_page()){ ?><div class="frontpage" ><img alt=""class="alignnone size-full wp-image-6993" height="508" src="http://chrisfawkes.net/artprints/wp-content/uploads/2014/01/frontpage.png" width="250"/>
    </div> <?php }else{} ?><?php endif; ?>
    	</div>
    <div class="logo"><a href="http://chrisfawkes.net/"><img alt="" class="alignnone size-full wp-image-5699" height="131" src="http://chrisfawkes.net/artprints/wp-content/uploads/2012/09/fwklogo4.png"  width="195" />
    </div>
    
    <div class="pagelink"><?php wp_link_pages('pagelink=Page %'); ?></div></a>
  8. wiresplus
    Member
    Posted 2 months ago #

    or just add the Page ID in is_page([page ID Number Here])

  9. wiresplus
    Member
    Posted 2 months ago #

    Your image is not at http://chrisfawkes.net/artprints/wp-content/uploads/2014/01/frontpage.png or at least if it is it's blank.

  10. fawkesblog2
    Member
    Posted 2 months ago #

    The image is white on transparency so looks blank but shows on the dark site background, at least at my end.

    That makes sense. Will get into that later. Very much appreciate your help

Reply

You must log in to post.

About this Topic

Tags

No tags yet.