WordPress.org

Forums

[resolved] Adding an Image on Homepage (not in a post) (11 posts)

  1. sueheap
    Member
    Posted 2 years ago #

    Hello,
    I want to ad an image to the homepage of a template I am working on. Here is the link:
    http://internetmarketinginvestors.com/wordpress

    If you look just above the footer there is whits space, this is where I want a banner type image to go.

    I know this requires php and I have search everywhere for an answer.

    Thanks in advance!!

  2. alchymyth
    Forum Moderator
    Posted 2 years ago #

    all details depend on your used theme;

    possibly in index.php, after this line </div><!--.container-->, somewhere before the line with get_footer(); you could add a conditional section with the banner output;

    example:

    <?php if( is_home() ) : ?>
    <div class="bottom-banner">whatever image html code</div>
    <?php endif; ?>
  3. sueheap
    Member
    Posted 2 years ago #

    Please excuse my ignorance but I am now to editing templates in such detail..the basic css changes I can do but this is throwing me.
    Here is the code from the main index template. I cant find the </div><!--.container-->..perhaps I am just missing it?

    [code moderated - use the pastebin for any code over the forum limit of 10 lines]

  4. alchymyth
    Forum Moderator
    Posted 2 years ago #

    index.php was only a guess as this is generally the main template for showing the front page.

    you might have a static page set to be on the front, and/or might be using a page template; all of which is virtually impossible to tell from looking at the html code in the browser - particlular if hte theme does not use body_class().

    the general idea would be to locate the template which is used for your home page;
    http://codex.wordpress.org/Template_Hierarchy

    and then locate the code section just before or after the main content div closes, before the footer starts - this might also be in sidebar.php - might need a bit of searching and trying.

    unfortunately, your theme does seem to be impossible to download without registering.

    http://codex.wordpress.org/Theme_Development

  5. sueheap
    Member
    Posted 2 years ago #

    I think the main template is also the index..
    here is what I got so far, and the image is not showing:
    css code:

    [please mark any code according to the forum guidelines for posting code]

    .bottom-banner{
    	position:absolute;
    	right:15px;
    	top:480px;
    
    	background:url(images/bottombanner.png);
    }

    [code moderated - use the pastebin for any code over the forum limit of 10 lines - how-to]

  6. sueheap
    Member
    Posted 2 years ago #

  7. alchymyth
    Forum Moderator
    Posted 2 years ago #

    does your theme have a home.php template?

    back to finding which template is used for the front page: http://codex.wordpress.org/Template_Hierarchy

    the posted code is extremely unlikely being used to show the front page.

  8. sueheap
    Member
    Posted 2 years ago #

    yes it does here is the bottom part...would I put that code just above the footer end tag?
    `</div>
    <div class="grid_7">
    <?php if ( ! dynamic_sidebar( 'Address' ) ) : ?>
    <!--Widgetized Content-->
    <?php endif; ?>
    </div>

    Put code here?

    </div>
    <?php get_footer(); ?>

  9. sueheap
    Member
    Posted 2 years ago #

    yes that is the file!!!

    if you look at the page http://internetmarketinginvestors.com/wordpress/

    its not showing..but it is showing something so thats progress!!

  10. alchymyth
    Forum Moderator
    Posted 2 years ago #

    you are right;
    this is how it shows in the browser:

    <?php if( is_home() ) : ?>
    <div class=&quot;bottom-banner&quot;><img src="images/bottombanner.png" alt="banner" /></div>
    <?php endif; ?>

    i.e. the code must have been html encoded; this happens sometimes when using various text editors.

    what editor are you using to edit the template?

    possibly add the code one </div> lower into the template;
    i.e. here:

    <!--Widgetized Content-->
    <?php endif; ?>
    </div>
    Put code here? NO
    </div>
    Put code here
    <?php get_footer(); ?>

    and try to copy the code from here:

    <?php if( is_home() ) : ?>
    <div class="bottom-banner"><img src="<?php echo get_stylesheet_directory_uri(); ?>/images/bottombanner.png" alt="banner" /></div>
    <?php endif; ?>

    and add it possibly using the dashboard - appearance - editor to edit the template; http://codex.wordpress.org/Editing_Files

  11. sueheap
    Member
    Posted 2 years ago #

    You are amazing!!! I got it up, just have to tweak a bit but OMG I owe you!!!
    Thank you!!!!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags