У меня есть этот Сокращенный код ..шорткод не работает WordPress
function codeThree($attr,$content) {
extract(shortcode_atts(array(
'style' => 'design1',
'title' => 'Here is where the title will be reside..',
'image' => 'codethreeimg'
), $atts));
$dir = get_template_directory_uri();
return '<div class="codethree extend" style="background: transparent url('.$dir.'/images/'.$style.'.jpg) no-repeat top center;"><img class="codethreeimg" src="'.$dir.'/'.$image.'" /><p class="codethreep"><h2 class="codethreetitle">'.$title.'</h2><br/>'.do_shortcode($content).'</p></div>';
}
function register_shortcodes(){
add_shortcode('codethree', 'codeThree');
}
add_action('init', 'register_shortcodes');
и это для их отображения ..
[codethree style="design1" title="Hi, I'm Armando Gutierrez, #1 Personal Trainer in Torrance & LA, and Body Transformation Specialist." image="http://localhost/wordpress/wp-content/uploads/2013/09/Profile.png"]some contents here[/codethree]
, как вы можете видеть, это:
'style' => 'design1',
'title' => 'Here is where the title will be reside..',
'image' => 'codethreeimg'
будет по умолчанию, если пользователь не укажет, что он определяет контент в этих полях массива, но что происходит, содержимое по умолчанию было отображено althouou gh эти поля были заполнены пользователем, определяющим контент.
[codethree style="design1" title="Hi, I'm Armando Gutierrez, #1 Personal Trainer in Torrance & LA, and Body Transformation Specialist." image="http://localhost/wordpress/wp-content/uploads/2013/09/Profile.png"]some contents here[/codethree]
Может кто-нибудь проверить мои коды и хотя бы рассказать мне, что случилось? Я открыт для любых предложений, идей и рекомендаций! Заранее спасибо.
Хорошо, некоторая незначительная ошибка относительно кода, так или иначе Heres обновления, как я нашел решение. это функция codeThree ($ атр, $ содержание) изменения в функции codeThree ($ АТЦ, $ содержание) спасибо! –