• Resolved jmusgrave918

    (@jmusgrave918)


    https://www.chocolatefountainproductions.com

    i am using a different theme for desktop and mobile site (m.choc…)

    I am using the mobile switcher plugin to detect mobile devices and automatically implement my mobile theme.

    What i want to do is show a different type of home page for each theme.

    for example the desktop version shows a static home page.

    but when accessed from a mobile device it automatically implements my mobile theme and i to display my latest posts as the home page

    how can i accomplish this? any help would be greatly appreciated!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi jmusgrave918,

    My suggestion would be to change what is shown on front page in functions.php of each theme.

    For example, in the desktop version you would add something like this (in functions.php of desktop theme):

    add_action( 'after_setup_theme', 'change_theme_frontpage' );
    function change_theme_frontpage() {
    	$frontpage = get_page(2);   // 2 is the id of the page you want to show
    	update_option('show_on_front', 'page');    // show on front a static page
    	update_option('page_on_front', $frontpage->ID);
    }

    And in the functions.php of the mobile theme:

    add_action( 'after_setup_theme', 'change_theme_frontpage' );
    function change_theme_frontpage() {
    	update_option('show_on_front', 'posts');    // show on front latest posts
    }

    Thread Starter jmusgrave918

    (@jmusgrave918)

    thanks!

    Hi,

    I have a bit like the same problem but I’m using a parallax theme for my desktop theme.
    Because of that, I don’t have a static homepage, neither a blog on my homepage.

    When I only put in the code into my functions.php of my mobile theme, it will overwrite the main settings for my desktop theme, where none are selected.

    Website is; https://steenbergenco.nl/

    I removed the code but can replace it anytime.

    Hope someone could help.

    Mike

    @ikemelchiot: As per the Forum Welcome, please post your own topic.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘setting different static home pages for different themes’ is closed to new replies.