HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/ERijn/knijft.eu/wwwroot/wp-content/themes/cheope/core/templates/shortcodes/faq.php
<?php
	$args = array(
        'post_type' => 'bl_faq',
        'posts_per_page' => $items,
    );
    
    if(!empty( $category )) {
        $tax = 'category-faq';
        $category = array_map( 'trim', explode( ',', $category ) );
        if ( count($category) == 1 ) $category = $category[0];
        $args['tax_query'] = array(
            array(
                'taxonomy' => $tax,
                'field' => 'slug',
                'terms' => $category
            )
        );
    }
    
    $faqs = new WP_Query( $args );          
    
    $first = TRUE;
    if( $close_first ) $first = FALSE;
    
    $html = '';
    if( !$faqs->have_posts() ) return $html;
    
    //loop
    while( $faqs->have_posts() ) : $faqs->the_post();
    
            $title = the_title( '', '', false );
            $content = get_the_content();
        
            $attr = '';
            if( $first )
                $attr = ' opened="1"';
        
            $html .= do_shortcode( "[toggle title=\"$title\"{$attr}]{$content}[/toggle]" );
            $first = FALSE; 
    
    endwhile;          
?>

<?php echo $html; ?>