WordPress.org

Ready to get started?Download WordPress

Forums

Making new template from old (10 posts)

  1. rhythmofthecosmos
    Member
    Posted 4 years ago #

    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

  2. ryans149
    Member
    Posted 4 years ago #

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

    http://codex.wordpress.org/Widgetizing_Themes

  3. cubecolour
    ɹoʇɐɹǝpoɯ
    Posted 4 years ago #

    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';
    }
  4. rhythmofthecosmos
    Member
    Posted 4 years ago #

    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

  5. cubecolour
    ɹoʇɐɹǝpoɯ
    Posted 4 years ago #

    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.

  6. Mark / t31os
    Moderator
    Posted 4 years ago #

    header.php

    get_header();

    header-myname.php

    get_header('myname');

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

  7. rhythmofthecosmos
    Member
    Posted 4 years ago #

    @numeeja

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

    @t31os_ Thanks

  8. rhythmofthecosmos
    Member
    Posted 4 years ago #

    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.

  9. cubecolour
    ɹoʇɐɹǝpoɯ
    Posted 4 years ago #

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

  10. rhythmofthecosmos
    Member
    Posted 4 years ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic