Hi there.
I have a question regarding custom display of posts in the Thematic template.
Previously in this forum I requested help about how to remove a category from the blog and display it in another page.
And this is the code I use in the function.php to achieve this.
// Remove category 3 from the blog
function exclude_category($query) {
if ( $query->is_feed || $query->is_home ) {
$query->set('cat', '-3');
}
return $query;
}
add_filter('pre_get_posts', 'exclude_category');
function childtheme_previous_post_link_args($args) {
global $wp_query;
$category = get_the_category();
echo $category->cat_ID;
if (in_category('3')) {
$args = array ('format' => '%link',
'link' => '<span class="meta-nav">«</span> %title',
'in_same_cat' => TRUE,
'excluded_categories' => '');
}
else {
$args = array ('format' => '%link',
'link' => '<span class="meta-nav">«</span> %title',
'in_same_cat' => FALSE,
'excluded_categories' => '3');
}
return $args;
}
add_filter('thematic_previous_post_link_args', 'childtheme_previous_post_link_args');
function childtheme_next_post_link_args($args) {
global $wp_query;
$category = get_the_category();
echo $category->cat_ID;
if (in_category('3')) {
$args = array ('format' => '%link',
'link' => '%title <span class="meta-nav">»</span>',
'in_same_cat' => TRUE,
'excluded_categories' => '');
}
else {
$args = array ('format' => '%link',
'link' => '%title <span class="meta-nav">»</span>',
'in_same_cat' => FALSE,
'excluded_categories' => '3');
}
return $args;
}
add_filter('thematic_next_post_link_args', 'childtheme_next_post_link_args');
// Code to display category 3 with in my custom page
function child_theme_custom_query() {
if (is_page('3')) { // change '48' to the id # of your page
$limit = get_option('posts_per_page');
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
//change '4' to you category id # and change the value of $limit to the # of posts you want displayed per page
query_posts('cat=3' . '&showposts=' . $limit=4 . '&paged=' . $paged );
$wp_query->is_archive = true; $wp_query->is_home = false;
}
}
add_action('thematic_above_indexloop', 'child_theme_custom_query');
What I need now is basically to have 1 page with the blog (category 1) without category 3, a page with just category 3 (both already working) and on top of that now I need a page that displays 1 post from the category 3 page and 4 posts from the blog (category 1), and I have tried a lot of stuff without success and I was hoping someone could help me out