How to Add an Innerpage Slider to a Single Category Post

Home » Tutorials » Theme Tutorials » How to Add an Innerpage Slider to a Single Category Post

If you’ve ever wanted to add the innerpage slider only to posts in a certain category, follow these simple steps.

Newer Themes

Open each of the single-xx.php files and replace this code:

<?php gab_innerslider(); ?>

with this code:

<?php if (in_category('N')){
gab_innerslider();
} ?>

Make sure to replace N with the proper category ID. You can specify multiple categories by using commas. This will block the innerpage slider from appearing on any posts outside of the specific category.

Older Themes

Open the single.php file and find this code:

// Theme innerpage slider
if (get_option('of_bn_inslider') == 'Site Wide') {
	require_once (GABFIRE_INC_PATH . '/theme-gallery.php');
} 
elseif (get_option('of_bn_inslider') == 'Tag-based' && ( has_tag(get_option('of_bn_inslider_tag')) ) or ( term_exists( get_option('of_bn_inslider_tag', 'gallery-tag', '' )) )) {
	require_once (GABFIRE_INC_PATH . '/theme-gallery.php');
}
elseif (get_option('of_bn_inslider') == 'Disable') {
	// do nothing
}

Then simply replace it with this code:

// Theme innerpage slider
if (in_category('XX')) {
	require_once (GABFIRE_INC_PATH . '/theme-gallery.php');
}

Make sure to replace N with the proper category ID. You can specify multiple categories by using commas. This will block the innerpage slider from appearing on any posts outside of the specific category.

LEAVE A COMMENT