Я застрял при попытке отредактировать мою текущую тему (называется Кэрри). Я использую детскую тему. Так что я пытаюсь добиться, чтобы отредактировать / улучшить одну из функций темы под названием « carrie_header_post_show ». Эта функция находится в родительском файле (находится в каталоге inc) и называется theme-functions.php. Код выглядит следующим образом:
function carrie_header_post_show() {
$carrie_theme_options = carrie_get_theme_options();
$header_post_html = '';
if(isset($carrie_theme_options['header_post_id']) && $carrie_theme_options['header_post_id']<>'') {
$header_post_id = $carrie_theme_options['header_post_id'];
$header_post = get_post($header_post_id);
if($header_post) {
if(has_post_thumbnail( $header_post_id )) {
$header_post_thumb_id = get_post_thumbnail_id($header_post_id);
$header_post_image_url = wp_get_attachment_image_src( $header_post_thumb_id, 'carrie-blog-thumb-widget');
$header_post_image = '<a href="'.get_permalink($header_post_id).'"><img src="'.esc_url($header_post_image_url[0]).'" alt="'.esc_attr($header_post->post_title).'"/></a>';
} else {
$header_post_image = '';
}
$header_post_categories_list = get_the_category_list(', ', 0, $header_post_id);
$header_post_html .= '<div class="header-post-image hover-effect-img">'.wp_kses_post($header_post_image).'</div>';
$header_post_html .= '<div class="header-post-details">';
$header_post_html .= '<div class="header-post-category">';
$title = wp_kses_post($header_post_categories_list);
$header_post_html .= '</div>';
$header_post_html .= '<div class="header-post-title"><a href="'.get_permalink($header_post_id).'">'.wp_kses_post($header_post->post_title).'</a></div>';
$header_post_html .= '</div>';
echo '<div class="header-post-content clearfix">'.wp_kses_post($header_post_html).'</div>';
}
}
}
Чего я хотел бы добиться, так это добавить несколько строк кода. Я пробовал следующие действия:
- Создание папки inc в дочерней теме, файла назначения (theme-functions.php), а также его редактирование. Не работает, получил ошибку.
- Помещение отредактированной функции в дочерние функции. То же самое здесь - не работает.
- Помещение функции в оператор IF - тоже самое, не работает.
Так что мне тогда делать?