Сайт и админка вылетает, когда я добавляю код в файл функции темы

  • Аватар Неизвестно

    Я помогаю своему другу со страницей на его сайте WordPress, но этот сайт делался платно одной фирмой. У меня была задача сделать фон на одной странице, но так как кроме фона на странице был так же и контейнер, который находился выше фона, и был белого цвета, мне нужно было сделать его прозрачным и для этого мне нужно было вставиь код который ниже в файл function.php, чтобы я мог менять css стили для отдельных элементво, нокак только я вставил и обновл страницу меня выкинуло из админки и выдало ошибку 500, и так же на сайте. С чем это связано и как можно решить эту проблему с контейнером? —
    //Custom CSS Widget
    add_action(‘admin_menu’, ‘custom_css_hooks’);
    add_action(‘save_post’, ‘save_custom_css’);
    add_action(‘wp_head’,’insert_custom_css’);
    function custom_css_hooks() {
    add_meta_box(‘custom_css’, ‘Custom CSS’, ‘custom_css_input’,
    ‘post’, ‘normal’, ‘high’);
    add_meta_box(‘custom_css’, ‘Custom CSS’, ‘custom_css_input’,
    ‘page’, ‘normal’, ‘high’);
    }
    function custom_css_input() {
    global $post;
    echo »;
    echo ».get_post_meta($post->ID,’_custom_css’,true).»;
    }
    function save_custom_css($post_id) {
    if (!wp_verify_nonce($_POST[‘custom_css_noncename’], ‘custom-css’)) return $post_id;
    if (defined(‘DOING_AUTOSAVE’) && DOING_AUTOSAVE) return $post_id;
    $custom_css = $_POST[‘custom_css’];
    update_post_meta($post_id, ‘_custom_css’, $custom_css);
    }
    function insert_custom_css() {
    if (is_page() || is_single()) {
    if (have_posts()) : while (have_posts()) : the_post();
    echo ».get_post_meta(get_the_ID(), ‘_custom_css’, true).’
    ‘;
    endwhile; endif;
    rewind_posts();
    }
    }

  • Аватар Неизвестно

    //Custom CSS Widget
    add_action(‘admin_menu’, ‘custom_css_hooks’);
    add_action(‘save_post’, ‘save_custom_css’);
    add_action(‘wp_head’,’insert_custom_css’);
    function custom_css_hooks() {
    add_meta_box(‘custom_css’, ‘Custom CSS’, ‘custom_css_input’,
    ‘post’, ‘normal’, ‘high’);
    add_meta_box(‘custom_css’, ‘Custom CSS’, ‘custom_css_input’,
    ‘page’, ‘normal’, ‘high’);
    }
    function custom_css_input() {
    global $post;
    echo »;
    echo ».get_post_meta($post->ID,’_custom_css’,true).»;
    }
    function save_custom_css($post_id) {
    if (!wp_verify_nonce($_POST[‘custom_css_noncename’], ‘custom-css’)) return $post_id;
    if (defined(‘DOING_AUTOSAVE’) && DOING_AUTOSAVE) return $post_id;
    $custom_css = $_POST[‘custom_css’];
    update_post_meta($post_id, ‘_custom_css’, $custom_css);
    }
    function insert_custom_css() {
    if (is_page() || is_single()) {
    if (have_posts()) : while (have_posts()) : the_post();
    echo ».get_post_meta(get_the_ID(), ‘_custom_css’, true).’
    ‘;
    endwhile; endif;
    rewind_posts();
    }
    }

  • Форум «Сайт и админка вылетает, когда я добавляю код в файл функции темы» закрыт для новых ответов.