0
在WordPress櫻桃框架重寫功能,我想編輯template-general.php
文件的功能,但它的不同不能這樣做。我試圖按照this link, 但沒有幫助。櫻桃框架 - 在模板general.php
Link for Cherry framework下載文件的結構是:cherryframework4\lib\functions\template-general.php
我想重寫以下功能:
function cherry_get_site_logo($location = 'header') {
$logo_class = array();
switch ($location) {
case 'header':
$type = cherry_get_option('logo-type', 'text');
$logo_img_ids = cherry_get_option('logo-image-path', false);
$tag = is_front_page() ? 'h1' : 'h2';
$logo_class[] = 'site-title';
$logo_class[] = $type . '-logo';
$link_class = '';
break;
case 'footer':
$type = cherry_get_option('footer-logo-type', 'text');
$logo_img_ids = cherry_get_option('footer-logo-image-path', false);
$tag = 'div';
$logo_class[] = 'cherry-footer-logo';
$logo_class[] = $type . '-logo';
$link_class = 'footer-logo-link';
break;
default:
$tag = 'div';
$logo_class[] = $location . '-logo';
$link_class = '';
break;
}
$logo_class = apply_filters('cherry_logo_classes', $logo_class, $location);
$logo_class = array_unique($logo_class);
$logo_class = array_map('sanitize_html_class', $logo_class);
if ('image' == $type && false != $logo_img_ids) {
$images = explode(',', $logo_img_ids);
if (count($images) > 1) {
$logo_content = cherry_get_retina_logo($images);
} else {
$img = wp_get_attachment_url($images[0]);
$logo_image_format = apply_filters(
'cherry_logo_image_format',
'<a href="%1$s" rel="home"><img src="%2$s" alt="%3$s"></a>',
$location
);
$logo_content = sprintf($logo_image_format, home_url('/'), esc_url($img), get_bloginfo('title'));
}
} else {
$logo_content = cherry_get_site_link($link_class);
}
$logo = $logo_content ? sprintf('<%3$s class="%1$s">%2$s</%3$s>', join(' ', $logo_class), $logo_content, $tag) : '';
return apply_filters('cherry_get_site_logo', $logo, $location);
}
任何人都遇到過這個?
感謝您的回答...對不起,我沒有更新我從WP的開發得到了答案 - >連接 - > http://wordpress.stackexchange.com/questions/226159/cherry-framework-overriding-function-in-模板一般的PHP – Arun