Title: Dashborad and website down after adding code
Last modified: August 22, 2016

---

# Dashborad and website down after adding code

 *  Resolved [Jessdelatorre](https://wordpress.org/support/users/jessdelatorre/)
 * (@jessdelatorre)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/dashborad-and-website-down-after-adding-code/)
 * Hi,
    I have been trying to create a Grid layout for my posts and I tried a code
   I found here: [http://www.billerickson.net/a-better-and-easier-grid-loop/](http://www.billerickson.net/a-better-and-easier-grid-loop/)
   After adding the code, I am unable to access Dashboard and the site seems to 
   be down too.
 * Now I cannot erase it from my public_html files ‘coz I do not know what to erase
   🙁
    My site is: jessicadelatorre.com Help!
 * The Code I added is:
 *     ```
       <?php
       /**
       * Grid Loop Pagination
       * Returns false if not grid loop.
       * Returns an array describing pagination if is grid loop
       *
       * @author Bill Erickson
       * @link http://www.billerickson.net/a-better-and-easier-grid-loop/
       *
       * @param object $query
       * @return bool is grid loop (true) or not (false)
       */
       function be_grid_loop_pagination( $query = false ) {
       // If no query is specified, grab the main query
       global $wp_query;
       if( !isset( $query ) || empty( $query ) || !is_object( $query ) )
       $query = $wp_query;
       // Sections of site that should use grid loop
       if( ! ( $query->is_home() || $query->is_archive() ) )
       return false;
       // Specify pagination
       return array(
       'features_on_front' => 5,
       'teasers_on_front' => 6,
       'features_inside' => 0,
       'teasers_inside' => 12,
       );
       }
       /**
       * Grid Loop Query Arguments
       *
       * @author Bill Erickson
       * @link http://www.billerickson.net/a-better-and-easier-grid-loop/
       *
       * @param object $query
       * @return null
       */
       function be_grid_loop_query_args( $query ) {
       $grid_args = be_grid_loop_pagination( $query );
       if( $query->is_main_query() && !is_admin() && $grid_args ) {
       // First Page
       $page = $query->query_vars['paged'];
       if( ! $page ) {
       $query->set( 'posts_per_page', ( $grid_args['features_on_front'] + $grid_args['teasers_on_front'] ) );
       // Other Pages
       } else {
       $query->set( 'posts_per_page', ( $grid_args['features_inside'] + $grid_args['teasers_inside'] ) );
       $query->set( 'offset', ( $grid_args['features_on_front'] + $grid_args['teasers_on_front'] ) + ( $grid_args['features_inside'] + $grid_args['teasers_inside'] ) * ( $page - 2 ) );
       // Offset is posts on first page + posts on internal pages * ( current page - 2 )
       }
       }
       }
       add_action( 'pre_get_posts', 'be_grid_loop_query_args' );
       /**
       * Grid Loop Post Classes
       *
       * @author Bill Erickson
       * @link http://www.billerickson.net/a-better-and-easier-grid-loop/
       *
       * @param array $classes
       * @return array $classes
       */
       function be_grid_loop_post_classes( $classes ) {
       global $wp_query;
       $grid_args = be_grid_loop_pagination();
       if( ! $grid_args || ! $wp_query->is_main_query() )
       return $classes;
       // First Page Classes
       if( ! $wp_query->query_vars['paged'] ) {
       // Features
       if( $wp_query->current_post < $grid_args['features_on_front'] ) {
       $classes[] = 'feature';
       // Teasers
       } else {
       $classes[] = 'one-third';
       if( 0 == ( $wp_query->current_post - $grid_args['features_on_front'] ) || 0 == ( $wp_query->current_post - $grid_args['features_on_front'] ) % 3 )
       $classes[] = 'first';
       }
       // Inner Pages
       } else {
       // Features
       if( $wp_query->current_post < $grid_args['features_inside'] ) {
       $classes[] = 'feature';
       // Teasers
       } else {
       $classes[] = 'one-third';
       if( 0 == ( $wp_query->current_post - $grid_args['features_inside'] ) || 0 == ( $wp_query->current_post - $grid_args['features_inside'] ) % 3 )
       $classes[] = 'first';
       }
       }
       return $classes;
       }
       add_filter( 'post_class', 'be_grid_loop_post_classes' );
       /**
       * Grid Image Sizes
       *
       */
       function be_grid_image_sizes() {
       add_image_size( 'be_grid', 175, 120, true );
       add_image_size( 'be_feature', 570, 333, true );
       }
       add_action( 'genesis_setup', 'be_grid_image_sizes', 20 );
       /**
       * Grid Loop Featured Image
       *
       * @param string image size
       * @return string
       */
       function be_grid_loop_image( $image_size ) {
       global $wp_query;
       $grid_args = be_grid_loop_pagination();
       if( ! $grid_args )
       return $image_size;
       // Feature
       if( ( ! $wp_query->query_vars['paged'] && $wp_query->current_post < $grid_args['features_on_front'] ) || ( $wp_query->query_vars['paged'] && $wp_query->current_post < $grid_args['features_inside'] ) )
       $image_size = 'be_feature';
       if( ( ! $wp_query->query_vars['paged'] && $wp_query->current_post > ( $grid_args['features_on_front'] - 1 ) ) || ( $wp_query->query_vars['paged'] && $wp_query->current_post > ( $grid_args['features_inside'] - 1 ) ) )
       $image_size = 'be_grid';
       return $image_size;
       }
       add_filter( 'genesis_pre_get_option_image_size', 'be_grid_loop_image' );
       /**
       * Fix Posts Nav
       *
       * The posts navigation uses the current posts-per-page to
       * calculate how many pages there are. If your homepage
       * displays a different number than inner pages, there
       * will be more pages listed on the homepage. This fixes it.
       *
       */
       function be_fix_posts_nav() {
       if( get_query_var( 'paged' ) )
       return;
       global $wp_query;
       $grid_args = be_grid_loop_pagination();
       if( ! $grid_args )
       return;
       $max = ceil ( ( $wp_query->found_posts - $grid_args['features_on_front'] - $grid_args['teasers_on_front'] ) / ( $grid_args['features_inside'] + $grid_args['teasers_inside'] ) ) + 1;
       $wp_query->max_num_pages = $max;
       }
       add_filter( 'genesis_after_endwhile', 'be_fix_posts_nav', 5 );
       ```
   

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

 *  Thread Starter [Jessdelatorre](https://wordpress.org/support/users/jessdelatorre/)
 * (@jessdelatorre)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/dashborad-and-website-down-after-adding-code/#post-5675187)
 * I wonder if anybody have the functions.php fresh file so I can just change it?
 * I didn’t do backup before the site went bananas.
 *  Moderator [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * (@keesiemeijer)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/dashborad-and-website-down-after-adding-code/#post-5675188)
 * Hi Jessdelatorre
 * Did you edit the functions.php file from your theme?
    [edit] I see you did 🙂
 * If so, try replacing the file on the server with the functions.php file from 
   a download of your theme by using [FTP](http://codex.wordpress.org/FTP_Clients)
   or whatever file management application your host provides.
 *  Moderator [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * (@keesiemeijer)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/dashborad-and-website-down-after-adding-code/#post-5675190)
 * Do you know where you downloaded the theme?
 *  Thread Starter [Jessdelatorre](https://wordpress.org/support/users/jessdelatorre/)
 * (@jessdelatorre)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/dashborad-and-website-down-after-adding-code/#post-5675194)
 * Nevermid, I contacted my host and they fixed it for me 😀
    Yeah, after I noticed
   the site and dashboard was down I tried replacing the functions.php file wioth
   a fresh one but it didn’t do the trick so I panicked and contacted my server.
 * But thank you keesiemeijer, they told me that it was a missplaced <php?
 *  Moderator [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * (@keesiemeijer)
 * [11 years, 4 months ago](https://wordpress.org/support/topic/dashborad-and-website-down-after-adding-code/#post-5675198)
 * No problem. I’m glad you’ve got it resolved 🙂

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

The topic ‘Dashborad and website down after adding code’ is closed to new replies.

## Tags

 * [Coding](https://wordpress.org/support/topic-tag/coding/)
 * [collapse](https://wordpress.org/support/topic-tag/collapse/)
 * [site is down](https://wordpress.org/support/topic-tag/site-is-down/)
 * [troubleshooting](https://wordpress.org/support/topic-tag/troubleshooting/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 5 replies
 * 2 participants
 * Last reply from: [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * Last activity: [11 years, 4 months ago](https://wordpress.org/support/topic/dashborad-and-website-down-after-adding-code/#post-5675198)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
