I've stucked while trying to edit my current theme (called Carrie). I'm using a child theme. So what I'm trying to achieve is to edit/ehnance one of the theme's functions called 'carrie_header_post_show'. This function is in the parent file (located in inc directory) called theme-functions.php. The code looks as following:
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>';
}
}
}
What I would like to achieve is to add few lines of code. I've tried following actions:
- Creating inc folder in child theme, the destination file (theme-functions.php) as well and edit it. Doesn't work, got an error.
- Placing edited function into child's functions.php. Same here - doesn't work.
- Putting the function in the IF statement - same, doesn't work.
So what should i do then?
runkit_function_redefine()
. – pavel