Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




update_gallery_tab [ WordPress Function ]

update_gallery_tab ( $tabs )
Parameters:
  • (unknown_type) $tabs
Returns:
  • (unknown)
Defined at:



{@internal Missing Short Description}}

Source


<?php
function update_gallery_tab($tabs) {
    global 
$wpdb;

    if ( !isset(
$_REQUEST['post_id']) ) {
        unset(
$tabs['gallery']);
        return 
$tabs;
    }

    
$post_id intval($_REQUEST['post_id']);

    if ( 
$post_id )
        
$attachments intval$wpdb->get_var$wpdb->prepare"SELECT count(*) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status != 'trash' AND post_parent = %d"$post_id ) ) );

    if ( empty(
$attachments) ) {
        unset(
$tabs['gallery']);
        return 
$tabs;
    }

    
$tabs['gallery'] = sprintf(__('Gallery (%s)'), "<span id='attachments-count'>$attachments</span>");

    return 
$tabs;
}
?>

Examples [ wp-snippets.com ]

Google Arama Sonuçlarý

Dahasý ...

Kullanýcý Tartýþmalarý [ wordpress.org ]

- Bulunamadý -

Yeni bir konu yaz ...

0 User Note(s)

Henüz yok. Ýlk sen ol!

Yeni Ekle ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics