Support » Themes and Templates » Linking to a Static Page

  • Hello,

    I have a Custom Post Type (lets call is Gig) and on the homepage I want to create a link that will lead a visitor to a custom page that will display all “Gigs” on a single page. From what I understand, I need to create a page in the admin site in order to have the slug generated. I then create a static PHP page called page-gig.php and I write the code to display those custom post types, that is fine and it works. However, I want to avoid the step of creating the static page in the WordPress admin site since that page shows up in a search result and I don’t want that to happen since it’s just a place holder.

    Am I going about this the wrong way?

    Thanks in advance,
    Gary

Viewing 2 replies - 1 through 2 (of 2 total)
  • I need to create a page in the admin site in order to have the slug generated.

    Not with custom post types. When you register it, you just need to have has_archive set to true or to a string you want to use for the slug.

    From what I understand, I need to create a page in the admin site in order to have the slug generated. I then create a static PHP page called page-gig.php and I write the code to display those custom post types, that is fine and it works.

    Again, not with custom post types. You just need to have your template files named correctly.

    Superb, that helps immensely, thanks so much for the accurate and quick response!!

    Just as a note, I did have to resave the permalinks before I could hit the URL as I understand that regens some rules in the .htaccess file.

    Thanks again for your help!
    Gary

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Linking to a Static Page’ is closed to new replies.