WordPress.org

Ready to get started?Download WordPress

Forums

[closed] How to remove page name in twentytwelve theme (15 posts)

  1. ChiefGeek
    Member
    Posted 1 year ago #

    Newb here.

    I'm putting together a site for a client and we want to remove "Home" from the homepage (directly under header).

    I've created a child theme (first time), so now in the editor is nothing except the style.css I created for the child theme.

    Anyway, how can I remove this? Here's a link to the site:

    http://www.brokerinabox.net

    Thank you.

  2. David Beja
    Member
    Posted 1 year ago #

    You could duplicate in your theme folder the file content-page.php, but make a small change where the title is written.

    You could change in the beginning of the file from this:

    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    		<header class="entry-header">
    			<h1 class="entry-title"><?php the_title(); ?></h1>
    		</header>

    to this:

    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    		<?php if(!is_front_page()): ?>
    		<header class="entry-header">
    			<h1 class="entry-title"><?php the_title(); ?></h1>
    		</header>
    		<?php endif; ?>

    This template is what is used to generate the page, and you are showing the header just if the current page is not the frontpage.

  3. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    It may be easier to do it in the CSS -- in which case, if you want the change only on the home page, add this to the new child theme style.css:

    body.home .entry-header {
        display: none;
    }

    If you want to remove that line on every page, change the above to:

    .entry-header {
        display: none;
    }
  4. ChiefGeek
    Member
    Posted 1 year ago #

    thank you WPyogi, that code worked, and was easy even for a noob like me! :)

  5. dradutu
    Member
    Posted 1 year ago #

    i just deleted the 3rd line altogether

    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    		<header class="entry-header">
    			<h1 class="entry-title"><?php the_title(); ?></h1>
    		</header>

    it's now

    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    		<header class="entry-header">
    
    		</header>

    it worked, not showing page name anymore.

  6. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    @dradutu - Make sure that you are not making any changes to theme files - they will be lost when WP is updated and it's imperative that you have an unmodified copy of the default theme for troubleshooting purposes. To make changes, you should use a child theme:

    http://codex.wordpress.org/Child_Themes

  7. dradutu
    Member
    Posted 1 year ago #

    thanks, i keep txt versions of my modified css, but i'll look into child themes, i know it's the way to go. thank you!

  8. Costume
    Member
    Posted 1 year ago #

    If I want to remove the page name from the About Us page and the Contact page but not the rest, then would my code be this...

    body.home .About Us .Contact .entry-header {
    display: none;
    }

    Thanks

  9. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    No, that's a logical guess, but those are not actually valid classes in the HTML for those pages - if you post a link to your site, someone can look for you - or look at the body tag on that page -- and you'll see the unique page id or class.

  10. Techno Tim
    Member
    Posted 1 year ago #

    Hiding with Css display:none; is meant to be a no no if over-used on a site.
    If you want to remove page name from all pages then use

    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    <?php if(!is_page()): ?>
    <header class="entry-header">
    <h1 class="entry-title"><?php the_title(); ?></h1>
    </header>
    <?php endif; ?>
    This should be in child theme in Twenty Twelve content-page.php, and if it is just the home page then as dbeja say's use is_front_page...

  11. travisbouck
    Member
    Posted 1 year ago #

    Thanks for the posts. Great help for newb. Really appreciate it.

  12. dianabyron
    Member
    Posted 1 year ago #

    Hi, I tried to change my Twenty Twelve HOME blog page to be called BLOG in my child theme CSS, using the method of WPyogi, eg.

    body.home .entry-header {
        display: BLOG;
    }

    Not knowing CSS coding very much yet, I guessed and found the section which seemed to be about basic page settings. I added the above code right after:
    `html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    vertical-align: baseline;
    }

  13. WPyogi
    Volunteer Moderator
    Posted 1 year ago #

    That's not valid CSS - see: http://www.w3schools.com/cssref/pr_class_display.asp

    You're trying to do something totally different - so please start a new thread per: http://codex.wordpress.org/Forum_Welcome#Where_To_Post

  14. dianabyron
    Member
    Posted 1 year ago #

    That W3 schools info is all foreign to me; I would not know how to use it, unless I spend a week or more studying it, which I don't have time to do. I'll just have to leave my page called Home. Thanks anyway.

  15. Klick Design
    Member
    Posted 1 year ago #

    @diana don't give up! if you start another thread your questions will be dealt with :)

Topic Closed

This topic has been closed to new replies.

About this Topic