I haven’t tested this but in your archive.php file in the child theme use the following command to output the index.php file contents.
<?php
get_template_part( 'index' );
?>
This way you can have all the code in your index.php file but use it elsewhere preventing the duplication.
If you don’t want to create an archive.php file then use this filter.
add_filter( 'template_include', 'archive_home_page_template', 99 );
function archive_home_page_template( $template ) {
if ( is_archive() OR is_front_page() ) {
$new_template = locate_template( array( 'index.php' ) );
if ( '' != $new_template ) {
return $new_template;
}
}
return $template;
}
Related Posts:
- What is the link to my default “archive” page?
- Post formats template
- Same template for all the terms of a taxonomy
- Get link to a specific template file [closed]
- Use one template only for custom post type archives?
- What is the best practice to style archive page 2,3,etc differently than archive.php?
- Archive template limiting to 4 entries?
- Force WordPress to NOT display the manual excerpt
- How can I get all archive-URLs to use the same template?
- Archive only for /year/month, not terms
- Is it possible to return a specific tag archive/template as one of the search results?
- Tag Posts showing in wrong places
- Problem with permalink structure for WordPress custom post_type archive template
- How to use Class
in Java? - Is there any way to use get_template_part() with folders?
- How to edit contents of dynamic_sidebar()?
- Loading partial templates with AJAX/PJAX
- A special single page templates for posts under a category and all its child category
- Where to store some per-template preferences?
- add/apend templates ‘transparently’ via plugin to currently active theme or child theme?
- How do I override template-tags.php in twentyseventeen theme
- roots child theme can’t override header.php
- When calling wp_title(), do you have to create some kind of “title.php” file?
- Stream Video Player does not work with do_shortcode()?
- How does wordpress blocks?
- Which has more impact on site performance? Template overrides or hooks
- Subpage template
- Advanced Custom Fields – display when specific template used?
- What should I put on my index.php?
- How To Create WooCommerce Custom Template For Specific Product?
- How to Use Twig + Timber with Multiple Loops based on Meta Key Value
- Programatically create a page
- Missing .twig files in wordpress theme editor
- How to custom page template for the Gutenberg editor
- Use PHP templates as blocks
- Directly using pure JWPlayer JS (but NOT WP Plugin)
- Login page theming?
- I want to add a custom “all posts by author” by authors name. How?
- Advanced templating / WordPress as a CMS questions
- Redirect template based on permalink rather than $wp_query
- displaying category and subject posts
- How to duplicate a page template but make minor changes to the header?
- Custom templates vs page-slug
- get_template_directory() still returning path to previous theme
- URL / Templating system advice [closed]
- What’s the purpose of $wp_did_header?
- Trying to display short code content in template file with do_shortcode()
- how to remove pages loading with the archive templates
- Unable to add template to page set as Posts page in WP V 4.6.1
- Trying to create a template without navigation and footer
- Genesis – Adding custom hooks to display secondary navigation
- Can I assign a Folder for Post Formats, without it affecting WordPress’ fallback/hierarchical system?
- Custom Template page not loading get_header() correct?
- Easiest way to map content (in json) to the view (template)?
- Removing calls to noindex() and wp_no_robots()
- Query the database after get_header() has been included
- Does wp_mail work in frontend tempate file?
- Dynamically generated URL and Content page
- Organize template parts and page templates in folders in regards of template hierarchy
- Custom /Page/2/ Template Only
- Simplest Way to Build Custom Archives Page?
- wordpress – modifying template to show more posts
- Is there a template tag I can use to link to the archive page corresponding to the month that a post was published on?
- How to get all template files used for rendering a single post/page?
- How to insert “get_template_part()” based on Category ID?
- Display WordPress archive template page in 3 columns and not 1 column [closed]
- Home page not loading after editing header.php file
- Where do I edit what the user sees on my WordPress site?
- How can I include ALL post types in the_post_navigation() links, not just current post type?
- Template includes
- Two different single.php depending on source page
- Attachment URL for an image is loading direct image file
- User role templates
- Fixing media query
- I’ve installed example data on Nominee template but the published site shows another version of the site
- Language file doesn’t work (poeedit)
- Set og:image programmatically in custom single post with external images
- Displaying all posts of a category in full view on one page using their single.php template
- why does not showing my custom post category list in any template?
- Locating the HTML piece of code in wordpress
- Custom Template doesn’t output result when set as homepage
- Theme keeps going to default files [closed]
- How can I show contents of a template part inside of another page?
- How to serve a amp template
- Single page applications with WordPress: routes and templates
- Inserting javascript file into theme template?
- Creating custom post-listing templates in twentyseventeen child theme
- Display different list of “Custom Templates” for each Custom Page Type
- Submit form to another template (ugly url)
- Using file outside of template hierarchy for Twitter sign in authentication
- Page Templates Used in Custom Post Type
- List all pages using a specific template on a page
- Duplicated Template Does Not Load the Same as the Original Template File?
- Add multiple pages to theme customizer
- Blog template PHP [closed]
- wordpress showing all posts instead of date range
- load_textdomain won’t load my .mo file
- files disappearing from template
- why does blog page ignore template [closed]
- html blog template to wordpress template