Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1355649
    stevec114
    Participant

    I am racking my brain to figure out how to alter the output of a category listing page. I’ve opened every file I can think of any can’t find it.

    Ideally I would like to show a category archive list of posts that are scheduled for the future but only for one specific category and not others.

    I know how to accomplish this with PHP code but not sure what file to use in a child theme.

    Please help, thanks!

    #1355650
    stevec114
    Participant
    This reply has been marked as private.
    #1356189
    Rue Nel
    Moderator

    Hello There,

    Thanks for writing in and for the very detailed information. If you want to alter the output of the Events category page, you can simply change the query if the category is Events. Please check out several ways to do it by checking out this page: http://presscustomizr.com/snippet/three-techniques-to-alter-the-query-in-wordpress/

    As this is all custom development, regretfully we won’t be able to assist further. Custom development is outside the scope of our support. We’re happy to provide advice and get you started in the right direction, but you would still be responsible for the implementation.

    Thank you for your understanding.

    #1356194
    stevec114
    Participant

    Thanks for the response.

    I understand that you would not support the work but my original question was which file in the child theme needs to be edited.

    #1356385
    Rue Nel
    Moderator

    Hello There,

    Thanks for updating in! As stated on this page; http://presscustomizr.com/snippet/three-techniques-to-alter-the-query-in-wordpress/, you can simply add those function codes in your child theme’s functions.php file. For example;

    // Display future posts
    // =============================================================================
    function display_future_post($query) {
    	if ( $query->is_category('Events') ) {
    		$query->set('post_status', 'future');
    	}
    	return $query;
    }
    add_filter('pre_get_posts', 'display_future_post');
    // =============================================================================

    Hope this explains it.

    #1356741
    stevec114
    Participant

    Ahh, thanks for your help.

    #1356810
    Rahul
    Moderator

    You’re most welcome! 🙂

    Let us know if we can help with anything else.

  • <script> jQuery(function($){ $("#no-reply-1355649 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>