0

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?

BeetleTheNeato
  • 391
  • 1
  • 4
  • 14

1 Answers1

1

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

Subhajit
  • 1,929
  • 3
  • 19
  • 21
  • Thanks! It worked. Kinda. The problem now is that the Loop is retrieving just one post (and a blank one, I guess that's the content of the page?). Should I make a custom query to fetch all the posts, mimicking the default behaviour of `index.php`? How do I do that? – BeetleTheNeato Jun 20 '12 at 20:52
  • I worked it out with this info: [link]http://stackoverflow.com/questions/4794622/wordpress-list-all-posts-with-proper-pagination Thanks a lot! – BeetleTheNeato Jun 20 '12 at 21:05
  • okay actually it was late night hence could't attend you for the second question. I went to bed. Anyways its good that you solved it. Most welcome :) – Subhajit Jun 21 '12 at 05:10