WP/how can I set a different static home pages for every different themes

52 views
asked Aug 25, 2013 in Website Builder by SunFun (3,000 points)
Hi all
I am using WP 3.6 and I have 2 different themes. One for desktop users and the other is for mobile users. I have a plugin that detects if the user is using a mobile device and it automatically applies the mobile theme otherwise the normal desktop theme is applied. I need to display different home pages for every theme. I want the desktops users to see a static home page first and I want the mobile users to see the last post as my home page.
can anyone please assist?
Thanks

1 Answer

0 like 0 dislike
answered Aug 25, 2013 by WebProX (12,200 points)
Try changing what is displaying in the functions.php file for each theme
In your desktop theme of your desktop theme functions.php  add something like
add_action( 'after_thsetup_theme', 'change_mytheme_frontpage' );
function change_mytheme_frontpage() {
    $frontpage = get_page(pageID
    update_option('show_on_front', 'mypage');        update_option('page_on_front', $frontpage->PageID);
}
And in the mobile theme functions.php file add something like this:
add_action( 'after_setup_mytheme', 'change_mytheme_frontpage' );
function change_mytheme_frontpage() {
    update_option('show_on_front', 'myposts');    }
...