S
S
Skilful2212020-03-20 05:37:29
WordPress
Skilful221, 2020-03-20 05:37:29

500 Internal Server Error how to fix?

when you click on the photo gallery website or on the logo itself, an error 500 pops up, besides the sliders did not load, who can tell me what is the reason?

here is the slider code

/* ОТЗЫВЫ */


add_action('init', function (){
  add_theme_support( 'post-thumbnails'); 
  register_post_type('feedback', array(
    'labels'             => array(
      'name'               => 'Отзывы', // Основное название типа записи
      'singular_name'      => 'Отзывы', // отдельное название записи типа Book
      'add_new'            => 'Добавить отзывы',
      'add_new_item'       => 'Добавить новую информацию',
      'edit_item'          => 'Редактировать отзывы',
      'new_item'           => 'Новая информация',
      'view_item'          => 'Посмотреть отзывы',
      'search_items'       => 'Найти отзывы',
      'not_found'          =>  'Отзывы не найдено',
      'not_found_in_trash' => 'В корзине отзывы не найдено',
      'parent_item_colon'  => '',
      'menu_name'          => 'Отзывы'

    ),
    'public'             => false,
    'show_ui'            => true,
    'menu_icon'          => 'dashicons-testimonial',
    'supports'           => array('title','thumbnail')
  ) );
});

function getFeedback(){
  $args = array(
    'orderby' => 'date',
    'order' => 'ASC',
    'post_type' => 'feedback'
  );

  $reviews = [];

  foreach(get_posts($args) as $post) {
    $review = get_fields($post->ID);
    $review['name-city'] = $post->post_title;
    $review['img'] = get_the_post_thumbnail_url($post->ID, 'thumbnail');
    $reviews[] = $review;
  }

  return $reviews;
}



/* КУХНИ */



add_action('init', function (){
  register_post_type('kitchen', array(
    'labels'             => array(
      'name'               => 'Кухни', // Основное название типа записи
      'singular_name'      => 'Кухни', // отдельное название записи типа Book
      'add_new'            => 'Добавить кухню',
      'add_new_item'       => 'Добавить новую кухню',
      'edit_item'          => 'Редактировать кухни',
      'new_item'           => 'Новая кухня',
      'view_item'          => 'Посмотреть кухни',
      'search_items'       => 'Найти кухни',
      'not_found'          =>  'Кухни не найдено',
      'not_found_in_trash' => 'В корзине кухни не найдено',
      'parent_item_colon'  => '',
      'menu_name'          => 'Кухни'

    ),
    'public'             => false,
    'show_ui'            => true,
    'menu_icon'          => 'dashicons-buddicons-community',
    'supports'           => array('title','thumbnail')
  ) );
});

function getKitchen(){
  $args = array(
    'orderby' => 'date',
    'order' => 'ASC',
    'post_type' => 'kitchen'
  );

  $kitchens = [];

  foreach(get_posts($args) as $post) {
    $kitchen = get_fields($post->ID);
    $kitchen['img-kitchen'] = get_the_post_thumbnail_url($post->ID);
    $kitchens[] = $kitchen;
  }

  return $kitchens;
}



/* ШКАФЫ КУПЕ */


add_action('init', function (){
  register_post_type('closet', array(
    'labels'             => array(
      'name'               => 'Шкафы-купе', // Основное название типа записи
      'singular_name'      => 'Шкафы-купе', // отдельное название записи типа Book
      'add_new'            => 'Добавить шкаф-купе',
      'add_new_item'       => 'Добавить новый шкаф-купе',
      'edit_item'          => 'Редактировать шкафы-купе',
      'new_item'           => 'Новый шкаф-купе',
      'view_item'          => 'Посмотреть шкафы-купе',
      'search_items'       => 'Найти шкаф-купе',
      'not_found'          =>  'Шкаф-купе не найден',
      'not_found_in_trash' => 'В корзине шкаф-купе не найден',
      'parent_item_colon'  => '',
      'menu_name'          => 'Шкафы-купе'

    ),
    'public'             => false,
    'show_ui'            => true,
    'menu_icon'          => 'dashicons-grid-view',
    'supports'           => array('title','thumbnail')
  ) );
});

function getCloset(){
  $args = array(
    'orderby' => 'date',
    'order' => 'ASC',
    'post_type' => 'closet'
  );

  $closets = [];

  foreach(get_posts($args) as $post) {
    $closet = get_fields($post->ID);
    $closet['img-kitchen'] = get_the_post_thumbnail_url($post->ID);
    $closets[] = $closet;
  }

  return $closets;
}




/* Кабинеты*/


