Questions about pages and links in wordpress

1

I'm developing my first theme, without having any previous experience with wordpress, I have some doubts ...

I will have to have several pages in my theme, I saw that I can separate in different files ("pag1.php", "pag2.php", etc ...), as I do the pointing to these pages in the site menu by admin from wordpress, so that you have friendly urls (ex: link ), I did not find anything of the kind in admin of WP, nor references to pages in functions.php or somewhere else.

These other pages will also be given parameters by the url, for example: link but this has already seen basically how to solve ...

If I asked the wrong session to forgive me, I confess that I did not do much research here in this forum yet.

    
asked by anonymous 09.03.2016 / 20:46

1 answer

0

Actually, they are two different things. There is the page that is where you edit the content, defines which url to use, and so on. and there is a file of your theme that wordpress will use to display the information on your page.

Wordpress has a way to find out which is the best file to use, to better understand you can read here , but this chart might give you an overall idea much more quickly .

There is a way to assign a file from your theme to your page that is using the same slug , ie if your page address is /sobre wordpress will try to find page-sobre.php , but this will bind you both, and if you need to change the address of the page, you may end up having problems. It's best to put something like this in the beginning of your file.

<?php
/*
 * Template name: Nome do seu template
 */

And on the edit screen of your page choose the template you created. Hope it's a good start for you.

    
10.03.2016 / 13:25