WordPress.org

Ready to get started?Download WordPress

Forums

Custom Page Templates (44 posts)

  1. hps2322
    Member
    Posted 1 year ago #

    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

  2. jbusci
    Member
    Posted 1 year ago #

    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.

  3. hps2322
    Member
    Posted 1 year ago #

    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

  4. hps2322
    Member
    Posted 1 year ago #

    Aha! Themes editor?

  5. jbusci
    Member
    Posted 1 year ago #

    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].

  6. hps2322
    Member
    Posted 1 year ago #

    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.]

  7. jbusci
    Member
    Posted 1 year ago #

    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.

  8. hps2322
    Member
    Posted 1 year ago #

    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?

  9. hps2322
    Member
    Posted 1 year ago #

    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?

  10. jbusci
    Member
    Posted 1 year ago #

    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* )

  11. hps2322
    Member
    Posted 1 year ago #

    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

  12. hps2322
    Member
    Posted 1 year ago #

    Filezilla client or server?

  13. jbusci
    Member
    Posted 1 year ago #

    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.

  14. hps2322
    Member
    Posted 1 year ago #

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

  15. jbusci
    Member
    Posted 1 year ago #

    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

  16. hps2322
    Member
    Posted 1 year ago #

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

  17. hps2322
    Member
    Posted 1 year ago #

    OK I downloaded Wamp to the root of my computer .it says installed correctly and an icon on my desktop but nothing happening when I click it. I also installed the latest wordpress and extracted them to Wamp. Still mothing when I double click the wamp icon. I downloaded the latest version of wamp - 64 bit

  18. jbusci
    Member
    Posted 1 year ago #

    is the wamp icon in your system tray by the clock green?

    what happens when you open a browser and type in localhost?

  19. hps2322
    Member
    Posted 1 year ago #

    Ok I have everything downloaded but still nothing when I click the wamp icon. I looks like it's loading but nothing changes. Maybe I'm supposed to open something else?

  20. hps2322
    Member
    Posted 1 year ago #

    Ok had that turned off. Just hit it. Hit start services and it turned green

  21. hps2322
    Member
    Posted 1 year ago #

    Hmmm, went into local host and it say's Forbidden I dont have permission to access server
    Sorry? Thanks again for your help

  22. hps2322
    Member
    Posted 1 year ago #

    Same message for phpMyAdmin

  23. jbusci
    Member
    Posted 1 year ago #

    ok click that green icon in the tray again, and the bottom choice is
    put online.

    make sure its online ;)

  24. hps2322
    Member
    Posted 1 year ago #

    You are good!

  25. jbusci
    Member
    Posted 1 year ago #

    The file is placed at : C:\Windows\System32\drivers\etc\hosts

    by default windows ships with :

    # localhost name resolution is handled within DNS itself.
    #   127.0.0.1       localhost
    #   ::1             localhost

    You have to un-comment the mapping for localhost:

    # localhost name resolution is handled within DNS itself.
    127.0.0.1       localhost
    #   ::1         localhost

    Note: you will not be able to edit the hosts file as its a read-only file. To edit, you have to be the administrator, copy the file to some other location, edit it and then copy it back to the etc directory.

  26. jbusci
    Member
    Posted 1 year ago #

    you might need to do that too.

  27. hps2322
    Member
    Posted 1 year ago #

    Ok, I hit the go online button. Hit local host and got the Wamp server home page. Then hit the PhpMyAdmin and got the No Permission message again. Sorry ......

  28. hps2322
    Member
    Posted 1 year ago #

    Lost me. Where do I do that un-mapping?

  29. hps2322
    Member
    Posted 1 year ago #

    All this to customize a page? Well I guess if I want a great website I need all this eventually. Do you agree?
    And of course Thank You

  30. jbusci
    Member
    Posted 1 year ago #

    well, this isn't really to customize a page. We already answered that question.

    I was just trying to give you a way to play around locally so you didn't have to mess up your live site.

    and yes, if you want a great site, you either have to pay someone or learn this stuff for DIY.

    So you need to go to
    C:\Windows\System32\drivers\etc\hosts

    and edit that file.

    but..

    it is tricky to edit.

    here are the instructions for editing that file.

    http://helpdeskgeek.com/windows-7/windows-7-hosts-file/

    once you know how to edit it correctly,

    just get rid of comment syntax in front of

    #127.0.0.1 localhost

    so it should be

    127.0.0.1 localhost

Topic Closed

This topic has been closed to new replies.

About this Topic