Need help with child theme creation
-
hi, i have set up my website http://www.circusreading.com but need to remove the space at the top of each page below the menu bar. I think it is due to the page title, which I do not want to show on each page. How can I get rid of this? I have tried everything on this site so far, but it still is not working and I am wondering if I have set up the child theme incorrectly. I have been able to edit the footer.php file using the child theme and this has worked fine, as I just copied the whole of the footer.php file to the child theme. But I dont think I need to do this for the style.css file?? Desperate for help before I tear my hair out.
What I have done so far:
– set up child folder. Editorial-child
– set up style.css (code)
/*
Theme Name: Editorial-Child
Theme URI: https://mysterythemes.com/wp-themes/editorial/
Description: Hayley edit
Author: Hayley
Author URI: https://mysterythemes.com/
Template: editorial
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
Text Domain: editorial
*/– set up the functions php (code)
<?php
function my_theme_enqueue_styles() {$parent_style = ‘parent-style’;
wp_enqueue_style( $parent_style, get_template_directory_uri() . ‘/style.css’ );
wp_enqueue_style( ‘child-style’,
get_stylesheet_directory_uri() . ‘/style.css’,
array( $parent_style ),
wp_get_theme()->get(‘Version’)
);
}
add_action( ‘wp_enqueue_scripts’, ‘my_theme_enqueue_styles’ );
?>– set up index.php file (code)
<?php
/**
* The main template file.
*
* This is the most generic template file in a WordPress theme
* and one of the two required files for a theme (the other being style.css).
* It is used to display a page when nothing more specific matches a query.
* E.g., it puts together the home page when no home.php file exists.
*
* @link https://codex.ww.wp.xz.cn/Template_Hierarchy
*
* @package Mystery Themes
* @subpackage Editorial
* @since 1.0.0
*/get_header(); ?>
<div id=”primary” class=”content-area”>
<main id=”main” class=”site-main” role=”main”><?php
if ( have_posts() ) :if ( is_home() && ! is_front_page() ) : ?>
<header>
<h1 class=”page-title screen-reader-text”><?php single_post_title(); ?></h1>
</header><?php
endif;/* Start the Loop */
while ( have_posts() ) : the_post();/*
* Include the Post-Format-specific template for the content.
* If you want to override this in a child theme, then include a file
* called content-___.php (where ___ is the Post Format name) and that will be used instead.
*/
get_template_part( ‘template-parts/content’, get_post_format() );endwhile;
the_posts_navigation();
else :
get_template_part( ‘template-parts/content’, ‘none’ );
endif; ?>
</main><!– #main –>
</div><!– #primary –><?php
get_sidebar();
get_footer();
The topic ‘Need help with child theme creation’ is closed to new replies.