prfbst
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Custom Taxonomies Filter in manage postsThanks i did find an anwser there a while ago:)
Forum: Hacks
In reply to: Custom Taxonomies Filter in manage posts screenThis adds a new colomn with the taxonomy name and link:
register_post_type( 'book', array( 'labels' => array( 'name' => 'Books', 'singular_name' => 'Book', 'add_new' => 'Add New', 'add_new_item' => 'Add New Book', 'edit_item' => 'Edit book', 'edit' => 'Edit', 'new_item' => 'New Book', 'view_item' => 'View Book', 'search_items' => 'Search Books', 'not_found' => 'No books found', 'not_found_in_trash' => 'No books found in Trash', 'view' => 'View Book' ), 'public' => true, 'capability_type' => 'post', 'hierarchical' => false, 'rewrite' => true, 'query_var' => true, 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'custom-fields', 'comments' ), 'taxonomies' => array('category','post_tag') ) ); register_taxonomy( 'book_category', 'book', array( 'hierarchical' => true, 'label' => 'Categori?n', 'public' => true, 'query_var' => true, 'show_tagcloud' => true, 'rewrite' => Array( 'slug' => 'book_category') ) ); function add_new_columns($defaults) { $defaults['book_cats'] = __('Categori?n'); return $defaults; } function add_column_data( $column_name, $post_id ) { if( $column_name == 'book_cats' ) { $_posttype = 'book'; $_taxonomy = 'book_category'; $terms = get_the_terms( $post_id, $_taxonomy ); if ( !empty( $terms ) ) { $out = array(); foreach ( $terms as $c ) $_taxonomy_title = esc_html(sanitize_term_field('name', $c->name, $c->term_id, 'category', 'display')); $out[] = "<a href='edit.php?book_category=$_taxonomy_title&post_type=$_posttype'>$_taxonomy_title</a>"; echo join( ', ', $out ); } else { _e('Uncategorized'); } } } add_filter( 'manage_book_posts_columns', 'add_new_columns' ); add_action( 'manage_posts_custom_column', 'add_column_data', 10, 2 );
Forum: Fixing WordPress
In reply to: Custom Taxonomies Filter in manage postsFor anyone who is interested:
register_post_type( 'book', array( 'labels' => array( 'name' => 'Books', 'singular_name' => 'Book', 'add_new' => 'Add New', 'add_new_item' => 'Add New Book', 'edit_item' => 'Edit book', 'edit' => 'Edit', 'new_item' => 'New Book', 'view_item' => 'View Book', 'search_items' => 'Search Books', 'not_found' => 'No books found', 'not_found_in_trash' => 'No books found in Trash', 'view' => 'View Book' ), 'public' => true, 'capability_type' => 'post', 'hierarchical' => false, 'rewrite' => true, 'query_var' => true, 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'custom-fields', 'comments' ), 'taxonomies' => array('category','post_tag') ) ); register_taxonomy( 'book_category', 'book', array( 'hierarchical' => true, 'label' => 'Categori?n', 'public' => true, 'query_var' => true, 'show_tagcloud' => true, 'rewrite' => Array( 'slug' => 'book_category') ) ); function add_new_columns($defaults) { $defaults['book_cats'] = __('Categori?n'); return $defaults; } function add_column_data( $column_name, $post_id ) { if( $column_name == 'book_cats' ) { $_posttype = 'book'; $_taxonomy = 'book_category'; $terms = get_the_terms( $post_id, $_taxonomy ); if ( !empty( $terms ) ) { $out = array(); foreach ( $terms as $c ) $_taxonomy_title = esc_html(sanitize_term_field('name', $c->name, $c->term_id, 'category', 'display')); $out[] = "<a href='edit.php?book_category=$_taxonomy_title&post_type=$_posttype'>$_taxonomy_title</a>"; echo join( ', ', $out ); } else { _e('Uncategorized'); } } } add_filter( 'manage_book_posts_columns', 'add_new_columns' ); add_action( 'manage_posts_custom_column', 'add_column_data', 10, 2 );
Forum: Fixing WordPress
In reply to: Custom Taxonomies Filter in manage postsI see that you can do it by hand:
edit.php?s&post_status=all&post_type=book&mode=list&action=-1&m=0&cat=3&action2=-1book being the new post type and 3 the id of the custom taxonomy
I presume you have to add the box manually? Any support link on this? thanks
Forum: Hacks
In reply to: Custom Taxonomies Filter in manage posts screenIm searching for the same do any of de wp gurus have a answer for us?:)
Forum: Plugins
In reply to: add_action right after <body> tagsry im a bit unclear still so here is basically the function I have:
<? function my_function() { ?> <div id="from_my_function"></div> <? } add_action('wp_head', 'my_function'); ?>
Ok so now instead of wp_head or wp_footer is there a way I can append it to the body?
Forum: Plugins
In reply to: add_action right after <body> tagWell the the function I mentioned is usually used in a plugin or functions.php (im writing a plugin ) and i want to add some html (div “from my function”) to where it is now:
<body> <div id="from_my_function"></div> <div id="wrap"></div> </body>
There are variations like wp_head, wp_meta or wp_footer etc, but I was wondering if i can directly add it to the <body> tag.
tx