WordPress.org

Support

Support » How-To and Troubleshooting » Making new template from old

Making new template from old

  • rhythmofthecosmos

    @rhythmofthecosmos

    Hi,

    Am trying to make another template because I have a page that needs a lot of code in the header and instead of putting it in every page, am simply going to create a new template for this..

    Is it simply a case of making two copies of the header and add the code into one of them and save it as a different file name? then calling that on the template..

    so <?php get_header(); ?>
    <div id=”content”>

    goes to

    <?php get_header3D(); ?>
    <div id=”content”>

    ?

    I have tried this and it comes up with a fatal error, so am guessing that I need more work to go into it..

    Anyone have any ideas?

    thanks

Viewing 9 replies - 1 through 9 (of 9 total)
  • ryans149

    @ryans149

    do you want to place it somewhere after the content? Then why not create a sidebar ?

    http://codex.wordpress.org/Widgetizing_Themes

    Moderator cubecolour

    @numeeja

    You could create the additional stuff in the existing header, but use Conditional Tags so its only displayed on the required page:

    if (is_page('mypage') )
    {
         echo 'This will only appear on the <em>mypage</em> page';
    }
    rhythmofthecosmos

    @rhythmofthecosmos

    But will search engines search through the code?

    I had reports of my site taking a long time to load

    @ryans149 am looking to make a new page with the new code on.. My new code need to go in the header so to save load time am making a new template so that I only have 1 page with all the code if that makes sense

    Moderator cubecolour

    @numeeja

    But will search engines search through the code?

    Search engines can’t see the php code any more than firefox or any other browser can. The search engine is sent the same xhtml that a browser is sent, so it will see the code on the page that it is set to be included on.

    I had reports of my site taking a long time to load

    That could be caused by one or more of several things. The YSlow firefox extension might help you troubeshoot the problem.

    header.php

    get_header();

    header-myname.php

    get_header('myname');

    http://codex.wordpress.org/Function_Reference/get_header

    rhythmofthecosmos

    @rhythmofthecosmos

    @numeeja

    Just checked my site with Yslow and it has A in everything except things I can’t control..

    @t31os_ Thanks

    rhythmofthecosmos

    @rhythmofthecosmos

    Well

    I have the new template but it’s not showing my code.

    I made another header with the code called header3D.php

    I made the template with the php

    <?php get_header(‘3D’); ?>

    I set the page to display this template etc and previewed it..

    I have a working page so everything is going ok except one thing

    I still can’t see my code in the source (which is huge).

    It isn’t picking it up for some reason..

    Am trying to get this on my site

    http://earth-api-samples.googlecode.com/svn/trunk/demos/helloearth/index.html

    I have the working code, I know av had it on my old one.. but this template won’t pick it up for some reason.

    Moderator cubecolour

    @numeeja

    it looks like your new template file should be called header-3D.php rather than header3D.php

    rhythmofthecosmos

    @rhythmofthecosmos

    Ahh nice one..

    It has gotten the code working but something has knocked my css page-wrap off..

    http://www.leehughes.co.uk/route/3d-route/

    Gonna have a lookie 2moz.. my eyes are stinging

    ouch

    cheers

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Making new template from old’ is closed to new replies.