WordPress.org

Support

Support » How-To and Troubleshooting » Template Front Page Gallery = No Images?

Template Front Page Gallery = No Images?

  • I have done the following:

    Template: Home
    
    Page:
      name: home
      slug: home
      template: home
    
    Permalinks: %postname%
    
    Reading->Front Page: home

    On my home page I’ve got text and a gallery of images.

    Everything works fine if I visit the page directly with:
    http://site/home/

    But if I visit the root and WP renders home as the front page the gallery doesn’t display, though the text still does.
    http://site/

    I am getting the page like so:

    <?php
    /*
    Template Name: Home
    */
    $page = Array("about" => 2);  // will be bringing content from other pages
    $home = get_page($pages['about']);
    
    ?>

    And then rendering it:
    <?php echo apply_filters('the_content', $home->post_content); ?>

    To remedy the problem I tried a quick bandaid approach of checking the get variables for page_id–if absent, forward to /home and the images work great. That worked with permalinks set to default. Now that I’ve got permalinks enabled, the get array is always empty!

    So I’ve got a bandaid approach right now, I dropped this at the top of my Home template.

    if($_SERVER['REQUEST_URI'] == '/') {
    	header('location: /home/');
    }

    So my first hope is to get it to work w/o having a redirect. Seems like it’s something similar to apply_filters. If not possible, I’m totally fine with checking the request uri and then forwarding to /home

Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Template Front Page Gallery = No Images?’ is closed to new replies.
Skip to toolbar