Support » Fixing WordPress » Custom Page Templates

  • hps2322

    (@hps2322)


    Please help. I’m trying to create a custom home page but am Stymied. I’ve read and watched youtube but can’t figure out how to do it. It seems on all the videos I’ve watched that they access some screen that shows the code and the add or change it. I can’t find any screen like that. Then there’s this PHP deal? On the site help it says pull down the template button on the right. I can’t find any template button anywhere. Can someone lead me in the right direction?
    Thanks

Viewing 15 replies - 1 through 15 (of 43 total)
  • jbusci

    (@jbusci)

    to get a custom page template to work in the wp-admin editor here is what you need to do.

    create your custom template inside your theme folder.

    homePageTemplate.php for example.

    on the top of that file you want to tell wordpress the name of the theme.

    <?php
    /*
    Template Name: Home Page Template
    */
    ?>

    then make sure that you set up wordpress front page display to static page and pick the page you create to use with the template.

    on that page, make sure to change the template to Home Page Template or whatever name you gave it in your homePageTemplate.php file.

    hps2322

    (@hps2322)

    OK, thank you so much for your reply. I’m driving myself nuts over here. Where or how do I access my themes folder. I think that’s where I getting stuck

    hps2322

    (@hps2322)

    Aha! Themes editor?

    jbusci

    (@jbusci)

    well, first off you’ll need to know what theme you are currently using.

    To find out, go in to Appearance -> Theme inside of wp-admin. Look for current theme.

    Once you see what theme you are using, you’ll know where in the WordPress file system you need to go.

    The wordpress file system is on your host server. Typically, you’d access this through FTP, either a local client, or in your hosts control panel.

    Once you get access to the file system, the theme path is wp-content/themes/[yourCurrentThemeFolder].

    hps2322

    (@hps2322)

    So I went in themes. Then editor. Then on the right found page template and now I have this

    <?php
    /**
     * The template for displaying all pages.
     *
     * This is the template that displays all pages by default.
     * Please note that this is the WordPress construct of pages
     * and that other 'pages' on your WordPress site will use a
     * different template.
     *
     * @package WordPress
     * @subpackage Twenty_Eleven
     * @since Twenty Eleven 1.0
     */
    
    get_header(); ?>
    
    		<div id="primary">
    			<div id="content" role="main">
    
    				<?php while ( have_posts() ) : the_post(); ?>
    
    					<?php get_template_part( 'content', 'page' ); ?>
    
    					<?php comments_template( '', true ); ?>
    
    				<?php endwhile; // end of the loop. ?>
    
    			</div><!-- #content -->
    		</div><!-- #primary -->
    
    <?php get_footer(); ?>

    Am I on the right track?

    [Moderator Note: Please post code or markup snippets between backticks or use the code button.]

    jbusci

    (@jbusci)

    nah, that is the default. You should leave that.

    BUT, once you get to the themes folder as I described, make a copy of that, change the name to whatever you want and put this in there

    Template Name: Home Page Template

    get rid of the comment block too. Everything between the /** and */

    or add your own comments.

    hps2322

    (@hps2322)

    You’re awesome thanks
    I’m using the basic 2011 template and my host is Godaddy. So I go to godaddy to access the FTP?

    hps2322

    (@hps2322)

    I’m in the godaady site and I’ve found FTP File Manager. It looks like what I saw on YOUTUBE am I getting warm?

    jbusci

    (@jbusci)

    yeah, you are doing great now.

    I would highly recommend downloading FileZilla so that way you can create your pages in a better editor like notepad++ (not windows notepad).

    Then upload to godaddy, instead of being logged in there and trying to create edit rename etc in the web interface.

    So now that you are in there tho, you can find your wordpress installation. You’ll want to look in wp-content/themes for the 2011 directory.

    the template that is currently being used is called page.php. So just make a copy of that. Rename it, and if you want, you can go back in to wp-admin and edit there as well.

    So you have 3 editing options.

    Locally with something like notepad++ (the professional way)
    On your website wp-admin (quick and dirty way)
    On godaddy (the newb way *wink* )

    hps2322

    (@hps2322)

    I’ve bogged down again. Once I double clicked my twenty eleven theme I goyt a directory. It has 5 folders.
    colors
    Images
    inc
    js
    language
    Then abunch of scripts
    two lines for style sheets
    the two more scripts

    I’m not sure where to go from here
    Again thanks for your help

    hps2322

    (@hps2322)

    Filezilla client or server?

    jbusci

    (@jbusci)

    filezilla client.

    yeah, the scripts you are looking at should have .php extensions. Those are the types of files that run wordpress. it is a php app.

    This is why I recommend using notepad++ to edit them. This way, even tho you are new at programming in php, you will have the benefit of syntax highlighting which will help you understand better what you are looking at in those scripts.

    I am guess you know html/css/js since you are looking to modify your template. So you’ll find out that in messing with wordpress, there is very little changes to be made to the script files. It’s more a logic process than a learning to code process.

    Anyways, good luck to you. Check out the codex to get the details on what you can do with the php to customize that template. Otherwise, if you are just looking at UI stuff, you should be all set.

    hps2322

    (@hps2322)

    No I don’t think I know html/css/js. Maybe I’m getting in way over my head

    jbusci

    (@jbusci)

    nah, go do this.

    Download WAMP
    Download latest wordpress
    Download notepad++
    Download fileZilla (your host will have your ftp credentials)

    install wamp to the root of your computer C:\WAMP
    unzip wordpress to C:\WAMP\www
    start WAMP
    open localhost and go into phpMyAdmin
    create a user by clicking privileges -> add new user
    pick a generic user name
    change host to localhost
    make a password
    pick the radio button that says create database with same name and grant all permissions

    now you have what you need to install wordpress, so

    go back to localhost and look for wordpress under projects
    when you click on that, you’ll be doing the 5 minute install
    put in that information you just used in those fields.

    now you have exactly what you have in your godaddy site and an environment to learn in.

    when you are comfortable with whatever theme your create using notepadd++, upload it to godaddy with filezilla

    hps2322

    (@hps2322)

    Ok I will do. Wholly cow seems like a lot. I’ll be in touch
    Thanks again

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