null, 'author' => null, 'translator' => null, 'publisher' => null, 'date' => null, 'pages' => null, 'type' => null, 'col' => null, 'price' => null, 'age' => null, 'isbn' => null, 'issn' => null, 'notes' => null, ), $atts ) ); $intro = __( 'Abbiamo parlato di:', 'book-template' ); $book = '
'.$intro.'
'.$title.'
'.$author;
if ( $translator <> null )
{$translator = __( 'Traduzione di ', 'book-template' ).$translator;
$book = $book.'
'.$translator;}
else
{$book = $book;}
$pages = $pages.' '.__( 'pagine', 'book-template' );
if ( $col <> null )
{$book = $book.'
'.$publisher.', '.$date.'
'.$pages.', '.$type.', '.$col.' – '.$price;}
else
{$book = $book.'
'.$publisher.', '.$date.'
'.$pages.', '.$type.' – '.$price;}
if ( $age <> null )
{$book = $book.'
'.__( 'Lettura consigliata per ', 'book-template' ).$age;}
else
{$book = $book;}
if ( $isbn <> null )
{$book = $book.'
ISBN: '.$isbn;}
else
{
if ( $issn <> null )
{$book = $book.'
ISSN: '.$issn;}
else
{$book = $book;}
}
if ( $notes <> null )
{$book = $book.'
'.$notes;}
else
{$book = $book;}
$text = $book;
return $text;
}
/**
* Add TinyMCE buttons for shortcode
*/
add_action( 'init', 'bookdata_tinymce_shortcode_buttons' );
add_filter( 'tiny_mce_version', 'bookdata_refresh_tinymce' );
function pilau_tinymce_shortcode_buttons() {
// Don't bother doing this stuff if the current user lacks permissions
if ( ! current_user_can( 'edit_posts' ) && ! current_user_can( 'edit_pages' ) )
return;
// Add only in Rich Editor mode
//if ( get_user_option( 'rich_editing' ) == 'true' ) {
// add_filter( 'mce_external_plugins', 'pilau_tinymce_plugins' );
// add_filter( 'mce_buttons', 'pilau_register_tinymce_shortcode_buttons' );
//}
}
function bookdata_register_tinymce_shortcode_buttons( $buttons ) {
array_push( $buttons, "|", "bookdata" );
return $buttons;
}
function bookdata_tinymce_plugins( $plugin_array ) {
$plugin_array['bookdata'] = get_template_directory_uri() . '/assets/js/tinymce-buttons.js';
return $plugin_array;
}
function bookdata_refresh_tinymce( $ver ) {
$ver += 3;
return $ver;
}
/* ------------------------------------------------------ */
?>