My understanding from reading the WP template hierachy was that when I set my a page as my posts page in settings > reading settings
that Wordpress should use archive.php. Instead it uses index.php
.
Obviously I could just put my code in index.php
and my site will work. But it doesn't seem like best practice, and I can't find any documentation of best (or good) practice.
Why doesn't Wordpress use archive.php
in this circumstance?
And would using index.php
as my posts page have unintended consequences?
Note: I've been using the _s theme as a base, but I've had the same problem with no theme base or parent.
The archive. php template is used to display monthly, category, tag, author, and other archive pages. Our custom archives page would be a single page that will bring all of your other archives together.
Required Files As mentioned earlier in the “What is a Theme” section, the only files needed for a WordPress theme to work out of the box are an index. php file to display your list of posts and a style. css file to style the content.
Log in to the WordPress Admin interface. In the left sidebar, hover over Appearances, then click Theme Editor. In the right sidebar, click functions. php.
Yes , you can modify from appearance -> editor, At right side you will get index. php , click on that file name so it will open in editor to modify.
you want to use home.php instead of archive.php as it is blog posts index page (set in WordPress Settings -> Reading). It is also in hierarchy on the third position from bottom.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With