1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Home page without side bar

Discussion in 'WordPress' started by nomzz, Feb 21, 2010.

  1. #1
    Hello,

    Like to know how could i remove sidebar from home page only and add posts and sidebar to other pages.


    Thanks
     
    nomzz, Feb 21, 2010 IP
  2. s_ruben

    s_ruben Active Member

    Messages:
    735
    Likes Received:
    26
    Best Answers:
    1
    Trophy Points:
    78
    #2
    To remove the sidebar from homepage, just delete get_sidebar(); from index.php.
     
    s_ruben, Feb 21, 2010 IP
  3. nomzz

    nomzz Well-Known Member

    Messages:
    475
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    110
    #3
    that part i know but second part of question is the real problem.

    "Like to know how could i remove sidebar from home page only and add posts and sidebar to other pages."
     
    nomzz, Feb 21, 2010 IP
  4. s_ruben

    s_ruben Active Member

    Messages:
    735
    Likes Received:
    26
    Best Answers:
    1
    Trophy Points:
    78
    #4
    On which page there is no sidebar? And what you mean saying "add posts to other pages"?
     
    s_ruben, Feb 21, 2010 IP
  5. ashivapu

    ashivapu Peon

    Messages:
    27
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    1. Create custom page (this will be home page).
    2. In WP-Admin go to settings > reading > select radio box 'static page' and choose your options.

    This will allow you to create a special page to use as home page, while keeping all others the same. So you can remove sidebar from your homepage template, but keep in in the main.
     
    ashivapu, Feb 22, 2010 IP
  6. nomzz

    nomzz Well-Known Member

    Messages:
    475
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    110
    #6
    ok let me explain again:

    - Home page i want posts only for home page not for others and no sidebar

    - About us or contact page or news page all three pages different having different posts and they can have sidebar

    - How i can create more links on about us page like history, our aim, vision, portofolio

    I think now little bit clear
     
    nomzz, Feb 22, 2010 IP
  7. s_ruben

    s_ruben Active Member

    Messages:
    735
    Likes Received:
    26
    Best Answers:
    1
    Trophy Points:
    78
    #7
    You have to customize the index.php and page.php and get posts for each page by function get_posts.
     
    s_ruben, Feb 22, 2010 IP
  8. nomzz

    nomzz Well-Known Member

    Messages:
    475
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    110
    #8
    so you mean i can distinguish between index.php posts and page.php posts which can be contact us or about us so every page can hav different posts according to page? i can see fucntion like that on codex
     
    nomzz, Feb 22, 2010 IP
  9. s_ruben

    s_ruben Active Member

    Messages:
    735
    Likes Received:
    26
    Best Answers:
    1
    Trophy Points:
    78
    #9
    You have to create a category (for example "about us") and on about us page display the posts of about us category. You can get the posts of the category by using get_posts("category=9"). Replace 9 to the category id which posts you want to display. More examples you can find in http://codex.wordpress.org/Template_Tags/get_posts.
     
    s_ruben, Feb 22, 2010 IP
  10. s_ruben

    s_ruben Active Member

    Messages:
    735
    Likes Received:
    26
    Best Answers:
    1
    Trophy Points:
    78
    #10
    A little example for it:

    Let say the id of the page "About Us" is 9 and the id of the page "Contact Us" is 17. And the id of the category "About Us" is 11 and the id of the category "Contact Us" is 15. Get current page posts code in page php is:

    
    if(get_the_ID()==9){
       $category_id = 11;
    }elseif(get_the_ID()==17){
       $category_id = 15;
    }
    
    $posts = get_posts("category=".$category_id);
    ...
    
    Code (markup):
     
    s_ruben, Feb 22, 2010 IP
  11. ashivapu

    ashivapu Peon

    Messages:
    27
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    The method I outlined should get what you are looking for.
     
    ashivapu, Feb 22, 2010 IP
  12. nomzz

    nomzz Well-Known Member

    Messages:
    475
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    110
    #12
    I think so ashivapu is definitely write because post belongs to category and template files can be assign to specific category

    Thanks man let me test now...
     
    nomzz, Feb 23, 2010 IP
  13. nomzz

    nomzz Well-Known Member

    Messages:
    475
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    110
    #13
    ashivapu : your method is all about the layouting the pages, there you cant assign categories to specfic pages

    s_ruben: theme should be designed like any one can use it so if i use your method each time some one has to create ...rather using ids we can use the names may be.

    But what i am trying to do this :

    Home page has 3 or 4 posts which shouldnt be included any where so it belongs to category homepage(or any category specific to home page)

    2nd now blog post page such as news, can have all posts excluding home page one...


    I tried to use plugin advnace excluding category plugin but it excludes home pages posts from other places but cant exclude other category posts from home page.
     
    nomzz, Feb 24, 2010 IP
  14. ms.g

    ms.g Peon

    Messages:
    163
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #14
    Create home.php

    Do the layout that suits your taste.

    That's the template for your homepage. Do don't have to touch any other template page to create your homepage (although you may).
     
    ms.g, Feb 24, 2010 IP
  15. nomzz

    nomzz Well-Known Member

    Messages:
    475
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    110
    #15
    home.php works fine thats great idea i know but point is the home page posts could be seen on blog page

    I want them to distinguish... like you do in CMS
     
    nomzz, Feb 24, 2010 IP
  16. ms.g

    ms.g Peon

    Messages:
    163
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #16
    I don't understand what you are trying to accomplish.

    If you create a homepage, texts you put there won't be seen on blog pages. I don't get what you mean by "home page posts could be seen on blog page."

    If the contents are hard-coded on home.php there's no way it would land on blog pages or be SEEN anywhere.
     
    ms.g, Feb 24, 2010 IP
  17. ms.g

    ms.g Peon

    Messages:
    163
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #17
    If you mean by "home page posts could be seen on blog page" the sidebar from homepage is still reflected on the rest of the pages, you have to create ANOTHER dynamic sidebar SPECIFICALLY FOR the homepage. And then add that dynamic sidebar to the homepage and to homepage alone.

    Creating another dynamic sidebar here means you also have to register another sidebar. It's a code that you put in your function.
     
    ms.g, Feb 24, 2010 IP
  18. nomzz

    nomzz Well-Known Member

    Messages:
    475
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    110
    #18
    no no i mean to say that home page has also posts dynamic not static page.

    Like if have these tabs home, services, aboutus, news, articles.

    But so i want show posts in services or other which belongs to services or others respectively.

    As s_ruben: said we can do by getting the category id and hard coding that by create page templates in wordpress but i want that to be dynamic, if its hard coded then theme would not be usable on another install.

    So there should be some methods to get names of pages and categories and readme file you put you should create these names of categories...
     
    nomzz, Feb 24, 2010 IP