• Hi,

    I am learning how to create a wordpress-theme. I wonder how to activate the custom page. Well, this is the tutorial:
    wordpress theme tutorial

    I wonder how to activate the archive page which I have coded. The theme is activated already. yet, the custom page (different from other page) is not activated yet. How to do so ?

    I wonder how to make archives.php work/link in archive page (which I added in wordpress admin).

    Thanks.

Viewing 15 replies - 1 through 15 (of 18 total)
  • 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

    Thread Starter davy_yg

    (@davy_yg)

    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

    Thread Starter davy_yg

    (@davy_yg)

    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’);

    updated the code above

    it should work

    Thread Starter davy_yg

    (@davy_yg)

    Hi,

    I already the page id into: pagename

    http://localhost/wordpress/archives/

    How to code it ?

    can you explain more please

    Thread Starter davy_yg

    (@davy_yg)

    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

    Thread Starter davy_yg

    (@davy_yg)

    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_permalink()

    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

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘Custom Page’ is closed to new replies.