• Resolved Ian

    (@ianaleksander)


    I’m not even sure where to start with this… I like the way my tagging system is going, but I’d like to add a second set of tags.

    here is my site, which is a list of dc comics trade paperbacks:

    https://tradereadingorder.ianaleksanderadams.com

    I want to build a database that can be useful and read in many different ways, and one thing I’m using is tags to display a list of titles including a certain character, for example. (that’s the list of tags on the right sidebar)

    I’d also really like to be able to tag creators in a book (authors, letters, artists, etc) but I don’t want those tags displaying in the same list as the character tags. Possibly even want to do a seperate list for events, etc and so on. Some of these things are broad enough for me to use categories, but for the larger lists (especially the creator one) I really like it in tags.

    So anyone know how to do this? I’d like to be able to keep putting the info in like tags, but have a separate box on the write/read page right under and have them called by something else (like “creator-tag”). Anyone know a plugin that does this? I can’t seem to find one. Or am I going about this all wrong?

Viewing 8 replies - 1 through 8 (of 8 total)
  • What you are talking about is custom taxonomies, I think.

    Thread Starter Ian

    (@ianaleksander)

    yeah that looks about right! Thanks for the link – I’ll check it out and see if this works for my needs!

    Thread Starter Ian

    (@ianaleksander)

    awesome, this will work for my data.

    Is there anyway to also get it to work with the Configurable Tag Cloud widgit?

    https://www.ads-software.com/extend/plugins/configurable-tag-cloud-widget/

    I like the way I can control the display of information with that.

    Thread Starter Ian

    (@ianaleksander)

    I’m also working to add in custom taxonomies to my bulk edit template.

    This theme seems to have info on that:

    https://themehybrid.com/support/topic/add-custom-taxonomy-to-editphp

    Thread Starter Ian

    (@ianaleksander)

    this code works to add one column, but I need to add 3 – I’m sure there’s something I can change but I’m not sure what. Is it the numbers (like 10,3?)

    add_filter('manage_posts_columns', 'custom_admin_columns'); 
    
    // Unsetting comments, author and date from my Admin Post Index.  Adding in technologies (taxonomy) column
    function custom_admin_columns($defaults) {
        unset($defaults['comments']);
        unset($defaults['author']);
        unset($defaults['date']);
        $defaults['technologies'] = __('Technologies');
        return $defaults;
    }
    
    // bulk edit taxonomies 
    
    add_action('bulk_edit_custom_box', 'custom_bulk_edit_technologies',11,2);  
    
    function custom_bulk_edit_technologies($column_name, $type) {
    
    	if ( $type == 'post' && $column_name == 'technologies' ) {
    	?>
    	<fieldset class="inline-edit-col-right"><div class="inline-edit-col">
    
    		<label class="inline-edit-taxonomy-<?php $column_name ; ?>">
    			<span class="title"><?php echo ucfirst($column_name) ; ?></span>
    			<textarea cols="22" rows="1" name="<?php echo $column_name ; ?>_input" class="<?php echo $column_name ; ?>_input"></textarea>
    			<input type="hidden" name="bulk_edit_<?php echo $column_name ; ?>" value="bulk" />
    		</label>
    
    	</div></fieldset>
    	<?php
    	}
    }                                                   
    
    add_action('save_post','custom_set_bulk_technologies',10,3);        
    
    function custom_set_bulk_technologies($post_ID, $post) {        
    
    	$type = $post->post_type ;
    	$taxonomy_name = "technology" ;
    	$column_name = "technologies";
    
    	if ( $type == 'post' && $_GET['bulk_edit_' . $column_name] == 'bulk' && $_GET[$column_name . '_input'] != '') {   
    
            $current_terms_full = get_the_terms($post->ID, $taxonomy_name);
    
    		foreach ($current_terms_full AS $current) {
    			$current_terms[] = $current->name ;
    		}
    
    		$submitted_terms = explode(",",$_GET[$column_name . '_input']);
    
    		if ($current_terms) {
    			$terms = array_merge($current_terms, $submitted_terms);
    		}
    		else {
    			$terms = $submitted_terms;
    		}
    
    	   	$success = wp_set_object_terms($post->ID, $terms, $taxonomy_name);   
    
    	}
    }
    Thread Starter Ian

    (@ianaleksander)

    well, I started using my categories instead of one of my custom taxonomies (actually working quite well) so I only need two. There is that alternative way to get both new columns listed in the admin dash, but I’d still like to be able to mass edit them.

    Thread Starter Ian

    (@ianaleksander)

    Managed to get it by tweaking the scripts found on the above page.

    If you do it, it’s fairly straightforward if you understand the code (I just have to figure it out every time because I really don’t know the basics haha).

    Just keep a backup of your functions.php so you can restore it if you ruin something! Editing it through the admin panel won’t be possible if you mess up!

    Try this. (I tested on v2.9.2 and works fine.)

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Second set of tags?’ is closed to new replies.