ИПА документи

[insert_php]

$post_categories = [];

if(!empty($_POST[‘category1’])) {
$post_categories[] = $_POST[‘category1’];
}

if(!empty($_POST[‘category2’])) {
$post_categories[] = $_POST[‘category2’];
}

if(!empty($post_categories))
{

$name = “”;
foreach($post_categories as $key => $cat){
$name .= “‘” . $cat . “‘”;
if($key < count($post_categories) - 1){ $name .= ","; } } global $wpdb; $rows = $wpdb->get_results(“SELECT p.post_title, p.guid
FROM wp_ipa2csoterms AS t
LEFT JOIN wp_ipa2csoterm_taxonomy AS tt ON tt.term_id = t.term_id
LEFT JOIN wp_ipa2csoterm_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id
LEFT JOIN wp_ipa2csoposts AS p ON p.ID = tr.object_id
WHERE t.name IN (“.$name.”) AND tt.taxonomy = ‘category’
GROUP BY p.ID
HAVING COUNT( t.name ) = ” . count($post_categories));
}
[/insert_php]

[insert_php]
$categories1 = get_categories(array(‘parent’=> 10));
[/insert_php]