what is the full code of your page template?
(please use the pastebin – http://codex.wordpress.org/Forum_Welcome#Posting_Code )
Hi,
here’s the link to my pageofpost template
http://pastebin.com/S2qmJiFL
I appreciate your help,
possibly (untested) try to change the filter function to:
add_filter('post_class','template_three_column_classes');
function template_three_column_classes( $classes ) {
global $list_of_posts;
if( is_page_template('file-name-of-template.php') ) :
$classes[] = 'three-column-post';
if( $list_of_posts->current_post%3 == 0 ) $classes[] = 'column-post-left';
endif;
return $classes;
}
http://codex.wordpress.org/Conditional_Tags#Is_a_Page_Template
thanks for the effort but it doesn’t work,
it still targets the page content + posts —
I have an idea:
to bring in the posts of certain category i use the array
$args = array(
'category_name' => 'portfolio',
);
you can see it in page template at line 38,
do you think that integrating this in functions could be an optimal solution?
I found the in_category tag that seems to work…
any known contraindications?
now I have a problem with the pagetemplate syntax,
after the page content I have something that’s closing the #content and that’s messing up styles,
do you see what it is?
you actually don’t open the #content div (and #primary) in the page template;
have a look and compare the template structure with the structure of page.php for instance; something like:
get_header(); ?>
<div id="primary">
<div id="content" role="main">
LOOPING HERE
</div><!-- #content -->
</div><!-- #primary -->
<?php get_footer(); ?>
Hi Alchymyth,
it gets opened in header
and with functions.php, depending on template, it gets targeted with different classes
here is the function that targets the classes..
function catchbox_body_classes( $classes ) {
$options = catchbox_get_theme_options();
$layout = $options['theme_layout'];
if ( function_exists( 'is_multi_author' ) && !is_multi_author() ) {
$classes[] = 'single-author';
}
if ( $layout == 'content-sidebar' && !is_page_template( 'page-disable-sidebar.php' ) && !is_page_template( 'page-fullwidth.php' ) && !is_page_template( 'page-onecolumn.php' ) && !is_page_template( 'page-of-post.php' ) ) {
$classes[] = 'content-sidebar';
}
elseif ( $layout == 'sidebar-content' && !is_page_template( 'page-disable-sidebar.php' ) && !is_page_template( 'page-fullwidth.php' ) && !is_page_template( 'page-onecolumn.php' ) && !is_page_template( 'page-of-post.php' ) ) {
$classes[] = 'sidebar-content';
}
elseif ( $layout == 'content-onecolumn' || is_page_template( 'page-onecolumn.php' ) && !is_page_template( 'page-disable-sidebar.php' ) && !is_page_template( 'page-fullwidth.php' ) && !is_page_template( 'page-of-post.php' ) ) {
$classes[] = 'content-onecolumn';
}
elseif ( is_page_template( 'page-disable-sidebar.php' ) || is_attachment() ) {
$classes[] = 'singular';
}
elseif ( is_page_template( 'page-fullwidth.php' ) || is_attachment() ) {
$classes[] = 'fullwidth';
}
elseif ( is_page_template( 'page-of-post.php' ) || is_attachment() ) {
$classes[] = 'fullwidth';
}
return $classes;
}
add_filter( 'body_class', 'catchbox_body_classes' );
#content div closes in the page-template, (it does the same in the page.php) .
as for my site I found a workaround working on .three-column-post css class,
here’s the code i used in functions, with the tag in_category
/*3 column-alchy-tweak */
add_filter('post_class','template_three_column_classes');
function template_three_column_classes( $classes ) {
global $list_of_posts;
if ( in_category( 'xxxxxxxxx' )) :
$classes[] = 'three-column-post';
if( $list_of_posts->current_post%3 == 0 ) $classes[] = 'column-post-left';
endif;
return $classes;
}
shoul I mark the thread Solved?