0
카테고리 섬네일 목록이라는 플러그인을 사용하고 있습니다. 나는 보통 내 Wordpress 페이지에 후크 [categorythumbnaillist 100]
을 배치합니다. 어떻게 이것을 실제 PHP 페이지에 추가 할 수 있습니까?Wordpress 플러그인 훅을 index.php에 어떻게 추가 할 수 있습니까?
http://wordpress.org/extend/plugins/categoy-thumbnail-list/
플러그인 코드 :
$categoryThumbnailList_Order = stripslashes(get_option('category-thumbnail-list_order'));
if ($categoryThumbnailList_Order == '') {
$categoryThumbnailList_Order = 'date';
}
$categoryThumbnailList_OrderType = stripslashes(get_option('category-thumbnail-list_ordertype'));
if ($categoryThumbnailList_OrderType == '') {
$categoryThumbnailList_OrderType = 'DESC';
}
$categoryThumbnailList_Path = get_option('siteurl')."/wp-content/plugins/categoy-thumbnail-list/";
define("categoryThumbnailList_REGEXP", "/\[categorythumbnaillist ([[:print:]]+)\]/");
define("categoryThumbnailList_TARGET", "###CATTHMBLST###");
function categoryThumbnailList_callback($listCatId) {
global $post;
global $categoryThumbnailList_Order;
global $categoryThumbnailList_OrderType;
$tmp_post = $post;
$myposts = get_posts('numberposts=-1&&category='.$listCatId[1].'&&orderby='.$categoryThumbnailList_OrderType.'&&order='.$categoryThumbnailList_Order);
$output = '<div class="categoryThumbnailList">';
foreach($myposts as $post) :
setup_postdata($post);
if (has_post_thumbnail()) {
$link = get_permalink($post->ID);
$thmb = get_the_post_thumbnail($post->ID,'thumbnail');
$title = get_the_title();
$output .= '<div class="categoryThumbnailList_item">';
$output .= '<a href="' .$link . '" title="' .$title . '">' .$thmb . '</a><br/>';
$output .= '<a href="' .$link . '" title="' .$title . '">' .$title . '</a>';
$output .= '</div>';
}
endforeach;
/*
$output .= '</div>';
$output .= '<div class="categoryThumbnailList_clearer"></div>';
return ($output);
$output = '';
$post = $tmp_post;
setup_postdata($post);
*/
$output .= '</div>';
$output .= '<div class="categoryThumbnailList_clearer"></div>';
$post = $tmp_post;
wp_reset_postdata();
return ($output);
$output = '';
}
function categoryThumbnailList($content) {
return (preg_replace_callback(categoryThumbnailList_REGEXP, 'categoryThumbnailList_callback', $content));
}
function categoryThumbnailList_css() {
global $categoryThumbnailList_Path;
echo "
<style type=\"text/css\">
@import url(\"".$categoryThumbnailList_Path."categoy-thumbnail-list.css\");
</style>
";
}
add_action('wp_head', 'categoryThumbnailList_css');
add_filter('the_content', 'categoryThumbnailList',1);
?>
방금 페이지에 텍스트로 [categorythumbnaillist 100]을 출력했습니다. 다른 해결책? – McGuyverr
안녕하세요, McGuyverr, 나쁜 소식 ... 현재 wth_content 영역 외부에 배치되지 않았기 때문에 categorythumbnaist는 편집기에서만 작동합니다. – Denish
간단한 스크립트를 작성하여이 작업을 수행 할 수 있습니까? – McGuyverr