• Resolved dudu86

    (@dudu86)


    Hi there,

    I’ve tried many plugins recently and I think yours is by far the best, so thank you very much! I manage a big website and I found one feature really helpful in this plugin which is the Tweet YES/NO column on the posts list page. I just upgraded to the latest version and noticed that this disappeared. Is there a way to put it back? it is really helpful so I don’t have to open every post to check the tweet status and disable for specific posts.

    Thanks,
    Fabio

    http://ww.wp.xz.cn/plugins/wp-to-twitter/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Joe Dolson

    (@joedolson)

    I removed that because I didn’t think it was very useful, but it’s good to hear that somebody found it useful. I’ll give it some thought.

    Thread Starter dudu86

    (@dudu86)

    Yes, it was extremely helpful for us. My suggestion, if possible, is to make it “optional” as it happens for SEO by Yoast, where in the posts list, in the screen option, you can select additional field to display as column.

    Thanks for your reply.
    Fabio

    Plugin Author Joe Dolson

    (@joedolson)

    It was always removable that way. The code to add it back in is fairly simple, if you want it –

    function wpt_column($cols) {
    	$cols['wpt'] = __('Tweet Status','wp-to-twitter');
    	return $cols;
    }
    
    // Echo the ID for the new column
    function wpt_value($column_name, $id) {
    	if ($column_name == 'wpt') {
    		$marked = ucfirst( ( get_post_meta($id,'_jd_tweet_this',true) ) );
    		echo $marked;
    	}
    }
    
    function wpt_return_value($value, $column_name, $id) {
    	if ( $column_name == 'wpt' ) {
    		$value = $id;
    	}
    	return $value;
    }
    Thread Starter dudu86

    (@dudu86)

    Ah ok, I’ve never noticed it could be hidden because I liked it so I left it as it was 🙂 Maybe you could set it hidden by default and then if someone wants it can be enabled in the screen settings.

    Thanks for the code, stupid question, in which file should I paste this code?

    Thanks a lot,
    Fabio

    Plugin Author Joe Dolson

    (@joedolson)

    It’s not possible (or, rather, more complicated than it’s worth) to have columns hidden by default, so that’s not a great option.

    You can add this code to your theme functions.php file, or you can go to wp-to-twitter.php and uncomment these lines – they’re still in the file, just commented out. Around line 1540 of wp-to-twitter.php.

    Editing it in wp-to-twitter.php, however, will require you to do it for every update.

    Plugin Author Joe Dolson

    (@joedolson)

    And you know what? I just realized that’s not even the whole code – you’ll also need this:

    add_action('admin_init', 'wpt_add');
    function wpt_add() {
    	$post_type_settings = get_option('wpt_post_types');
    	$post_types = array_keys($post_type_settings);
    
    	add_action('admin_head', 'wpt_css');
    	if ( !$post_types || in_array( 'post', $post_types ) ) {
    		add_filter('manage_posts_columns', 'wpt_column');
    		add_action('manage_posts_custom_column', 'wpt_value', 10, 2);
    	}
    	if ( !$post_types || in_array( 'page', $post_types ) ) {
    		add_filter('manage_pages_columns', 'wpt_column');
    		add_action('manage_pages_custom_column', 'wpt_value', 10, 2);
    	}
    	foreach ( $post_types as $types ) {
    		add_action("manage_${types}_columns", 'wpt_column');
    		add_filter("manage_${types}_custom_column", 'wpt_value', 10, 2);
    	}
    }

    Same file, just a little bit later.

    Thread Starter dudu86

    (@dudu86)

    I guess you’re right! Thanks for the code, I got now the status column back. As you said I put it into the functions file so I don’t have to re-add it every time I update the plugin, maybe one day I’ll find this function back in the plugin so I don’t need it to keep it in the functions file 🙂

    Thanks again for your help and keep up the good work!
    Fabio

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Tweet status on posts list’ is closed to new replies.