0
votes

I'm very new to wordpress and was just wondering if anyone could point me in the direction of a tutorial which will explain how to add my own code to wordpress pages.

So far all that I've been able to find is that I'm supposed to copy the page.php from my template and use that as the template for a page added in wordpress. This however only gives me control over the body and not the header/nav menu/sidebar.

Am I correct is assuming I must replace the method calls such as get_header(), etc with the code it would generate and manipulate it from there? Also is it correct if I change the arguments to get_template_part( 'content', 'page' ); and add a php page with the appropriate name for the body?

1
why would you need a custom page with wordpress since you can add a new page on page content?Teddybugs
@David I'm not sure I understand what you mean completely, but the problem isn't adding a new page, the problem is customising the added page. For instance I want to add php code to load data from my own tables in the database. Now this should be doable by copying the page.php, renaming and using it as template, but this doesn't give control over nav menu and sidebar.Vinc
not me that devote youTeddybugs

1 Answers

1
votes

Way 1 You can do this:

1) add new page enter image description here

2) add these code to index.php or page.php

<?php

if (is_page('About 3C')) {?>

<div>Display this particular div</div>

<?php }

else { ?>

<div>Display that particular div</div>
<?php }?>

or

<?php 

if (is_page('About 3C')) {

<div>Display this particular div</div>

}

else {

<div>Display that particular div</div>
}

?>

assume your added page name is: About 3C

and you can call the database from above code

OR way 2: please refer: http://line25.com/tutorials/how-to-create-a-wordpress-custom-page-template