Forum Replies Created

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter evetslefurax

    (@evetslefurax)

    Someone provided me with a code already (asked on the more generic support forum before here, link)

    Code is, in functions.php:

    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;
    }

    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;
    }

    Only things left is to reduce the font sizes of posts B-I accordingly to the posts’ newly reduced space, this without reducing it in the post page (not sure how though).

    Thread Starter evetslefurax

    (@evetslefurax)

    Works Michael! Many thanks!

    I’ll work on the fonts then, thanks again!

    Thread Starter evetslefurax

    (@evetslefurax)

    Ok, will do, thanks! Didn’t know

    Thread Starter evetslefurax

    (@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 8 years, 1 month ago by evetslefurax.
    • This reply was modified 8 years, 1 month ago by evetslefurax.
    Thread Starter evetslefurax

    (@evetslefurax)

    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: https://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 8 years, 1 month ago by evetslefurax.
    Thread Starter evetslefurax

    (@evetslefurax)

    Hehe, it seems that Jetpack is the problem.

    I switched to Twenty-Sixteen, and all images were ok, but switched back to my original theme and all the CSS was gone (got a backup) and still the images were affected by that code setting every image to a width of 474px. So I deactivated each plugin individually and turns out Jetpack changed everything.

    But now without Jetpack I can’t insert back all my CSS because there is no Edit CSS option without it. So I found Tuxedo CSS Editor and inserted the code and it works.

    Many thanks!

    Cool, thanks!

    I actually decided to install and activate it yesterday and so far it’s great. There’s a good amount of useful features which would otherwise require coding, in fact I started on wp.com for its ease of use but I needed my blog to be able to embed javascript stuff and wanted to customize its design beyond wp.com’s limits – may it require some coding. So with the Jetpack I think it’s the best of both worlds. Though I read that you should’nt install too much plugins as it will slow down your website efficiency a bit.

    Have the same questions here, plus:

    Will that change my website URL? I want mine unchanged
    Can the plugin and all its resulting change be undone by uninstalling it, in case something went wrong or the plugin changed anything I didn’t want?
    Are they cons about this plugin? Like, would it be better for some types of persons or blog to avoid it?

Viewing 8 replies - 1 through 8 (of 8 total)