Re: 【カテゴリページでdiv.loopimgが表示される】

フォーラム テンプレート(テーマ) 【カテゴリページでdiv.loopimgが表示される】 Re: 【カテゴリページでdiv.loopimgが表示される】

#66224
s_kawa
参加者

echo the_extra_category_content();

のソースは以下の通りです。

<?php

$option_prefix = ‘extra_cat_content_’;

function ecc_init(){

global $option_prefix;

if ( is_admin() && current_user_can(‘manage_categories’) ) {

if ( user_can_richedit() ){

remove_filter(‘edit_category_form_fields’, ‘wp_filter_kses’);

}

if ( isset($_GET) && ‘edit’ === $_GET && strpos( $_GET, ‘category’ ) >= 0 && !empty($_GET) && user_can_richedit() ) {

add_action( $_GET . ‘_edit_form_fields’, ‘ecc_attach_field’);

//WP < 3.3

if ( !function_exists( “wp_editor” ) ){

add_action(‘admin_print_styles’, ‘ecc_admin_css’);

}

}elseif( isset($_POST) && ‘editedtag’ === $_POST && !empty($_POST) ){

add_action(‘edited_’ . $_POST, ‘ecc_save_field’);

}

}

}

function ecc_attach_field(){

global $option_prefix;

$extra_content = stripcslashes( get_option( $option_prefix . $_GET ) );

$settings = array(

‘wpautop’ => false,

‘media_buttons’ => true,

‘quicktags’ => array(

‘buttons’ => ‘b,i,ul,ol,li,link,close’

),

‘textarea_name’=>’extra_description’

);

echo ‘ <tr class=”form-field”>

<th scope=”row” valign=”top”><label for=”extra_description”>Extra description</label></th>

<td>’;

if( function_exists( “wp_editor” ) ){

//WP >= 3.3

wp_editor( $extra_content, “extradescription”, $settings );

}else{

//WP < 3.3

wp_tiny_mce( false , array( “editor_selector” => “extra_description” ) );

echo'<textarea name=”extra_description” id=”extra_description” class=”extra_description” rows=”5″ cols=”50″ style=”width: 97%;”>’.$extra_content.'</textarea>
‘;

}

echo'<span class=”description”>Get this field content on the public side using << <b>echo the_extra_category_content( )</b> >></span>

</td>

</tr>’;

}

function ecc_save_field(){

global $option_prefix;

$name = $option_prefix . $_POST;

$value = $_POST;

update_option( $name, $value );

}

function ecc_admin_css(){

wp_enqueue_style( ‘ecc_scripts’ , plugins_url(‘/include/style.css’, __FILE__) );

}

function the_extra_category_content( $catid = null ){

global $option_prefix, $wp_query;

if( is_null( $catid ) ){

$cat = get_the_category();

if( is_tag() ){

$catid = get_query_var(‘tag_id’);

}else if( is_category() ){

$catid = get_query_var(‘cat’);

}else if( count( $cat ) ){

$catid = $cat[0]->cat_ID;

}else {

$catid = $wp_query->get_queried_object_id();

}

if( !$catid ){

return ”;

}

}

$extra_content = get_option( $option_prefix . $catid );

if( $extra_content ){

return apply_filters(‘the_content’, stripcslashes( $extra_content ) );

}else{

return “”;

}

}

add_action(‘load-categories.php’, ‘ecc_init’);

add_action(‘load-edit-tags.php’, ‘ecc_init’);

?>

プラグインは、以下の通りです。

Akismet

category editor

Image Widget

Item List Layout

Multi Price

Nivo Slider for WordPress

Order List Widget

PS Auto Sitemap

Search Everything

ShowID for Post/Page/Category/Tag/Comment

SI CAPTCHA Anti-Spam

welcart

TinyMCE Advanced

Widget Cart

WordPress FAQ Manager

WP Multibyte Patch

以上どうぞよろしくお願い申し上げます。