BeetleTheNeato
BeetleTheNeato

Reputation: 389

Wordpress - Homepage and inner page both must list recent posts: how to link the inner page in the home?

I'm having trouble with Wordpress. The homepage of the site I want to do has a menu and a link called "articles" in it. My problem is that I don't know where should "articles" link to.

On my homepage, which is using the template front-page.php, there is a slider that shows the recent posts. I'm using The Loop to get the posts and display them. Then there's the template for the "articles" page which must also list the recent posts, but using a different layout. I already coded all the HTML and included The Loop, but I don't know how to display that page in Wordpress.

For example, I tried to name the file home.php and then pointed my link to it. But when the page loads, it throws an error, Call to undefined function get_header(), as if Wordpress functions weren't loaded. I guess they weren't really loaded, but why? The file is inside my themes directory, why doesn't my approach work?

Upvotes: 0

Views: 2113

Answers (1)

Subhajit
Subhajit

Reputation: 1987

The steps would be like this :-

  1. Create a blank page named Articles in wordpress.
  2. Take the slug name or page ID of that page.
  3. in the articles link provide that page link.
  4. Now create a new custom template or you have already created i.e. home.php
  5. At the top of home.php give a template name.
  6. now assign that template to the Articles page which you have created.

Follow the above steps like this you can assign custom codes and assign it to a page. FYI here are the links of template creation tutorials.

EDIT: Forgot to place the tutorial links

Upvotes: 1

Related Questions