Monday, June 13, 2022
HomeWordPress DevelopmentTips on how to conditionally add Customized Publish Sort to Entrance Web...

Tips on how to conditionally add Customized Publish Sort to Entrance Web page


I’m utilizing the next code to indicate my customized put up varieties on my entrance web page together with the default put up kind:

// permits the merchandise to indicate up on the primary web page
operate add_custom_post_type_to_query( $question ) {
    if ( ! is_admin()  &&  $query->is_main_query() ) {
       if ( $query->is_date() ||  $query->is_home()  ) {

           $query->set( 'post_type', array('put up', 'product') );

       }
    }
}
add_action( 'pre_get_posts', 'add_custom_post_type_to_query' );

How would I modify this code to solely present/add customized put up sorts of product the place the customized subject known as show_on_front_page which is a boolean (ACF checkbox) is about to true (checked)?

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments