waveform example page.PHP single.PHP and breadcrumbs file with the index (same folder0
I have
searchform.PHP
single.PHP
page.PHP
and
404
On wp-comet/themes/mythemefolder
WordPress will look for the PHP file for the page and if not there will use index.PHP
so it will be used if available
I understand that wordpress will look for the page.php file for each page. What if I have one page that is different from another page ?
How to use the custom page ? for example custompage.php, how to link the wordpress page to that file so that I can use the file to show the page ?
put conditional statement
for example if ID = 42 then load custom page … other than that … just use the page.php
Where to place the conditional statement ? Do I need to modify the wordpress file? If it is, which wordpress file ?
actually use this
<?php if (is_single(‘1’)) {
echo ‘hellllllllo’;
}
?>
1 = the id of the post
so when ID is 1 or anything
include(‘customsingle.php’);
Hi,
I already the page id into: pagename
http://localhost/wordpress/archives/
How to code it ?
can you explain more please
Well,
page.php
`
<?php if (pagename = ‘archives’) {
include(‘archives.php’);
} else {
// normal page
include(‘page2.php’);
}
?>
`
So I place that code in page.php so archives is custom page for example. What’s the correct code to replace pagename= ‘archives’ ?
use == so it means check the value
= (one only) means new value for the variable
firs declare the variable
$pagename = get_query_var(‘pagename’);
if ($pagename == ‘archives’) {
} else {
}
better just create the archives.php and wordpress will automaticly use it when it is archives page
wordpress set to look for the custom archives page then if not available will use index or page dot php
Parse error: syntax error, unexpected T_STRING in C:\xampp\htdocs\wordpress\wp-content\themes\Chrisspooner\archives.php on line 25
<ul class="meta">
<li>Posted in <?php the_category(' ,'); ?></li>
<li class="comments"><a href=<?php the permalink(); ?>#comments"><?php comments_number('No Comments', '1 Comment', '% Comments'); ?></a></li>
</ul>
line 25: <li class=”comments”>#comments”><?php comments_number(‘No Comments’, ‘1 Comment’, ‘% Comments’); ?>
the code above seems so familiar for me … which template are you working on?
is it mine?
wonder how to make archives.php work/link in archive page (which I added in wordpress admin).
alternative to the ongoing discussion:
turn archives.php into a page template:
http://codex.wordpress.org/Pages#Page_Templates
then assign it to a page, for instance called ‘archives’;
dashboard – pages – edit page: page atributes