add_action('init', function (){
  register_post_type('classrooms', array(
    'labels'             => array(
      'name'               => 'Кабинеты руководителя', // Основное название типа записи
      'singular_name'      => 'Кабинеты руководителя', // отдельное название записи типа Book
      'add_new'            => 'Добавить кабинет руководителя',
      'add_new_item'       => 'Добавить новый кабинет руководителя',
      'edit_item'          => 'Редактировать кабинет руководителя',
      'new_item'           => 'Новый кабинет руководителя',
      'view_item'          => 'Посмотреть кабинет руководителя',
      'search_items'       => 'Найти кабинет руководителя',
      'not_found'          =>  'Кабинет руководителя не найден',
      'not_found_in_trash' => 'В корзине кабинет руководителя не найден',
      'parent_item_colon'  => '',
      'menu_name'          => 'Кабинет руководителя'

    ),
    'public'             => false,
    'show_ui'            => true,
    'menu_icon'          => 'dashicons-welcome-widgets-menus',
    'supports'           => array('title','thumbnail')
  ) );
});

function getClassrooms(){
  $args = array(
    'orderby' => 'date',
    'order' => 'ASC',
    'post_type' => 'classrooms'
  );

  $classroomss = [];

  foreach(get_posts($args) as $post) {
    $classrooms = get_fields($post->ID);
    $classrooms['img-kitchen'] = get_the_post_thumbnail_url($post->ID);
    $classroomss[] = $classrooms;
  }

  return $classroomss;
}



/* Оперативная мебель */


add_action('init', function (){
  register_post_type('ram', array(
    'labels'             => array(
      'name'               => 'Оперативная мебель', // Основное название типа записи
      'singular_name'      => 'Оперативная мебель', // отдельное название записи типа Book
      'add_new'            => 'Добавить оперативную мебель',
      'add_new_item'       => 'Добавить новую оперативную мебель',
      'edit_item'          => 'Редактировать оперативную мебель',
      'new_item'           => 'Новая оперативная мебель',
      'view_item'          => 'Посмотреть оперативную мебель',
      'search_items'       => 'Найти оперативную мебель',
      'not_found'          =>  'Оперативная мебель не найдена',
      'not_found_in_trash' => 'В корзине оперативной мебель не найдено',
      'parent_item_colon'  => '',
      'menu_name'          => 'Оперативная мебель'

    ),
    'public'             => false,
    'show_ui'            => true,
    'menu_icon'          => 'dashicons-admin-home',
    'supports'           => array('title','thumbnail')
  ) );
});

function getRam(){
  $args = array(
    'orderby' => 'date',
    'order' => 'ASC',
    'post_type' => 'ram'
  );

  $rams = [];

  foreach(get_posts($args) as $post) {
    $ram = get_fields($post->ID);
    $ram['img-kitchen'] = get_the_post_thumbnail_url($post->ID);
    $rams[] = $ram;
  }

  return $rams;
}

<section class="feedback_block">
      <a href="#" id="feedbacks" class="anchor"></a>
      <img src="<?php echo get_template_directory_uri();?>/assets/images/fb_b.png" alt="" class="fb_b">
      <div class="container">
        <div class="row">
          <div class="col-xs-12 text-center">
            <h2>Отзывы наших клиентов</h2>
          </div>
          <div class="col-xs-12">
          
            <img src="<?php echo get_template_directory_uri();?>/assets/images/fb_l.png" alt="" class="fb_l">
            <img src="<?php echo get_template_directory_uri();?>/assets/images/fb_r.png" alt="" class="fb_r">
            <div class="feedback_slider">
            
              <?php foreach(getFeedback() as $review): ?>

              <div>
                <div class="fb_card">
                  <div class="text">
                    <p><?php echo $review['text'] ?></p>
                  </div>
                  <div class="person">
                    <p class="name"><?php echo $review['name-city'] ?></p>
                    <img src="<?php echo $review['img'] ?>" alt="">
                  </div>
                </div>
              </div>

              <?php endforeach; ?>

            </div>
          </div>
        </div>
      </div>
    </section>
  
  <?php get_footer(); ?>


<div class="category_slider">
                    
                
                  <?php foreach(getKitchen() as $kitchen): ?>

                    <div>
                      <a href="<?php echo $kitchen['img-kitchen'] ?>" class="gallery_img">
                        <img src="<?php echo $kitchen['img-kitchen'] ?>" alt="">
                      </a>
                    </div>

                  <?php endforeach; ?>

                </div>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
Neopitniy, 2020-03-20
@Neopitniy

In my opinion, by turning on the display of errors, everything would immediately become clear. Even the Author.

S
Saboteur, 2020-03-20
@saboteur_kiev

1. Hide large sheets of code under spoilers
2. Look not at the code, but at the server logs, it will clearly indicate where to dig.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question