by wp-admin | Aug 6, 2015 | blg, Wordpress |
function restrict_books_by_assessment() { global $typenow; $post_type = 'assessment'; // change HERE $taxonomy = 'it-assessment'; // change HERE if ($typenow == $post_type) { $selected = isset($_GET[$taxonomy]) ? $_GET[$taxonomy] : ''; $info_taxonomy = get_taxonomy($taxonomy); wp_dropdown_categories(array( 'show_option_all' => __("Show All {$info_taxonomy->label}"), 'taxonomy' => $taxonomy, 'name' => $taxonomy, 'orderby' => 'name', 'selected' => $selected, 'show_count' => true, 'hide_empty' => true, )); }; } add_action('restrict_manage_posts', 'restrict_books_by_assessment'); function convert_id_to_assessment_in_query($query) { global $pagenow; $post_type = 'assessment'; // change HERE $taxonomy = 'it-assessment'; // change HERE $q_vars = &$query->query_vars; if ($pagenow == 'edit.php' && isset($q_vars['post_type']) && $q_vars['post_type'] == $post_type && isset($q_vars[$taxonomy]) && is_numeric($q_vars[$taxonomy]) && $q_vars[$taxonomy] != 0) { $term = get_term_by('id', $q_vars[$taxonomy], $taxonomy); $q_vars[$taxonomy] = $term->slug; } } add_filter('parse_query',...
by wp-admin | Jun 11, 2014 | Wordpress |
You can not enhance the drop down list formatselect. But you can enhance with the hook tiny_mce_before_init the second drop down styleselect, there is hide in a default WordPress install. The documentation list all defaults and possibilities. inline – Name of the inline element to produce for example “span”. The current text selection will be wrapped in this inline element. block – Name of the block element to produce for example “h1″. Existing block elements within the selection gets replaced with the new block element. selector – CSS 3 selector pattern to find elements within the selection by. This can be used to apply classes to specific elements or complex things like odd rows in a table. classes – Space separated list of classes to apply the the selected elements or the new inline/block element. styles – Name/value object with CSS tyle items to apply such as color etc. attributes – Name/value object with attributes to apply to the selected elements or the new inline/block element. exact – Disables the merge similar styles feature when used. This is needed for some CSS inheritance issues such as text-decoration for underline/strikethough. wrapper – State that tells that the current format is a container format for block elements. For example a div wrapper or blockquote. The Style Button Note that, by default, the Style dropdown is hidden in WordPress. At first add the button for custom formats to a menu bar of TinyMCE, in example line 2 with hook mce_buttons_2. add_filter( 'mce_buttons_2', 'fb_mce_editor_buttons' ); function fb_mce_editor_buttons( $buttons ) { array_unshift( $buttons, 'styleselect' ); return $buttons; } The Custom Styles Then enhance the drop down of this button. Aslo useful...