0
votes

i'm using the twentytwelve theme and i have to write custom content into my example template.

I want to maintain my header content so the main structure is the following

header = id page, wrapper

ex.page = primary, content

footer = close wrapper, close id page

If i have understood correctly, if i want to insert content into the middle of my page i have to do it into my template page (that is a copy of the main page.php), that is in the middle between my header and my footer

For example i want to insert a div into which insert the loop of such category.

The problem is that it displays me nothing, like i've wrote nothing. I can only see the contents if i erase all the originary div, but it's not what i want to do, just because the only div is the page which is my container.

I can't catch what i have to do.

Can you tell me what i forgot to do?

Thanks,

Alex

2

2 Answers

0
votes

page.php is a "master" document. header.php, footer.php and (if it exists) sidebar.php are all imported into page.php. Twenty Twelve also uses atomized content templates. You may need to add your div to content-page.php, which is also imported into page.php. content-page.php is used inside the wordpress loop, and encapsulates the code that pulls in the actual article elements from the wordpress database.

If you are trying to add straight HTML to the templates, ensure that you are not adding code between the php brackets:

<?php // don't add html here ?>
<div>do add html here</div>

Depending upon the type of wordpress page you are trying to display, you may need to consult the Wordpress Template hierarchy to determine the proper Wordpress naming convention for your template file (the copy of page.php).

0
votes

Technically speaking, everything in content-page.php can be put into page.php replacing the get_template_part function. All the 'content' pages are totally not required and can be combined into one file if you want simplicity.

In my opinion, it's easier to start from scratch when learning Wordpress rather than try and re-work something. The default wordpress themes don't lend themselves to be beginner friendly.