WordPress.org

Ready to get started?Download WordPress

Forums

Creating Child Theme and Modifying Twenty Eleven (3 posts)

  1. mginsberg-wp
    Member
    Posted 2 years ago #

    I have been very frustrated seeing the following questions asked and answered, but the answers I've found so far are never step-by-step instructions - even in the codex. All I want to do is remove the name of each page and extra space above the content from all current and future pages, as well as the "leave a reply" form below the content. I gather that I should not edit the theme directly, but should do it in a child theme. However, I need step-by-step instructions on how to do that, not just - for example - "create a directory in your file manager section of the c-panel" (which I have). So besides my need to be taken step by step through creating a parent theme, I need to know exactly what code to delete from the style sheet afterwards. Many thanks in advance. Mark

  2. NateJacobs
    Member
    Posted 2 years ago #

    Hi Mark,

    I hope I can help you out with some step-by-step instructions.

    Once we finish these steps you will have a functioning child theme based on the TwentyEleven parent theme with the comments form removed and the page title no longer showing.

    You will need FTP access to your hosting account if you have already set up a website. If you do not know how to FTP into your account you will need to contact your hosting provider for instructions.

    1. On your computer, create a folder called mytheme-mark.
    2. Create a CSS stylesheet using the text editor of your choice. Not sure, two options listed below
      • If you use Windows: open Notepad.
      • If you use a Mac: open TextEdit and go to 'Format' in the menu bar. Click "Make Plain Text".
    3. Copy this code and paste it into the text editor.
    4. /*
      Theme Name:     Mark's Theme
      Theme URI:
      Description:    Mark's Child Theme of Twenty Eleven
      Author:         Mark
      Author URI:
      Template:       twentyeleven
      Version:        1.0
      */
      
      @import url("../twentyeleven/style.css");
    5. Save the file into the folder you created earlier (mytheme-mark) as style.css
    6. In your text editor create a new file
    7. Copy this code and paste it into the text editor.
    8. <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
      	<header class="entry-header">
      		<!-- <h1 class="entry-title"><?php the_title(); ?></h1> -->
      	</header><!-- .entry-header -->
      	<div class="entry-content">
      		<?php the_content(); ?>
      		<?php wp_link_pages( array( 'before' => '<div class="page-link"><span>' . __( 'Pages:', 'twentyeleven' ) . '</span>', 'after' => '</div>' ) ); ?>
      	</div><!-- .entry-content -->
      	<footer class="entry-meta">
      		<?php edit_post_link( __( 'Edit', 'twentyeleven' ), '<span class="edit-link">', '</span>' ); ?>
      	</footer><!-- .entry-meta -->
      </article><!-- #post-<?php the_ID(); ?> -->
    9. Save the file into the folder you created earlier (mytheme-mark) as content-page.php
    10. Upload the mytheme-mark folder using FTP into the wp-content/themes folder
    11. Log in to your site and go to the admin dashboard.
    12. Go to Appearance->Themes
    13. You will see the current theme listed first with any additional themes listed below. You should see the theme named Mark's Theme. Below that is a link that says "Activate". Click that link. Your theme will now show as the Current Theme
    14. In the admin dashboard go to Settings->Discussion
    15. Under Default Article Settings you will see a checkbox with text to the right that says "Allow People to post comments...". Uncheck this box.
    16. In the admin dashboard go to Posts->All Posts
    17. Hover your mouse over the title of a post. Click the "Quick Edit" link that appears below.
    18. Look to the far right and you will see a check box with text that says "Allow Comments". Make sure this box is unchecked. Do this for all your posts.
    19. Visit your site. You should now see that your pages have no titles and all your posts no longer have the "Leave a Reply" form.
  3. greggviro
    Member
    Posted 1 year ago #

    Thank you! This was very clear and helpful.

    If you could give an summary of what that code is doing then I'd be grateful. I'm trying to grok it, but I'm not there yet with PHP.

    Also, this doesn't seem to affect the "Home" page that comes with Twenty Eleven. I presume there is another PHP file one needs to create to override this? Any ideas?

    regards

    gregg

Topic Closed

This topic has been closed to new replies.

About this Topic