Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1423678

    Hi,

    How can i hide custom post types in my overview of blogposts? In this case we have a CPT “vacature” which is visible in the overview at this page: (see URL). I have a piece of code to hide this in the masonry element but in this case we use the “blogposts” element to show the blogposts.

    #1423748

    Hey bonsaimedia,

    Thank you for the inquiry.

    You can use the following filter in the functions.php file to exclude a specific custom post type from the query.

    function avia_post_slide_query_mod($query, $params) {	
        foreach($query['post_type'] as $key => $value) {
            if( $value == 'vacature' ) {
                unset($query['post_type'][$key]);
            }      
        }
    
        return $query;
    }
    add_filter('avia_post_slide_query', 'avia_post_slide_query_mod', 10, 2);

    Best regards,
    Ismael

    #1423755

    Hi Ismael,

    Thanks for your help! I tried it but it’s not working. Can you check again please? See also a link to screenvideo which element we use to be sure.
    Many thanks!

    #1423856

    Hi,

    Have you tried replacing “vacature” with “acf-field-group”?

    if( $value == 'acf-field-group' ) {
    

    Best regards,
    Ismael

    #1423885

    Hi Ismael,

    Yes, that works. Many thanks!

    #1423965

    Hi,

    Great, I’m glad that Ismael could help you out. Please let us know if you should need any further help on the topic, or if we can close it.

    Best regards,
    Rikard

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.