Home>
I am creating an original theme for wordpress.
The front-page.php is made and the top is an original design.
I want to skip links from front-page.php to archive.php as a post list, but 404.php is displayed.

On the net, in Wordpress, the basic top page is a list of posts, so when creating an archive page, it was necessary to set up functions.php separately.
Check codex in functions.php

$arg = array (
    'has_archive' =>true,
);
register_post_type ('post', $arg);


I wrote that 404.php is displayed instead of archive.php.

The link in front-page.php is

/archive.php">See all articles


is.

The archive.php contains
How to make codex archive .

How can I get archive.php?

  • Answer # 1

    As a mechanism of WordPress, the accessed URL is assigned to the template in the theme by index.php.
    archive.php is a template for displaying the archive page and cannot be accessed directly.

    Use get_post_type_archive_link () to link to the archive page.

    get_post_type_archive_link ()

  • Answer # 2

    The front page has front-page.php in the theme, and the content is fixed

    I want to display a list page with a different URL instead of an article in front-page.php

    Answer with the premise of

    .

    archive.php is used forcategory pages such as/date/2019 and/tags/foo, so it cannot be used as a file list for all posts.


    From the management screen display settings

    Set the front page display to "Fixed"

    Create a suitable fixed page and set it to "Front page" or "Post page"
    (If you write content in php, both can be empty)

    The list of all posts can be displayed with the URL of the fixed page set as "Post Page" in the above procedure.
    The template file used at this time is home.php. (If not, index.php)

    Reference:
    Creating a static front page
    Management screen/Display settings

  • Answer # 3

    What happens to the output html?
    Is the URL displayed in the browser address bar as intended?
    If it is a link, instead of checking it from the beginning from the beginning, it is easier to isolate the problem and make mistakes easier if you check it by typing the URL directly and then put it in the link URL

Related articles