Tag Info

Hot answers tagged

17

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 ...


8

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 ...


6

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>'; }


5

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' ...


5

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 ...


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

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

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

1. Change post title in post list column I misunderstood what you wanted - obviously. You can do that like this: add_action( 'admin_head-edit.php', 'wpse152971_edit_post_change_title_in_list' ); function wpse152971_edit_post_change_title_in_list() { add_filter( 'the_title', 'wpse152971_construct_new_title', 100, ...


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

EDIT From the comments from the OP There's a few concerns though and suggestions on improvement. First of all, not sure if i missed something, but the list are not links? Second is that with this list it outputs a letter even though it doesn't have a post assigned to the letter..... and Posts that starts with an number won't be listed, would it ...


2

Yes, you need to write code to populate it. This is untested but should work. add_filter('manage_edit-cpt_roundtable_columns', 'init_roundtable_custom_columns'); function init_roundtable_custom_columns($columns) { return array( 'cb' => '<input type="checkbox" />', 'title' => __('Title'), 'taxonomy-sessions' => ...


2

The filter is only applied to custom columns that are added by you (or plugins and themes), not the default columns. If you want to modify the output of all default columns, I think you may have to add your own columns and duplicate the functionality of the defaults, then unset the defaults via manage_users_columns, since not all of them have filters to let ...


2

The problem is that by setting the posts to be ordered by _start_event_datetime you're creating the implicit assumption that the post will have that meta. This means the SQL query WordPress generates will only fetch posts of your custom post type with that meta. There are two possible solutions to this: Replace your current query with a slightly more ...


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

a few plugins - pods, magic fields, custom fields template. or you can DIY with some meta boxes and tinymce editors, see this answer.


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 ...


2

Take a look at how the rewrite $arg for your custom post type is. To get a better view of the output data, just do something like echo '<pre>'; print_r($custom_post_type_obj); echo '</pre>'; on the post type object when querying it.


2

I'm afraid that there is no easy way to get that done yet because the only hook i found is manage_comments_custom_column and that is an action hook and not a filter hook so you can't add columns like manage_posts_columns. so as far as i can tell the long way here is the only way. but you can almost duplicate the default edit-comments.php and extending small ...


2

I'd have thought it's just a matter of formulating your HTML in a way that accomodates the image alignment requirement.. You could have two seperate elements, one for the post's image, one for paragraph(s) of content, and float them side by side. Add a wrapper around the two.. So you basically have two elements, side by side and a wrapper, eg.. ...


2

Changing the public argument of register_post_type() will remove the link to view your custom post type publicly. 'public' => false, See: WordPress Codex Note that this will also hide your custom post type from the admin navigation menus, which you might not want. To hide the 'View Post' link but keep your post type in the admin menus use show_ui as ...


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' => ...



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