Moderator
t-p
(@t-p)
Sorry, yes.
A Twenty-Fourteen child theme. Jetpack plugin is on. There are two plugins editing the styles “Styles” and “Styles: Twenty-Fourteen”, have not used them in a while (back when I didn’t know any coding, been editing the HTML/CSS since). Note: Have to say also that I apparently made change in the main 2014 theme directly also, as the child and original themes look almost alike.
the blog: http://www.evetslefurac.com
I did find this useful code below which puts everything in two columns (including the first post though). This php code below is in my functions.php file (most parts of solutions I found were more about index.php though)
add_filter('post_class','category_two_column_classes');
function category_two_column_classes( $classes ) {
global $wp_query;
if( is_home() ) :
$classes[] = 'two-column-post';
if( $wp_query->current_post%2 == 1 ) $classes[] = 'two-column-post-left';
elseif( $wp_query->current_post%2 == 0 ) $classes[] = 'one-column-post';
endif;
return $classes;
}
The elseif
part is from me, without it, everything shows up in 2 columns. With it, first post is full page, second is half page, third is full, fourth is half, and so on. Like this:
Post A (full)
B (half)
C (full)
D (half)
etc. (no two posts together on the same row)
The CSS:
/* TWO COLUMNS POSTS */
.two-column-post {
width: 46%;
float: left;
margin-left: 4%;
background-color: none;
}
.two-column-post-left {
clear: left;
margin-left: 1%;
background-color: none;
}
.one-column-post {
width: 100%;
margin-left: 1%;
background-color: none;
}
-
This reply was modified 7 years, 11 months ago by evetslefurax.
Just to be a bit clearer, here is what I am attempting to do, the posts to display like this:
A (most recent post, one column, full width)
B C
D E
F G
H I (older posts, two columns, half width each)
-
This reply was modified 7 years, 11 months ago by evetslefurax.
-
This reply was modified 7 years, 11 months ago by evetslefurax.
Moderator
t-p
(@t-p)
I recommend asking in this theme’s dedicated support sub-forum for better results so its developers and users can help you with this:
https://wordpress.org/support/theme/twentyfourteen
Ok, will do, thanks! Didn’t know
try with this ‘post_class’ filter:
add_filter('post_class','index_posts_layout_classes');
function index_posts_layout_classes( $classes ) {
global $wp_query;
if( is_home() ) :
$classes[] = $wp_query->current_post == 0 ? 'one-column-post' : 'two-column-post';
if( $wp_query->current_post%2 == 1 )
$classes[] = 'two-column-post-left';
endif;
return $classes;
}
the 2nd and other posts need to have their font size reduced
find out how the font size is defined right now, i.e. which selectors are used.
then use .two-column-post
in your CSS to make the new font size style more selective.
Works Michael! Many thanks!
I’ll work on the fonts then, thanks again!