WordPress.org

Ready to get started?Download WordPress

Forums

New Template Problem! (13 posts)

  1. Deanbd
    Member
    Posted 4 years ago #

    Hello Everyone,

    I’m trying to create a new page template so as a start I’ve created a new template - freegames.php file by coping
    the page.php and paste to the new file, and adding code:

    <?php
    /*
    Template Name: freegames
    */
    ?>

    Before editing this file I’ve tried to add a new test page and I used
    the new template freegames.php and the result is that the whole page is
    moving to the left and the side bar goes down.
    I didn’t change anything except for creating a new template - freegames.php and adding a new empty page.
    How come I’m not getting the same result as using page.php?
    Please tell me what I am doing wrong?

    Thank you,
    Dean

  2. esmi
    Forum Moderator
    Posted 4 years ago #

    A link to a page that uses the new template might help...

  3. Deanbd
    Member
    Posted 4 years ago #

    Hi esmi,

    I’m using BitNami WordPress Stack to test everything before I post it so the link is:
    http://192.168.1.135/wordpress/?page_id=3

    Correction: the sidebar stays in place but the whole page moves to the left.

    Thanks for your help,
    Dean

  4. Shane G
    Member
    Posted 4 years ago #

  5. Deanbd
    Member
    Posted 4 years ago #

    Hi Shane,

    I still can’t find the answer, if everything is the same except for the template name, how come I’m getting a different result?

    Thanks,
    Dean

  6. esmi
    Forum Moderator
    Posted 4 years ago #

    @Shane: Can I suggest that, if you can't post anything that's practically useful, you don't post anything at all? Parroting the same "solution" in very different topics doesn't help anyone. Try reading the original post first.

    @Deanbd: 192.168 is a local ip address. You're running this on a local server, yes? It sounds like either a markup/validation error or a CSS issue. Unfortunately, unless I can see the page and check the source & CSS, I can't really offer much in the way of help.

    If you use Firefox, you might want to try adding the Firebug add-on. At least that will allow you to compare the CSS being used by the default template compared to your new template. Also try validating a page that uses your new template and compare that to a default page. You could have inadvertently removed an </div> or similar.

  7. Deanbd
    Member
    Posted 4 years ago #

    Hi esmi,

    I’ve uploaded the same page template to my website,
    http://gamewikipedia.com/ord/

    Thanks for your help,
    Dean

  8. esmi
    Forum Moderator
    Posted 4 years ago #

    Are you still having problems? Only when I compared the page above with the same site's Home page, the page placement looked identical to me.

  9. Deanbd
    Member
    Posted 4 years ago #

    Hi esmi,

    Yes, I’m still having the same problem.

    Here is the link:
    http://gamewikipedia.com/word/

    Thanks,
    Dean

  10. Deanbd
    Member
    Posted 4 years ago #

    Please esmi, can you answer my question, I need help and you are my last hope!

  11. figaro
    Member
    Posted 4 years ago #

    You probably have some kinds of space/returns or extraneous code in your template file. Try creating another one from your page.php file. See the following video as well...

    [link moderated]

  12. Deanbd
    Member
    Posted 4 years ago #

    Hi figaro,
    I still can’t find the answer.
    Here are my page.php, freegames.php template and header.php
    Can you please take a look at it and see what is wrong?
    Thanks,
    Dean

    1. page.php

    <?php get_header(); ?>

    <div id="container">
    <div id="left-div">
    <div id="left-inside">
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    <!--Start Post-->
    <span class="single-entry-titles" style="margin-top: 18px;"></span>
    <div class="post-wrapper">
    <h1 class="post-title" style="margin-top: 13px;">" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
    <?php the_title(); ?>
    </h1>
    <div style="clear: both;"></div>
    <?php the_content(); ?>
    </div>
    <?php endwhile; ?>
    <!--End Post-->
    <?php else : ?>
    <!--If no results are found-->
    <h1>No Results Found</h1>
    <p>The page you requested could not be found. Try refining your search, or use the navigation above to locate the post.</p>
    <!--End if no results are found-->
    <?php endif; ?>
    </div>
    </div>
    <!--Begin Sidebar-->
    <?php get_sidebar(); ?>
    <!--End Sidebar-->
    <!--Begin Footer-->
    <?php get_footer(); ?>
    <!--End Footer-->
    </body>
    </html>

    2. freegames.php

    <?php
    /*
    Template Name: freegames
    */
    ?>

    <?php get_header(); ?>

    <div id="container">
    <div id="left-div">
    <div id="left-inside">
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    <!--Start Post-->
    <span class="single-entry-titles" style="margin-top: 18px;"></span>
    <div class="post-wrapper">
    <h1 class="post-title" style="margin-top: 13px;">" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
    <?php the_title(); ?>
    </h1>
    <div style="clear: both;"></div>
    <?php the_content(); ?>
    </div>
    <?php endwhile; ?>
    <!--End Post-->
    <?php else : ?>
    <!--If no results are found-->
    <h1>No Results Found</h1>
    <p>The page you requested could not be found. Try refining your search, or use the navigation above to locate the post.</p>
    <!--End if no results are found-->
    <?php endif; ?>
    </div>
    </div>
    <!--Begin Sidebar-->
    <?php get_sidebar(); ?>
    <!--End Sidebar-->
    <!--Begin Footer-->
    <?php get_footer(); ?>
    <!--End Footer-->
    </body>
    </html>

    3. header.php

    <?php
    global $options;
    foreach ($options as $value) {
    if (get_settings( $value['id'] ) === FALSE) { $$value['id'] = $value['std']; } else { $$value['id'] = get_settings( $value['id'] ); } }
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
    <head profile="http://gmpg.org/xfn/11">
    <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />

    <title>
    <?php if (is_home()) : ?>
    <?php bloginfo('name'); ?>
    -
    <?php bloginfo('description'); ?>
    <?php else : ?>
    <?php wp_title('', 'false'); ?>
    -
    <?php bloginfo('name'); ?>
    <?php endif; ?>
    </title>

    <?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>
    <?php wp_head(); ?>
    <link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/style-<?php echo $artsee_color; ?>.css" type="text/css" media="screen" />
    <link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" />
    <link rel="alternate" type="application/atom+xml" title="<?php bloginfo('name'); ?> Atom Feed" href="<?php bloginfo('atom_url'); ?>" />
    <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
    <!--[if IE 7]>
    <link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo('stylesheet_directory'); ?>/iestyle.css" />
    <![endif]-->
    <!--[if lt IE 7]>
    <link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo('stylesheet_directory'); ?>/ie6style.css" />
    <script defer type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/pngfix.js"></script>
    <![endif]-->
    <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/superfish.js"></script>
    <script type="text/javascript">
    jQuery(function(){
    jQuery('ul.superfish').superfish();
    });
    </script>
    </head>
    <body>
    <div id="wrapper2">
    <?php if (get_option('artsee_foursixeight') == 'Enable') { ?>
    <?php include(TEMPLATEPATH . '/includes/468x60.php'); ?>
    <?php } else { echo ''; } ?>
    <div id="wrapper">
    <!--This controls pages navigation bar-->
    <div id="pages">
    <ul class="nav superfish" id="nav2">
    <li class="page_item">" class="title" title="home again woohoo">Home
    <?php wp_list_pages("sort_order=$artsee_order_page&depth=3&exclude=1031,1037$artsee_exclude_page&title_li="); ?>

    <img src="<?php bloginfo('template_directory'); ?>/images/pages-bg-right-<?php echo $artsee_color; ?>.gif" alt="pages bg right" style="float: right;" />
    <!--Begin Search Form-->
    <div class="search_bg">
    <div id="search">
    <form method="get" action="<?php bloginfo('home'); ?>" style="padding:0px 0px 0px 0px; margin:0px 0px 0px 0px">
    <input type="text" name="s" value="<?php echo wp_specialchars($s, 1); ?>"/>
    <input type="image" class="input" src="<?php bloginfo('stylesheet_directory'); ?>/images/search-button-<?php echo $artsee_color; ?>.gif" value="submit"/>
    </form>
    </div>
    </div>
    <!--Begin Search Form-->
    </div>
    <!--End pages navigation-->
    <!--This controls the categories navigation bar-->
    <div id="categories">
    <ul class="nav superfish">
    <?php wp_list_cats("sort_column=$artsee_sort_cat&sort_order=$artsee_order_cat&optioncount=0&depth=3&exclude=$artsee_exclude_cat"); ?>

    </div>
    <!--End category navigation-->

  13. figaro
    Member
    Posted 4 years ago #

    I can't tell just by looking at the code...zip the theme and give me a download link and I'll look at it.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.