Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Hi I have a particular installation of WordPress, and I would like to know what is the name of the .php file to access to the blog.

So to sum up :

I have a navigation like that : HOME / PORTFOLIO / BLOG /CONTACT

By default, the user arrives on the home which use "front-page.php" which display excerpt of last entries.

I would like when the user click on "BLOG" they go to the list of posts. But what template should I use ? Beause If i use "home.php", my URL will be mysite.com/home, and not mysite.com/blog as I want...

Could you help me please ?

Thanks a lot !

EDIT this is my link:

 <li><a href="<?php echo site_url('blog');?>" title="blog">Blog</a></li>

How could home.php be loaded whit that URL ?

share|improve this question

2 Answers 2

Use home.php, that’s the template for the list of newest blog posts. It will not affect the URL.

If you go to wp-admin/options-reading.php and choose a page for Posts page – this page will use home.php. So create a static page, assign the URL /blog/ and select it in the settings. WordPress will take care of the rest.

share|improve this answer
    
<a href="<?php echo site_url('blog');?>">Blog</a> won't know it has to go to home.php –  Zaidar Sep 6 '12 at 9:05
    
WordPress will use home.php automatically if it exists. –  toscho Sep 6 '12 at 9:09
    
Yes but WordPress load "frontpage.php" before home.php so /blog is the same as my home ... –  Zaidar Sep 6 '12 at 9:11
    
Ok I find, I just check if I'm on home page with is_front_page! Thx for helping me ! –  Zaidar Sep 6 '12 at 9:26

Create two pages in WP admin >> Home and Blog

Now, code your front-page.php to show the excerpts. You can create a template for "Blog" name it as : blog-page.php write your code there and from WP admin change the template for "Blog" page you created. When you edit "blog" page in WP editor you will see "Page Template" in right column, from the dropdown you can select the template you created. This will work perfectly.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.