Web Hosting Geeks | Web Hosting Experts
Need help? Call us 1(866)TOP-HOST

14611 reviews 1734 hosting providers

Questions & Answers

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

Aug 26, 2013 by SunFun
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?

1 Answer

0 votes
Aug 26, 2013 by WebProX
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');    }