WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Removing Twenty Eleven Title Image for Static Page (10 posts)

  1. tdmac
    Member
    Posted 2 years ago #

    Hello all,

    I have added a static page by creating a new php doc called "page-static-tdmac.php" derived from the "page.php" available in my Twenty Eleven Templates. (I have created a child theme for my css styling, btw.)

    Anyway, I stripped it down taking out comments etc., but I'm not sure how to lose the uploaded header image, which I DON'T want to appear on my static page. I have another graphic I want to use for this page.

    Because I DO want the header images available on other pages, it doesn't seem like altering the css styling, is the solution as that will affect all occurrences of my header?

    I'm not sure how to remove or alter the appearance of my header image for this page specifically.

    This is the site:
    http://www.tanyamcclure.com

    Please forgive my non-proficiency. I'm new to wordpress, so in your replies if you could speak in layman's terms (while I do have some understanding of css and html), that would be appreciated! Thanks!

    Here's the php template I created for my static page:

    [Code moderated as per the Forum Rules. The maximum number of lines of code that you can post in these forums is ten lines. Please use the pastebin]

  2. Ravinder Kumar
    Member
    Posted 2 years ago #

    hi,
    if you want to remove header image only from your StaticPage tamplete then you can do so .the only thing with this solution is that all images get hide(might be you logo or menu image which you used)but as i check you website , you use css to add logo to your website not img tag so it will work.try it.good luck.

    <?php
    	/*
    	Template Name: StaticPage
    	*/
    
    ?>
    
    <style>
    .remove img{display:none;}
    </style>
    <span class="remove">
    <?php get_header(); ?>
    </span>
    
    		<div id="primary">
    			<div id="content" role="main">
    
    			</div><!-- #content -->
    		</div><!-- #primary -->
    
    <?php get_footer(); ?>
  3. alchymyth
    Forum Moderator
    Posted 2 years ago #

    how to lose the uploaded header image, which I DON'T want to appear on my static page. I have another graphic I want to use for this page.

    possibly try and use this other graphic as 'featured' image for that page - any featured image - if at least 1000*288px - will get used as header image for single posts or static pages.

  4. tdmac
    Member
    Posted 2 years ago #

    Thank you so much, ravinderk. I think that worked! I soooo appreciate the response. Now, I'm off to see if I can add the image I do want to use for my static page. Hopefully, I won't run into any problems.

    Thanks again!
    tdmac

  5. tdmac
    Member
    Posted 2 years ago #

    Well, hmmm... seems as though the ".remove img" is definitely causing all images within primary to be hidden. So, when I add an image using css "background: url)'...')" it won't show up. I'm playing around with it to see what other method I might employ. I added a div to house the image. But perhaps I need to try an href. I'm trying to work it out... Will let you know.

  6. tdmac
    Member
    Posted 2 years ago #

    sorry. not an href...

  7. tdmac
    Member
    Posted 2 years ago #

    So far, no luck. I tried setting the image I want for the splash page via "featured image" on from the pages menu in my dashboard. I still have the code from ravinderk in my custom php doc, which is great for getting rid of all images, but I can't seem to figure out how to just get rid of my header image alone.

    Can I say something in the code that essentially says, "ignore this specific file name"? Or tell it to not load the header.php doc? Or something along those lines?

    This seems to be so simple, yet I've gotten myself so confused. Any help appreciated in advance.

  8. alchymyth
    Forum Moderator
    Posted 2 years ago #

    remove that extra code;

    to 'hide' an image with css on any specific page, use the css class output by body_class() together with the specific selector for the image;
    http://codex.wordpress.org/Function_Reference/body_class

    example to hide the header image in a static page with the page template 'page-static-tdmac.php':

    .page-template-page-static-tdmac-php #branding img { display: none; }

    try to get familiar with using a tool such as Firebug http://getfirebug.com/ to investigate these kind of formatting problems.

  9. Ravinder Kumar
    Member
    Posted 2 years ago #

    hi,
    you can target specific header image.so,if you want to remove header image then give an css id to it.(header.php)
    for example

    [ Code moderated. For more than 10 lines of code please pastebin.com instead. ]

    and in static template:

    [ Code moderated. For more than 10 lines of code please pastebin.com instead. ]

    hope thisone work for you.gud luk

  10. tdmac
    Member
    Posted 2 years ago #

    Thank you soooo much, alchymyth. That totally solved the issue. I'm rapidly trying to familiarize myself with all things code and how to manipulate wordpress to my advantage! And have definitely been using firebug. I think I run into trouble with the basics of css, html. Plus, I'm at the bottom of the curve in my understanding of php!

    I very much appreciate the help both of you have given me. I can't wait to learn more and be able to pass my knowledge onto others in the forums as you have done for me. Thanks!
    tdmac

Topic Closed

This topic has been closed to new replies.

About this Topic