Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #440698

    Hello guys! I have just bought my 5th theme license! Thats how much I like your theme and appreciate your quick support. :)

    I’m working on a 1 page site and some reasons hard to explain i need a product to be the homepage, but I don’t see such an option in the theme, any suggestions?

    Thanks as always!
    Cheers

    #441160

    Hi Gigi!

    what do you mean you need a product to be the homepage? what exactly do you want to achieve? could you show us a screenshot/mockup to get a clear idea? A link to your website would help as well.

    Cheers!
    Andy

    #441274

    Sorry I should have explained myself better, basically I have built this product page http://bit.ly/1DULcD0 and I need it to be the homepage because it’s the only way I can have the ecommerce functionality at the bottom (where user can choose size, upload file etc..)

    Makes sense?

    #442206

    Hi!

    It’s not possible to set a custom post type such as front page so you need to do a 301 redirect via .htaccess or add this code in the functions.php file:

    add_action("pre_get_posts", "custom_front_page");
    function custom_front_page($wp_query){
        //Ensure this filter isn't applied to the admin area
        if(is_admin()) {
            return;
        }
    
        if($wp_query->get('page_id') == get_option('page_on_front')):
    		
            $wp_query->set('post_type', 'product');
            $wp_query->set('page_id', 241);
    
            //Set properties that describe the page to reflect that
            //we aren't really displaying a static page
            $wp_query->is_page = 0;
            $wp_query->is_singular = 1;
            $wp_query->is_post_type_archive = 0;
            $wp_query->is_archive = 0;
    
        endif;
    
    }

    Replace the page_id:

     $wp_query->set('page_id', 241);
    

    Cheers!
    Ismael

    #442698

    THIS WORKED GREAT!

    Thank you o much!

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Make a product the Homepage’ is closed to new replies.