Community Forums › Forums › Archived Forums › Design Tips and Tricks › One column instead of two
This topic is: resolved
- This topic has 2 replies, 2 voices, and was last updated 4 years, 3 months ago by
AnitaC.
Viewing 3 posts - 1 through 3 (of 3 total)
-
AuthorPosts
-
November 24, 2020 at 2:14 pm #502057
dekraan
ParticipantHi all,
I can't seem to be able to delete a post made, sorry about using a second.
By searching and clicking on stuff in this forum, I think I managed to solve my problem, and display a genesis block and then all my posts on the homepage.
Just one problem, the code I used from:
gives me two columns of posts instead of the one I want.
How do I change this?
The code I am using now for my template is:
http://www.leokranenburg.nl<?php /* Template Name: Full Width Content with Blog Posts */ //* Add outreach-pro-home body class add_filter( 'body_class', 'custom_body_class' ); function custom_body_class( $classes ) { $classes[] = 'fwc-blgpost'; return $classes; } remove_action('genesis_loop', 'genesis_do_loop'); // Removing default loop add_action('genesis_before_content', 'genesis_do_loop'); // Repositioning the page content // Fix for the WordPress 3.0 "paged" bug. $paged = 1; if ( get_query_var( 'paged' ) ) { $paged = get_query_var( 'paged' ); } if ( get_query_var( 'page' ) ) { $paged = get_query_var( 'page' ); } $paged = intval( $paged ); if( $paged > 1 ){ remove_action('genesis_before_content', 'genesis_do_loop'); } // Add your grid loop add_action( 'genesis_after_loop', 'gd_custom_grid_loop_helper' ); remove_action( 'genesis_after_endwhile', 'genesis_posts_nav' ); add_action( 'genesis_after_endwhile', 'genesis_custom_tpl_posts_nav' ); $first_page_limit = 6; $post_per_page = $next_page_limit = 8; /** Add support for Genesis Grid Loop **/ function gd_custom_grid_loop_helper() { global $paged, $first_page_limit, $next_page_limit, $post_per_page; if ( function_exists( 'genesis_custom_loop' ) ) { if( $paged == 1 ) $post_per_page = $first_page_limit; $args = array( 'post_type' => 'post', 'showposts' => $post_per_page, 'paged' => $paged); if( $paged > 1 ) $offset = ( $next_page_limit * ( $paged - 2 ) + $first_page_limit ); if( intval( $offset ) > 0 ) $args['offset'] = $offset; //* Add even/odd post class add_filter( 'post_class', 'gd_grid_post_class' ); genesis_custom_loop($args); }else { //* Add even/odd post class add_filter( 'post_class', 'gd_grid_post_class' ); genesis_standard_loop(); } remove_filter( 'post_class', 'gd_grid_post_class' ); } function gd_grid_post_class( $classes ) { global $wp_query; $classes[] = 'one-half'; $classes[] = ($wp_query->current_post % 2 == 0) ? 'first' : ''; return $classes; } function genesis_custom_tpl_posts_nav(){ if ( 'numeric' === genesis_get_option( 'posts_nav' ) ) genesis_custom_tpl_numeric_posts_nav(); else genesis_prev_next_posts_nav(); } function genesis_custom_tpl_numeric_posts_nav() { if( is_singular() ) return; global $wp_query, $paged, $first_page_limit, $next_page_limit; //* Stop execution if there's only 1 page if( $wp_query->max_num_pages <= 1 ) return; $max = intval( $wp_query->max_num_pages ); if( $paged == 1 ): $found_posts = $wp_query->found_posts - $first_page_limit; $max = $wp_query->max_num_pages = intval( ceil( $found_posts / $next_page_limit ) ) + 1; endif; //* Add current page to the array if ( $paged >= 1 ) $links[] = $paged; //* Add the pages around the current page to the array if ( $paged >= 3 ) { $links[] = $paged - 1; $links[] = $paged - 2; } if ( ( $paged + 2 ) <= $max ) { $links[] = $paged + 2; $links[] = $paged + 1; } genesis_markup( array( 'html5' => '<div %s>', 'xhtml' => '<div class="navigation">', 'context' => 'archive-pagination', ) ); echo '<ul>'; //* Previous Post Link if ( get_previous_posts_link() ) printf( '<li class="pagination-previous">%s</li>' . "\n", get_previous_posts_link( apply_filters( 'genesis_prev_link_text', '«' . __( 'Previous Page', 'genesis' ) ) ) ); //* Link to first page, plus ellipses if necessary if ( ! in_array( 1, $links ) ) { $class = 1 == $paged ? ' class="active"' : ''; printf( '<li%s><a href="%s">%s</a></li>' . "\n", $class, esc_url( get_pagenum_link( 1 ) ), '1' ); if ( ! in_array( 2, $links ) ) echo '<li class="pagination-omission">…</li>'; } //* Link to current page, plus 2 pages in either direction if necessary sort( $links ); foreach ( (array) $links as $link ) { $class = $paged == $link ? ' class="active"' : ''; printf( '<li%s><a href="%s">%s</a></li>' . "\n", $class, esc_url( get_pagenum_link( $link ) ), $link ); } //* Link to last page, plus ellipses if necessary if ( ! in_array( $max, $links ) ) { if ( ! in_array( $max - 1, $links ) ) echo '<li class="pagination-omission">…</li>' . "\n"; $class = $paged == $max ? ' class="active"' : ''; printf( '<li%s><a href="%s">%s</a></li>' . "\n", $class, esc_url( get_pagenum_link( $max ) ), $max ); } //* Next Post Link if ( get_next_posts_link() ) printf( '<li class="pagination-next">%s</li>' . "\n", get_next_posts_link( apply_filters( 'genesis_next_link_text', __( 'Next Page', 'genesis' ) . '»' ) ) ); echo '</ul></div>' . "\n"; } //* Run the Genesis loop genesis();
November 25, 2020 at 7:29 am #502069dekraan
ParticipantProblem solved. By simply removing the following php-code:
//* Add even/odd post class add_filter( 'post_class', 'gd_grid_post_class' );
November 25, 2020 at 8:39 am #502071 -
AuthorPosts
Viewing 3 posts - 1 through 3 (of 3 total)
- The topic ‘One column instead of two’ is closed to new replies.