Dexterity Number File Attachment In WordPress
This is way more simple the extreme attacgment file count without plugin, I encourage you to use what free code than wandering somewhere looking for a plugin that add to the site, and if you find it difficult code What plugin also.
You copy this code and paste into your function.php file offline.
add_filter('manage_posts_columns', 'posts_columns_attachment_count', 5);
add_action('manage_posts_custom_column', 'posts_custom_columns_attachment_count', 5, 2);
function posts_columns_attachment_count($defaults){
$defaults['wps_post_attachments'] = __('Att');
return $defaults;
}
function posts_custom_columns_attachment_count($column_name, $id){
if($column_name === 'wps_post_attachments'){
$attachments = get_children(array('post_parent'=>$id));
$count = count($attachments);
if($count !=0){echo $count;}
}
}
above are two functions that are very familiar to those of you who write plugins for wordpress.
first add_filter function “posts_columns_attachment_count” have the effect of creating an additional column in your list post. You can change “Att” with the name of the column that you want to as: attachment counter, that, see? too easy, right?
then add_action function “posts_custom_columns_attachment_count” refers to the number of file attachment in the list post.
What I want to say here is that things seemed very difficult, but actually it is very easy, you can not very good but not so much you can not do it. WordPress has all what you need, it is important that you have to exploit all its capabilities alone.
I use wordpress as well be one, but I see it can do everything I want, from personal pages to the complexity and flocking sites like: selling tickets, sales and education. .. all of which can be important you know it or not.
I wish you success. Click the like on the site to support me if this article you feel is useful for clicking the link above.
If you copy my post, please remember to link the source to me.
This article is useful for you, press like on my help, encourage writing.