get( 'bg' );
$color_ti = $HELPDOCS_COLORS->get( 'ti' );
?>
-1,
'post_status' => 'publish',
'post_type' => $post_type,
'meta_key' => HELPDOCS_GO_PF.'site_location', // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key
'meta_value' => base64_encode( 'main' ), // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_value
'meta_compare' => '=',
];
// Are we filtering by category? // Must be category id
if ( $cat = absint( helpdocs_get( 'cat' ) ) ) {
$args[ 'category' ] = absint( $cat );
}
// Are we filtering by tag? // Must be slug
if ( $tag = sanitize_text_field( helpdocs_get( 'tag' ) ) ) {
$args[ 'tag' ] = $tag;
}
// Get the posts
$docs = get_posts( $args );
// Also get the imports
$imports = helpdocs_get_imports( $args );
// Merge them together
if ( !empty( $imports ) ) {
$docs = array_merge( $docs, $imports );
}
// Stop if no posts are found
if ( !$docs ) {
echo '
No documents found. Start by clicking "Add New" above!';
return;
}
// First we sort by the doc order
usort( $docs, function( $a, $b ) {
return $a->helpdocs_order - $b->helpdocs_order;
} );
// Are we searching for something?
if ( helpdocs_get( 'search' ) ) {
$s = sanitize_text_field( helpdocs_get( 'search' ) );
$current_url = add_query_arg( 'search', $s, $current_url );
} else {
$s = '';
}
// Get the folders
$folder_taxonomy = 'help-docs-folder';
$folders = get_terms( [
'taxonomy' => $folder_taxonomy,
'hide_empty' => false,
'orderby' => 'meta_value_num',
'order' => 'ASC',
'meta_query' => [ // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query
[
'key' => HELPDOCS_GO_PF.'order',
'type' => 'NUMERIC',
]
],
] );
// Add Expand and Collapse links, only if folders exist
if ( !empty( $folders ) ) {
$folder_action_links = 'Expand Folders
Collapse Folders';
} else {
$folder_action_links = '';
}
// Search bar
echo '