WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Custom Templates Not Duplicating Actions On All Pages (3 posts)

  1. centraloverland
    Member
    Posted 2 years ago #

    Hello,

    I've been studying all morning about creating custom templates for a few of my pages, and I'm having trouble understanding how to recreate the custom features of one across several pages.

    I want "The Gallery" to be dark and full-width. I can make this happen for this one page by adjusting the "full-width" template which came with my Custom Community theme by inserting the following into it:

    <?php if (is_page('1691') ):
    // page 1691 ?>
    <style type="text/css">
    body {background-color:#505050;}
    div#container {background-color:#303030;}
    </style>

    <?php endif; // end the if, no images for other other categories ?>

    See here for a test page to demonstrate.

    Perfect! Looks super. Now, I want to recreate this action (dark background and container with no sidebar) in the Photos and Videos pages, as well. The first thing I tried was to simply add the code above with the page numbers for the Photos and Videos pages into my theme's standard "full-width" template again, like this:

    <?php if (is_page('xxxx') ):
    // page xxxx ?>
    <style type="text/css">
    body {background-color:#505050;}
    div#container {background-color:#303030;}
    </style>

    <?php if (is_page('yyyy') ):
    // page yyyy ?>
    <style type="text/css">
    body {background-color:#505050;}
    div#container {background-color:#303030;}
    </style>

    That didn't work. Got a syntax error. So, I tossed that simple attempt, and moved to plan B, which I though would be the "right" way to do it: I used the theme's original "full-width" template as a base for my own, thinking that I'd assign each of my custom pages it's own custom template. So, I copy and pasted, verbatim, the code from my theme's "full-width" template, which I know worked great for one page, and made it the foundation for the Photos and Videos pages. Of course, the only change I made was to the bit of syntax (at the top of this post) to reflect the appropriate page ID for each of my pages. I uploaded those files to my theme's folder in ftp. Finally, I went to the "Edit" screen for each of these three pages and selected the appropriate template from the drop down menu.

    I was certain this would work...

    No-go. I can get the background and container colors to change on only one page, and I can't make the screen full-width on any of them! This is strange because I used the "full-width" template for my base for my own custom template.

    The Gallery: http://centraloverland.com/blog/?page_id=1683
    Photos: //centraloverland.com/blog/?page_id=1104
    Videos:http: http://centraloverland.com/blog/?page_id=1664

    Can someone help me understand why the custom templates I've created won't display the same characteristics as the base template from my theme?

    I'm thinking now that I should just create a temple that dictate the dark background and container and no sidebar, but is not page specific, like my code above demands. That way, I could just choose that template for every subsequent page I want formatted like this. Problem? I don't know what that code looks like. What would I change from the examples above?

    Thanks so much. I'm doing my best to learn this coding stuff.

  2. centraloverland
    Member
    Posted 2 years ago #

    Nevermind. I made it work, I guess.

    I simple wrote this at the bottom of my theme's "full-width" template:

    <style>
    body {background-color:#505050;}
    div#container {background-color:#303030;}
    </style>

    Then I attributed those three pages to that template in the Edit Page screen. Sure, it does the trick for this, but what if I want to do a full-width page in the future that's not dark background or containers? Guess I'll have to keep studying this css stuff!

    However, I'd like a note on this, if anyone has a clue: now, each time I edit one of those three pages, I get this:

    Fatal error: Class 'bitfield' not found in /home/content/72/7099872/html/forum/includes/message_parser.php on line 48

    The weird thing is, I can simply hit refresh, click the link to the page I just edited, and everything seems fine. Is this "Fatal Error" screen relevant or just a nuisance? How do I make it go away?

    Thanks so much.

    wc

  3. centraloverland
    Member
    Posted 2 years ago #

    Okay, so I think this is a bigger problem. Moving it to a new thread.

Topic Closed

This topic has been closed to new replies.

About this Topic