2017-02-09 2 views
0

내 경우 변수에PHP 인코딩 문자열 내가 워드 프레스 코어에서 오는 아래에이 코드를 가지고

printf(
    '<a class="row-title" href="%s" aria-label="%s">%s%s</a>', 
    get_edit_post_link($post->ID), 
    /* translators: %s: post title */ 
    esc_attr(sprintf(__('&#8220;%s&#8221; (Edit)'), $title)), 
    $pad, 
    $title 
); 

을 /wp-admin/includes/class-wp-posts-list-table.php 파일 $ 제목 iconfont HTML을 포함 즉

<i class="fa fa-heart"></i> 

enter image description here

PHP 코드는 오히려 난 것보다 웹 브라우저가 문자열로 HTML 문자를 표시하고있다 HTML로 표시하고 일을 렌더링하는 것입니다 그 후 e 폰트 굉장 아이콘.

필자는

htmlentities() 
html_entity_decode() 
htmlspecialchars() 

에서 포장 $ 타이틀을 시도 할 수있는 몇 가지 일 도움말 고맙습니다

+0

시도해 보셨습니까? '0x3, $ htmlentities ($ title, ENT_HTML5); ' –

답변

2

어디의 html_entity_decode를 사용 했습니까? 나는 이것을 시도했다 :

printf(
    '<a class="row-title" href="%s" aria-label="%s">%s%s</a>', 
    get_edit_post_link($post->ID), 
    /* translators: %s: post title */ 
    esc_attr(sprintf(__('&#8220;%s&#8221; (Edit)'), $title)), 
    $pad, 
    html_entity_decode($title) 
); 

그리고 그것은 보인다.

하지만 코어 파일을 변경하는 것은 좋지 않습니다. 구체적인 게시물 제목에는 아이콘을 추가 할 수 있지만 원본 파일을 변경하지 않고 모든 게시물에 아이콘을 추가 할 수있는 플러그인을 작성하거나 찾을 수 있습니다.

+0

네, 고맙습니다. 아무 것도 보이지 않았으므로 첫 번째 시도에서 간과 했었습니다.하지만 Font Awesome css 파일이 Admin 측에 포함되어 있지 않다는 것을 깨달았습니다. – grasesed

관련 문제