Support » Theme: Hueman » Use page category for slider rather than post category

  • Resolved deKay

    (@dekay)



    Is this possible? I’ve assigned categories to pages, but using a page category means the slider is empty.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hi deKay. Welcome to the Hueman forum. Pages don’t have a category taxonomy by default. How are you adding them?

    With the Category Tag Pages plugin.

    https://wordpress.org/plugins/category-tag-pages/

    Thanks.

    The query the loads the slider doesn’t include pages. To modify the query you’ll need a child theme. If you’re not currently using a child theme, follow these steps:

    1. In Theme Options click the Help tab in the upper righthand corner.
    2. One of the options in the list is to download a sample child theme. This downloads the theme zip file to your local computer.
    3. Install the new theme in your Admin panel by selecting Add New > Upload Theme > Choose File, then select the zip file you downloaded.
    4. Activate the child theme.
    You’ll now have a pre-configured child theme with a style.css file and functions.php file to which you can add customizations.

    Next, copy the parent theme /inc/featured.php file to the same path in your child theme.

    In the file in your child theme, the query is at the top:

    $featured = new WP_Query(
    	array(
    		'no_found_rows'			=> false,
    		'update_post_meta_cache'	=> false,
    		'update_post_term_cache'	=> false,
    		'ignore_sticky_posts'		=> 1,
    		'posts_per_page'		=> ot_get_option('featured-posts-count'),
    		'cat'				=> ot_get_option('featured-category')
    	)
    );

    Add the ‘post_type’ argument in the array:

    $featured = new WP_Query(
    	array(
    		'post_type' => array( 'post', 'page' ), // include pages
    		'no_found_rows'			=> false,
    		'update_post_meta_cache'	=> false,
    		'update_post_term_cache'	=> false,
    		'ignore_sticky_posts'		=> 1,
    		'posts_per_page'		=> ot_get_option('featured-posts-count'),
    		'cat'				=> ot_get_option('featured-category')
    	)
    );

    The slider should then include the page(s) in the category you select.

    That’s perfect! Thanks!

    Just to update this…

    The update to Hueman 3.0 broke this functionality again. It was easy to fix though, I just made the same change as suggested above again, only now the file is parts/featured.php instead of inc/featured.php

    @dekay thanks for the hint

    I’m trying to do something similar but I want to pull in WooCommerce product pages instead… is this doable?

    Thanks in advance!

    @kenlbrown – This topic has been marked as Resolved. Your question is different so please start a new topic here: https://wordpress.org/support/theme/hueman#postform. Thank you.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Use page category for slider rather than post category’ is closed to new replies.