Tag Info

Hot answers tagged

14

OK - in the end turned out to be fairly simple - as I'd had some kind of mental block - menu_order is a variable in the $post object (thanks to @brady for reminding me of that). @scribu's post on creating sortable column values then gives the rest. So, assuming the custom post type is called header_text, these are the functions and hooks that are needed: ...


9

See the follow-up post: http://scribu.net/wordpress/sortable-taxonomy-columns.html


9

here you go: <?php /* Plugin Name: ajaxed-status Plugin URI: http://en.bainternet.info Description: answer to : Custom column for changing post status via ajax http://wordpress.stackexchange.com/questions/33442/custom-column-for-changing-post-status-via-ajax Version: 1.0 Author: Bainternet Author URI: http://en.bainternet.info */ if ( ...


8

Here's how I recently added a custom taxonomy to the media library as a sortable column: // Add a new column add_filter('manage_media_columns', 'add_topic_column'); function add_topic_column($posts_columns) { $posts_columns['att_topic'] = _x('Topic', 'column name'); return $posts_columns; } // Register the column as sortable function ...


6

Changing admin columns belongs to a plugin, not to a theme file, because themes should never change anything else than frontend output. You can get the complete plugin here: Plugin Product Editor Column. Looking at the docs you linked to, I see the plugin author requires a child class that mixes multiple separate tasks. That’s not good. We will see in a ...


5

I found a solution that works for me! I dropped this code in functions.php : add_action('admin_head', 'my_column_width'); function my_column_width() { echo '<style type="text/css">'; echo '.column-mycolumn { text-align: center; width:60px !important; overflow:hidden }'; echo '</style>'; }


4

It's because you are checking 'event_date' == $vars['event_date'] not 'event_date' == $vars['orderby]. But don't use the request filter. Instead: add_action( 'pre_get_posts', 'event_column_orderby' ); function event_column_orderby( $query ) { if( ! is_admin() ) return; $orderby = $query->get( 'orderby'); if( 'event_date' ...


4

You can do this by hooking into the 'taxonomy'_edit_form and edited_'taxonomy' actions. add_action('taxonomy_edit_form', 'foo_render_extra_fields'); function foo_render_extra_fields(){ $term_id = $_GET['tag_ID']; $term = get_term_by('id', $term_id, 'taxonomy'); $meta = get_option("taxonomy_{$term_id}"); //Insert HTML and form elements here } ...


4

There are far better ways of doing this. Instead of modifying the user table, make use of User Meta. It has a dedicated table, and works the same way as post meta, but for users. add_user_meta get_user_meta update_user_meta There are many tutorials explaining how to add additional fields to the user profile using User meta to store them, and it's how a ...


3

here is a modified version of your class that should work: class Add_Blog_ID { public static function init() { $class = __CLASS__ ; if ( empty( $GLOBALS[ $class ] ) ) $GLOBALS[ $class ] = new $class; } public function __construct() { add_filter( 'wpmu_blogs_columns', array( $this, 'get_id' ) ); ...


3

Your problem is a simple typo: array($this, 'manage_post_columns', 10, 2) VS. array($this, 'manage_post_columns'), 10, 2 I guess you see the difference


3

You are using wrong number of arguments in add_filter, you specified to get 2 arguments and you are looking for third one: Update your add_filter code to this: add_filter( 'manage_post_tag_custom_column' , 'my_custom_column' , 10 , 3 ); The 3 in the end tells the filter to provide all the three arguments to your function.


2

So, from what I can tell, you want four columns of relatively equal length on a page, with a title letter every time you move on to a new letter of the alphabet. <?php $num_cols = 4; // set the number of columns here $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; // for pagination $args = array( 'orderby' => 'title', 'order' => ...


2

I assume you have hooked into manage_users_columns. Probably your array_merge is causing the problem. Instead of using $new_columns as the 1st parameter, use it as the 2nd as given below. $new_columns = array_merge ( $columns, $new_columns );


2

It´s even easier than you belive. You have this two functions on wp: manage_posts_columns (notice the "posts" part) and manage_posts_custom_column (again "posts") You have same thing for pages, "manage_page_posts_columns" and "manage_page_posts_custom_column" (notice the "page_posts" part) So, if you need to add those cols for x post type, you only ...


2

To customize which fields are shown in Pods UI, you can filter the default UI options through this filter / function combination. Overriding the $ui array with the options you wish to customize, this can be pretty quick and easy. function pods_ui_test ( $ui ) { // Test on UI Column $ui[ 'fields' ][ 'manage' ] = array( 'city' => 'City', ...


2

The manage_{TAXONOMY}_custom_column filter hook passes 3 arguments: $content $column_name $term_id So try this: function add_book_place_column_content($content,$column_name,$term_id){ $term= get_term($term_id, 'book_place'); switch ($column_name) { case 'foo': //do your stuff here with $term or $term_id $content = ...


2

'public' => false, That will remove View post link.


2

I fixed this issue by changing some of my code. I changed: add_filter( 'request', 'timeline_column_orderby' ); function timeline_column_orderby( $vars ) { if ( !isset( $vars['orderby'] ) || ( isset( $vars['orderby'] ) && 'Year' == $vars['orderby'] ) ) { $vars = array_merge( $vars, array( 'meta_key' => ...


2

i did something similar with some radio buttons and a special taxonomy. i worked almost exclusively from the following 2 tutorials: http://shibashake.com/wordpress-theme/expand-the-wordpress-quick-edit-menu http://scribu.net/wordpress/sortable-taxonomy-columns.html though i was working with a taxonomy, the scribu tutorial actually links to another scribu ...


2

First: If you're adding stuff to hooks or filters, you should allways wrap the action calls in a separate function and hook it (in your case:) to admin_init: function wpse_hook_isv_columns() { add_action('manage_media_custom_column', 'isv_custom_media_column_content',10,2); add_filter('manage_media_columns', 'isv_custom_media_column_headings'); } ...


2

It doesn't have one and it doesn't advertise it either. Check the WordPress.org page, it advertises "three layout choices" and "three footer areas" but nowhere does it say it has a 3 column design. In fact, on default single pages it doesn't even have a 2 column design as it has no sidebar.


2

I suggest using the Advanced Custom Fields plugin for this. You can use it to add other entry fields to a post type (in this case, you'd probably want to add it to the Page type). In your case, you would probably want two other Wysiwyg Editor fields so you can write with formatting. The trick will be that, if you assign the new fields to the Page post type, ...


2

You should be able to set the column width using CSS quite easily. You can use the .column-{name} class to apply styles to the column cells (both th and td). For example: .column-mycolumn { width:20%; } Make sure you don't have other styles overruling your column width because of CSS specificity rules. Also, long words without spaces or large images could ...


2

Just for posterity, because I, like @IV4 still had a bit of wrangling to do with @Brian's answer to get it to work for a custom tax: add_filter( "manage_{screen_id}_columns", "column_header_function" ) ); add_action( "manage_{tax_slug}_custom_column", "populate_rows_function"), 10, 3 ); So in my case, my custom taxonomy was "product-category", so it ...


2

You can use jQuery to do that. Try this in your header : $(document).ready(function() { $("#mymenu li:nth-child(3n+3)").addClass("last"); }); Note : for this to work you need to have enqueued jQuery.


2

Nth is already a class, it's a pseudo class. Why don't you just change whatever css applied to .last and apply it to #nav li:nth-child(3). If you need to target every third menu item it would be #nav li:nth-child(3n+3) Edit: Oh yah I forgot to mention support for those pesky stone age browsers. Luckily there are some good javascript libraries and jQuery ...


2

Go to Pages > Edit Page. Under Page Attributes, select 'One Column', or 'one column, no sidebar' from the Template drop-down.


2

I consider this question to be borderline unanswerable. It really depends on context. In your example $post is whatever that global has been set to. That is pretty general, pretty obvious, and not really saying much but without knowing the context in which this code executes it is hard to give a better answer. That variable is set for each post in the ...


2

Use get_the_tags instead of the_tags to grab an array of tags, and array_chunk to split it. You will then need to build a loop to display the tags. $tags = get_the_tags(); if (!empty($tags)) { $tags = array_chunk($tags,ceil(count($tags)/2),true); foreach($tags as $v) { echo '<ul>'; foreach ($v as $tag) { echo '<li><a ...



Only top voted, non community-wiki answers of a minimum length are eligible