0
내가 사용하는 워드 프레스에 the_content
후 my_custom_function
를 추가하기 위해 노력하고있어워드 프레스는()
add_filter ('the_content', 'my_custom_function');
add_action ('the_content', 'my_custom_function'); // I tried both
내 my_custom_function
기능은 내 문제는이 코드입니다이
function my_custom_function($content) {
if(is_single()) {
$content .= "this is custom function content";
$content .= my_another_custom_function();
$content .= "this is custom function content";
}
return $content;
}
같다 추가 my_another_custom_function()
전에the_content
하지만 난 후 내용을 원한다. 코드 $content .= "this is custom function content";
에 주어진
다른 2 개 라인은 테스트 용이며 이들은 누군가가 나에게 그것을 해결하는 내가 잘못하고있는 무슨 방법에 대한 어떤 생각을 적어주세요 수the_content
후 을 표시하고 있습니다 ...
내 another_custom_function는 { \t \t 에코 '
'이 ' 함수 m_a_c_f 같다; \t \t foreach ($ result as $ result) { \t \t \t echo '- '; \t \t \t echo $ result-> title; \t \t \t echo '
'; \t} \t \t echo '
'; }' 에코가 아닌 이것을 반환하는 방법을 알려주십시오.이 함수를 다른 곳에서 사용해야합니다. [수동]. 그 후에 어떻게 사용할 수 있습니까? – Anuj감사합니다! – Anuj