WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] has_archive for default "post" post type (4 posts)

  1. tysonarmstrong
    Member
    Posted 3 years ago #

    Hi,

    I've created a bunch of custom post types which each have the "has_archive" key set in the register_post_type function array. This works fine.

    I have a different front-page, and want to essentially have \blog\ which will be an index of the default (but renamed) "post" post-type.

    I have put this in my function.php, and echoed the $wp_post_type variable and I can see the change has occurred, however it still has not enabled an archive page as desired.


    function add_blog_archive_page() {
    global $wp_post_types;
    $wp_post_types['post']->has_archive = 'blog';
    }
    add_action( 'init', 'add_blog_archive_page' );

    Is anyone aware of what I need to do to get this working?

    Cheers,
    Tyson

  2. tysonarmstrong
    Member
    Posted 3 years ago #

    To those who are hunting for the solution, I was able to construct what I wanted using the "static front page" functionality off WordPress. I'm using the instructions here:

    http://codex.wordpress.org/Creating_a_Static_Front_Page

    It seems a bit inelegant to create a blank page when it's really just a rewrite rule, but it works for now...

    Cheers,
    Tyson

  3. Frankie Jarrett
    Member
    Posted 3 years ago #

    Tyson, I'm also working to find a suitable solution for this.

    What about the 'rewrite' argument?

    $wp_post_types['post']->rewrite

    http://codex.wordpress.org/Function_Reference/register_post_type#Arguments

    //Frankie

  4. WPsites
    Member
    Posted 2 years ago #

    (oops, posted in the wrong thread)

Topic Closed

This topic has been closed to new replies.

About this Topic