Buonasera a tutti, per la gestione di una parte della home del mio sito c'è questo php qua sotto:
<!-- INNER content2 -->
<div id="inner">
**<?php $issuesCategory = get_option('tb_home_issues_category'); ?>**
<h3>News dalla Regione<span></span></h3>
<?php
$args = array();
$args['post_type'] = 'post';
$args['post_status'] = 'publish';
$args['posts_per_page'] = 5;
**if ($issuesCategory) {**
** $excludeCategory = '-' . $issuesCategory;**
** $args['cat'] = $excludeCategory;**
** }**
$tbQuery = new WP_Query($args);
$latestIndex = 1;
if ($tbQuery->have_posts()) : while ($tbQuery->have_posts()) : $tbQuery->the_post();
?>
<?php $postID = get_the_ID(); ?>
<?php $postTitle = get_the_title($postID); ?>
<?php $postPermalink = get_permalink($postID); ?>
<?php
if ($latestIndex == 5) {
$newsClass = 'news width50 right';
$dfs = 'small';
$tSize = 'dfs';
}
elseif ($latestIndex == 4) {
$newsClass = 'news width50 left';
$dfs = 'small';
$tSize = 'dfs';
}
elseif ($latestIndex == 3) {
$newsClass = 'news width50 left';
$dfs = 'small';
$tSize = 'dfs';
}
elseif ($latestIndex == 2) {
$newsClass = 'news width50 left';
$dfs = 'small';
$tSize = 'dfs';
}
else {
$newsClass = 'news';
$dfs = 'medium';
$tSize = 'dfm';
}
?>
<div class="<?php echo $newsClass; ?>">
<div class="doubleFramed <?php echo $dfs; ?> left">
<a href="<?php echo $postPermalink; ?>" title="<?php $postTitle; ?>">
<?php echo tb_get_thumbnail($postID, $tSize); ?>
</a>
</div>
<div class="right">
<?php
if ($latestIndex > 1) { ?>
<div class="newsInfo"><?php echo get_the_date('l j F, Y'); ?></div>
<?php } ?>
<h4><a href="<?php echo $postPermalink; ?>" title="<?php $postTitle; ?>"><?php echo $postTitle; ?></a></h4>
<?php
if ($latestIndex == 1) { ?>
<div class="newsInfo"><?php echo get_the_date('l j F, Y'); ?></div>
<?php } ?>
<?php if ($latestIndex == 1) {
the_excerpt();
} else {
echo '<p>' . tb_max_words(get_the_excerpt(), 18) . '...</p>';
} ?>
<a href="<?php echo $postPermalink; ?>" title="<?php $postTitle; ?>" class="tinyButton roundButtonX right">Leggi tutto</a>
</div>
</div>
<?php
if ($latestIndex == 1) { ?>
<div class="horDashed"></div>
<?php } ?>
<?php $latestIndex++; ?>
<?php endwhile; endif; ?>
<?php wp_reset_postdata(); ?>
<?php
if ($issuesCategory) { ?>
<?php
$args2 = array();
$args2['post_type'] = 'post';
$args2['post_status'] = 'publish';
$args2['posts_per_page'] = 3;
$args2['cat'] = $issuesCategory;
$tbQuery2 = new WP_Query($args2);
$issuesIndex = 1;
if ($tbQuery2->have_posts()) { ?>
<div class="horDouble"></div>
<h4><span></span></h4>
<?php while ($tbQuery2->have_posts()) : $tbQuery2->the_post(); ?>
<?php $postID = get_the_ID(); ?>
<?php $postTitle = get_the_title($postID); ?>
<?php $postPermalink = get_permalink($postID); ?>
<?php if ($issuesIndex == 1) echo '<div class="news width50 left">'; ?>
<?php if ($issuesIndex == 2) echo '</div><div class="news width50 right">'; ?>
<div class="newsInfo"><?php echo get_the_date('l j F, Y'); ?></div>
<h4><a href="<?php echo $postPermalink; ?>" title="<?php echo $postTitle; ?>"><?php echo $postTitle; ?></a></h4>
<?php if ($issuesIndex == 1) {
the_excerpt(); ?>
<a href="<?php echo $postPermalink; ?>" title="<?php echo $postTitle; ?>" class="tinyButton roundButtonX right">Leggi tutto</a>
<?php } ?>
<?php if ($issuesIndex > 1 && $issuesIndex < 3) echo '<div class="horDashed"></div>'; ?>
<?php if ($issuesIndex == 3) echo '</div>'; ?>
<?php $issuesIndex++; ?>
<?php endwhile; } ?>
<?php if ($issuesIndex > 1 && $issuesIndex < 3) echo '</div>'; ?>
<?php wp_reset_postdata(); ?>
<?php
}
$args3 = array();
$args3['post_type'] = 'tb_video';
$args3['post_status'] = 'publish';
$args3['posts_per_page'] = 1;
$args3['meta_query'] = array(
array(
'key' => '_featured',
'value' => 1,
'compare' => '='
)
);
$tbQuery3 = new WP_Query($args3);
?>
<?php if ($tbQuery3->have_posts()) : while ($tbQuery3->have_posts()) : $tbQuery3->the_post(); ?>
<?php $postID = get_the_ID(); $postTitle = get_the_title(); ?>
<?php $postURL = get_post_meta($postID, '_url', true); ?>
<div class="horDouble"></div>
<h4>Featured <span>Videos</span></h4>
<div class="video">
<div>
<a href="<?php echo esc_url($postURL); ?>" title="<?php echo $postTitle; ?>">
<?php echo get_the_post_thumbnail($postID, 'videoHome', array('alt' => $postTitle, 'title' => $postTitle)); ?>
</a>
</div>
<div>
<h4><a href="<?php the_permalink(); ?>"><?php echo $postTitle; ?></a></h4>
<div class="newsInfo"><?php echo get_the_date('l j F, Y'); ?></div>
<div class="horDashed"></div>
<?php echo '<p>' . tb_max_words(get_the_excerpt(), 40) . '...</p>'; ?>
</div>
</div>
<?php endwhile; endif; ?>
<?php wp_reset_postdata(); ?>
</div>
<!-- .INNER content2 -->
che genera due gruppi di articoli presi da due differenti categorie:
il primo blocco sono tutti gli articoli che non rientrano nella categoria del secondo blocco di articoli, questo valore viene passato tramite il menù impostazioni del tema.
La mia richiesta è quella di esplicitare per i due blocchi due differenti categorie direttamente dentro al codice php.
Dove e come devo inserire le chiamate alle categorie?
GRAZIE IN ANTICIPO