Need help making Custom page template show up properly, something overriding design

Discussion in 'PHP' started by AutoKwame, Aug 28, 2011.

  1. #1
    Hi,

    I'm using the Misty WordPress theme (see here: http://www.freethemelayouts.com/showcase/misty-wordpress-theme/).

    For the longest time now, I have tried to create a customized page template for a Tribute section on my automotive blog. I have followed the codex instructions to T and managed to set everything up properly, using the same codes (design) as the index page (I want it to look like the index page). However, the Tribute page looks nothing like the the index page. Something seems to be overriding the page design, but I can't seem to determine what.

    Take a look at the index page: http://www.autotribute.com/
    Take a look at the tribute page: http://www.autotribute.com/tributes/

    Your help will be appreciated.
     
    Solved! View solution.
    AutoKwame, Aug 28, 2011 IP
  2. MyVodaFone

    MyVodaFone Well-Known Member

    Messages:
    1,048
    Likes Received:
    42
    Best Answers:
    10
    Trophy Points:
    195
    #2
    You could always copy the design of home.php or index.php into page.php (make a backup first) just remove the featured part
     
    MyVodaFone, Aug 28, 2011 IP
  3. AutoKwame

    AutoKwame Member

    Messages:
    169
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    28
    #3
    Thank you, MyVodaFone.

    The problems is I still need a simple page layout for some sections (i.e. the about and contact pages). How can I have both without too much trouble?
     
    AutoKwame, Aug 28, 2011 IP
  4. shallowink

    shallowink Well-Known Member

    Messages:
    1,218
    Likes Received:
    64
    Best Answers:
    2
    Trophy Points:
    150
    #4
    you can test this pretty quickly, the home page is assigned an ID of 'home' , the tribute is defined as 'nothome'. So go into the header.php for the theme and look for the body. You should see an if(is_home()) section, you need to alter that section to something like if(is_home() || is_page('pageid_for_tribute_page') ,

    And that is what's causing the problem. Here's a screenshot from where I modified it using firebug :

    [​IMG]
     
    shallowink, Aug 28, 2011 IP
  5. MyVodaFone

    MyVodaFone Well-Known Member

    Messages:
    1,048
    Likes Received:
    42
    Best Answers:
    10
    Trophy Points:
    195
    #5
    Copy home.php and rename it to tributes.php, remove what you dont want, featured etc... now go to your wordpress pages section select tributes and there should be a drop down list to the right side panel asking what template you want to use, so select tributes.php, thus like your above concerns you still have a default page.php for others.

    If your stuck, I could do that for you to see how it was done but I'll need wp-admin and ftp access
     
    Last edited: Aug 29, 2011
    MyVodaFone, Aug 28, 2011 IP
  6. AutoKwame

    AutoKwame Member

    Messages:
    169
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    28
    #6
    I tried your method but ended up with the same results. The tribute page (and now, the the regular pages) still doesn't show properly. I even deleted the page.php to see what would happen, and still the same results. There is something else overriding everything.
     
    Last edited: Aug 29, 2011
    AutoKwame, Aug 29, 2011 IP
  7. AutoKwame

    AutoKwame Member

    Messages:
    169
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    28
    #7
    Hi, shallowink,

    You're clearly onto something here. I am pretty PHP illiterate, so when I tried to make the suggested changes, I got a big fat error. But assuming I got the modifications right, I plan to make many other pages besides the tribute page. Do those modification work for all these future pages, at least in a way that allows me to successfully customize them? I ask because the fact that both the home and tribute tabs are active on the menu bar raises some concerns.
     
    AutoKwame, Aug 29, 2011 IP
  8. shallowink

    shallowink Well-Known Member

    Messages:
    1,218
    Likes Received:
    64
    Best Answers:
    2
    Trophy Points:
    150
    #8
    What I told you was just a quick method to determine if it was correct (nothome, home id being set over riding changes). The actual solution to the problem is to use a Page Template as Myvidafone suggested. If the home/tribute tabs are also controlled by the nothome/home id, you will have to work around it. I would make a copy of the page.php file and rename it to create a custom page template which you could assign as needed and alter to as needed. The first alteration would be to change nothome to home.

    I have a copy of the misty theme, if you using an unaltered page.php I can create a page template for you if you want.
     
    shallowink, Aug 29, 2011 IP
  9. AutoKwame

    AutoKwame Member

    Messages:
    169
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    28
    #9
    My page template is unaltered. I would appreciate a template from you. Also, what do you think about the Misty them. Would you say it's good compared to other templates you've experienced?
     
    AutoKwame, Aug 29, 2011 IP
  10. #10
    Ok, I attached tribute.php,upload it to your theme directory then just select it from the Page Template drop down to assign it to the page you want. The only downside to using this method is that I had to copy the header.php (and remove the call to get_header()) into tribute.php to make the adjustment to the body id. The downside there is if you make any changes to header.php , the page template will have to be updated as well.

    Also, I changed the id for the Home Page link so it should not show up as the active page which was triggering the issue you mentioned.

    I've never used Misty as a theme. Just from looking at the immediate file structure it's obvious that it's a wordpress 2.* theme. That alone means I wouldn't recommend it for a just starting project. But you're site looks ok with it and that is what's important. The few issues I see with your site are most likely caused by plugins and I saw a style tag which was outside of the HEAD, that's not good.


    View attachment tribute.php
     
    shallowink, Aug 29, 2011 IP
  11. MyVodaFone

    MyVodaFone Well-Known Member

    Messages:
    1,048
    Likes Received:
    42
    Best Answers:
    10
    Trophy Points:
    195
    #11
    This is what I meant. Upload attached file into your Misty folder, go to pages, select Tributes, select 'Tribute Page' from the template selection drop down box and update the page....

    Attachment : View attachment 57933

    The page should look identical to the home page with the exception of featured items.

    Now there is one thing you may need to edit and that's line 18 where the query is
    showposts=8&cat=-9&paged=$paged
    Code (markup):
    showposts=8 should be fine or increase that if you wish to show more posts.

    &cat=-9
    Code (markup):
    cat= should represent the category id number of category Tributes, if your not sure of the id, go to categories and mouse over or click category tributes, you'll see the id number in the url
     
    MyVodaFone, Aug 30, 2011 IP
  12. AutoKwame

    AutoKwame Member

    Messages:
    169
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    28
    #12
    MyVodaFone,

    I have tried that several times, but I still achieve the same results, but this time without the article pictures.
     
    AutoKwame, Aug 31, 2011 IP
  13. AutoKwame

    AutoKwame Member

    Messages:
    169
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    28
    #13
    AutoKwame, Aug 31, 2011 IP
  14. shallowink

    shallowink Well-Known Member

    Messages:
    1,218
    Likes Received:
    64
    Best Answers:
    2
    Trophy Points:
    150
    #14
    There's differences between the default Misty Free header.php and the one you use for your site. Open up the file I supplied, and open up header.php for your theme. copy everything above the body line in your header, paste it into the file I sent(replacing everything above the body tag). save, test.
     
    shallowink, Aug 31, 2011 IP
  15. AutoKwame

    AutoKwame Member

    Messages:
    169
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    28
    #15
    I got it work, but I'll have to change some things after the </head> in order to get the logo and adsense setup properly. Is there anything that I shouldn't change no matter what?
     
    AutoKwame, Aug 31, 2011 IP
  16. shallowink

    shallowink Well-Known Member

    Messages:
    1,218
    Likes Received:
    64
    Best Answers:
    2
    Trophy Points:
    150
    #16
    Worst thing that can happen is you would have to start over with the tribute-template. Just make backups, don't make a bunch of changes before checking. Go slow, basic advice.
     
    shallowink, Aug 31, 2011 IP
  17. AutoKwame

    AutoKwame Member

    Messages:
    169
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    28
    #17
    Thank you, I`ll keep that in mind. Hopefully, I`ll find something that will make my life easier in the future. Until then, this is perfect.

    Thank both of you guys -- shallowink and MyVodaFone -- for your help. I really appreciate it.
     
    AutoKwame, Sep 1, 2011 IP