• Resolved Bliabalufnb12

    (@anendien)


    Hello,

    I need some help with the mobile theme feature from Jetpack. I have three custom post types on my blog. Here are some code from my functions.php

    add_action( 'pre_get_posts', 'add_my_post_types_to_query' );
    
    	function add_my_post_types_to_query( $query ) {
    		if ( is_home() && $query->is_main_query() ){
    			$query->set( 'post_type', array( 'post','rezensionen', 'cookingfever', 'kurzrezension' ) );
    		}
    		return $query;
    		}

    When I activate the mobile theme support, only posts are shown, but nothing from my custom post types.

    Any ideas?

    Thanks in advance.

    https://www.ads-software.com/plugins/jetpack/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic ??

    Could you let me know where the Custom Post Types are registered, and where you’ve entered the code above?

    Both the CPTs and the WP Query changes have to happen in a plugin, and not in your theme’s functions.php. Indeed, when switching to another theme, like Jetpack’s Mobile Theme, the code you’ve added to your desktop theme doesn’t run anymore.

    I hope this helps.

    Thread Starter Bliabalufnb12

    (@anendien)

    Hello Jeremy,

    the code above and the CPTs are registered in the funxtions.php of my theme.

    Thank you for your answer, I will try it with a plugin.

    Best regards

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom Post Types don't showing in mobile theme’ is closed to new replies.