Mobile Theme Category Filter not working
-
First off, THANK YOU for the very detailed documentation. Being a beginner this makes a HUGE difference.
Next, I searched herein and Googled, and tried everything I can find. If I have missed something obvious here please forgive me and just point me to the correct docs.
Using the Jetpack Mobile Theme. Jetpack is fully updated. I inserted the jetpackme_modify_main_query code as defined on https://jetpack.com/2014/02/26/exclude-a-category-from-mobile-theme/ substituting the proper category ID.
This is very similar to another filter I inserted into functions.php of my child theme to remove all posts of this same category from the desktop homepage. I thought that original filter would also change the Jetpack Mobile Theme, but it didn’t so I found your own code to do this on mobile too.
However, with the Jetpack code inserted into the functions.php of the child theme the desired effect is not realized. Tested on an iPhone and with the Chrome tools on a desktop pretending to be an iPhone 6 Plus.
The main theme is WooRockets WR-Elite which apparently is now unsupported (and funky). Decided to use the Jetpack Mobile Theme because mobile on WR-Elite is all messed up.
Anything you can suggest or point me toward so that I can figure this out would be most appreciated. Hopefully it’s something stupid and we can all point and laugh. Here is the contents of the child theme functions.php file:
<?php
// Exit if accessed directly
if ( !defined( ‘ABSPATH’ ) ) exit;// BEGIN ENQUEUE PARENT ACTION
// AUTO GENERATED – Do not modify or remove comment markers above or below:if ( !function_exists( ‘child_theme_configurator_css’ ) ):
function child_theme_configurator_css() {
wp_enqueue_style( ‘chld_thm_cfg_child’, trailingslashit( get_stylesheet_directory_uri() ) . ‘style.css’, array( ‘owl-carousel’,’elite-main’,’elite-responsive’,’elite-pagebuilder’ ) );
}
endif;
add_action( ‘wp_enqueue_scripts’, ‘child_theme_configurator_css’ );// END ENQUEUE PARENT ACTION
//=================================================================================================================
// Mike Acton added to eliminate all posts of Category Press Release from displaying on homepage 9-29-16
//=================================================================================================================
function exclude_category($query) {
if ( $query->is_home() ) {
$query->set( ‘cat’, ‘-35’ ); //The number 35 corresponds to the ID=35 of the Press Release category
}
return $query;
}
add_filter( ‘pre_get_posts’, ‘exclude_category’ );
//=================================================================================================================
// End added code by Mike Acton
//=================================================================================================================//=================================================================================================================
// Mike Acton added to disable Jetpack Related Posts on The Events Calendar single event posts 9-29-16
//=================================================================================================================
function jetpackme_no_related_posts( $options ) {
if ( is_singular( ‘tribe_events’ ) ) {
$options[‘enabled’] = false;
}
return $options;
}
add_filter( ‘jetpack_relatedposts_filter_options’, ‘jetpackme_no_related_posts’ );
//=================================================================================================================
// End added code by Mike Acton
//=================================================================================================================//=================================================================================================================
// Mike Acton added to disable Jetpack Mobile Theme posting Press Releases 10-3-16
// From https://jetpack.com/2014/02/26/exclude-a-category-from-mobile-theme/
//=================================================================================================================
// Check if we are on mobile
function jetpackme_is_mobile() {// Are Jetpack Mobile functions available?
if ( ! function_exists( ‘jetpack_is_mobile’ ) )
return false;// Is Mobile theme showing?
if ( isset( $_COOKIE[‘akm_mobile’] ) && $_COOKIE[‘akm_mobile’] == ‘false’ )
return false;return jetpack_is_mobile();
}// Modify the main query on the home page for the mobile theme.
function jetpackme_modify_main_query( $arg ) {
if ( jetpackme_is_mobile() && is_home() ) {
$arg -> set( ‘cat’, ‘-35’ );
}
}
add_action( ‘pre_get_posts’, ‘jetpackme_modify_main_query’ );
//=================================================================================================================
// End added code by Mike Acton
//=================================================================================================================
The topic ‘Mobile Theme Category Filter not working’ is closed to new replies.