• Всем доброго времени суток! Работаю на WordPress версии 3.0.0
    Столкнулся с проблемой — мне нужно вывести checklist tags на странице
    Вот код

    function post_tags_meta_box($post, $box) {
    	$tax_name = esc_attr(substr($box['id'], 8));
    	$taxonomy = get_taxonomy($tax_name);
    	$helps = isset($taxonomy->helps) ? esc_attr($taxonomy->helps) : __('Separate tags with commas.');
    ?>
    <div class="tagsdiv" id="<?php echo $tax_name; ?>">
    	<div class="jaxtag">
    	<div class="nojs-tags hide-if-js">
    	<p><?php _e('Add or remove tags'); ?></p>
    	<textarea name="<?php echo "tax_input[$tax_name]"; ?>" class="the-tags" id="tax-input[<?php echo $tax_name; ?>]"><?php echo esc_attr(get_terms_to_edit( $post->ID, $tax_name )); ?></textarea></div>
    
    	<span class="ajaxtag hide-if-no-js">
    		<label class="screen-reader-text" for="new-tag-<?php echo $tax_name; ?>"><?php echo $box['title']; ?></label>
    		<input type="text" id="new-tag-<?php echo $tax_name; ?>" name="newtag[<?php echo $tax_name; ?>]" class="newtag form-input-tip" size="16" autocomplete="off" value="<?php esc_attr_e('Add new tag'); ?>" />
    		<input type="button" class="button tagadd" value="<?php esc_attr_e('Add'); ?>" tabindex="3" />
    	</span></div>
    	<p class="howto"><?php echo $helps; ?></p>
    	<div class="tagchecklist"></div>
    </div>
    <p class="tagcloud-link hide-if-no-js"><a href="#titlediv" class="tagcloud-link" id="link-<?php echo $tax_name; ?>"><?php printf( __('Choose from the most used tags in %s'), $box['title'] ); ?></a></p>
    <?php
    }
    
    // all tag-style post taxonomies
    foreach ( get_object_taxonomies('post') as $tax_name ) {
    	if ( !is_taxonomy_hierarchical($tax_name) ) {
    		$taxonomy = get_taxonomy($tax_name);
    		$label = isset($taxonomy->label) ? esc_attr($taxonomy->label) : $tax_name;
    
    		add_meta_box('tagsdiv-' . $tax_name, $label, 'post_tags_meta_box', 'post', 'side', 'core');
    	}
    }

    <div class="tagchecklist"></div> место, в котором должен быть вывод checklist’а, сейчас там пусто. В коде есть место, в котором выводится checklist категорий, мне нужно так же вывести tags. На всякий пожарный скину рабочий код вывода checklist’а категорий

    function post_categories_meta_box($post) {
    ?>
    <ul id="category-tabs">
    	<li class="tabs"><a href="#categories-all" tabindex="3"><?php _e( 'All Categories' ); ?></a></li>
    	<li class="hide-if-no-js"><a href="#categories-pop" tabindex="3"><?php _e( 'Most Used' ); ?></a></li>
    </ul>
    
    <div id="categories-pop" class="tabs-panel" style="display: none;">
    	<ul id="categorychecklist-pop" class="categorychecklist form-no-clear" >
    <?php $popular_ids = wp_popular_terms_checklist('category'); echo $popular_ids; ?>
    	</ul>
    </div>
    
    <div id="categories-all" class="tabs-panel">
    	<ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
    <?php wp_category_checklist($post->ID, false, false, $popular_ids) ?>
    	</ul>
    </div>
    
    <?php if ( current_user_can('manage_categories') ) : ?>
    <div id="category-adder" class="wp-hidden-children">
    	<h4><a id="category-add-toggle" href="#category-add" class="hide-if-no-js" tabindex="3"><?php _e( '+ Add New Category' ); ?></a></h4>
    	<p id="category-add" class="wp-hidden-child">
    	<label class="screen-reader-text" for="newcat"><?php _e( 'Add New Category' ); ?></label><input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php esc_attr_e( 'New category name' ); ?>" tabindex="3" aria-required="true"/>
    	<label class="screen-reader-text" for="newcat_parent"><?php _e('Parent category'); ?>:</label><?php wp_dropdown_categories( array( 'hide_empty' => 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category'), 'tab_index' => 3 ) ); ?>
    	<input type="button" id="category-add-sumbit" class="add:categorychecklist:category-add button" value="<?php esc_attr_e( 'Add' ); ?>" tabindex="3" />
    <?php	wp_nonce_field( 'add-category', '_ajax_nonce', false ); ?>
    	<span id="category-ajax-response"></span></p>
    </div>
    <?php
    endif;
    
    }
    add_meta_box('categorydiv', __('Categories'), 'post_categories_meta_box', 'post', 'side', 'core');

    Уважаемые вордпрессеры, очень надеюсь на вашу помощь!

Просмотр 7 ответов — с 1 по 7 (всего 7)
Просмотр 7 ответов — с 1 по 7 (всего 7)
  • Тема «Вывод checklist'а» закрыта для новых ответов.