section
add_theme_support( 'automatic-feed-links' );
// This theme uses Featured Images (also known as post thumbnails)
add_theme_support( 'post-thumbnails', array( 'post' ) );
// Enable excerpt for pages
add_post_type_support( 'page', 'excerpt' );
// Enable Post Formats
add_theme_support( 'post-formats', array( 'aside', 'gallery', 'link', 'image', 'quote', 'status', 'video', 'audio', 'chat' ) );
// This theme uses wp_nav_menu() in one location.
register_nav_menu( 'superiore', 'Menù Superiore' );
register_nav_menu( 'principale', 'Menù Principale' );
register_nav_menu( 'inferiore', 'Menù Inferiore' );
// Load jQuery from CDN
add_action( 'wp_enqueue_scripts', 'jquery_cdn' );
// Load theme frontend styles and scripts
add_action('wp_enqueue_scripts', 'aa_css_js');
// This theme styles the visual editor to resemble the theme style.
add_editor_style( array( 'style-editor.css' ) );
// Load some helpful functions
load_template($tpl_dir.'/inc/helpers.php');
// Add a custom WordPress nav walker class to fully implement
// the Twitter Bootstrap 3.0+ navigation style
load_template($tpl_dir.'/inc/wp_bootstrap_navwalker.php');
// Load up our theme options page and related code.
load_template($tpl_dir.'/inc/theme-options/theme-options.php');
// Register our sidebars and widgetized areas
load_template($tpl_dir.'/inc/sidebars-&-widgets.php');
// Add responsive container to embeds
add_filter( 'embed_oembed_html', 'aa_embed_responsively', 10, 3 );
// De-registra i default WP widget
add_action('widgets_init', 'unregister_default_wp_widgets', 1);
// Aggiunge classe list-group a menù pagine
add_filter("page_css_class", "aa_menu_css_class", 10, 5);
// Include i plugin suggeriti o raccomandati
load_template($tpl_dir.'/inc/class-tgm-plugin-activation.php');
add_action('tgmpa_register', 'aa_plugins');
// Abilita testata personalizzata
load_template($tpl_dir.'/inc/custom-header.php');
aa_custom_header_setup();
// Pulisce form commenti per validare XHTML
add_filter('comment_form_defaults', 'aa_clean_comment_form', 10, 1);
// Allegati
add_filter( 'attachments_default_instance', '__return_false' ); // disable the default instance
add_action( 'attachments_register', 'aa_attachments' ); // enable custom instance
// Menu contestuale
load_template($tpl_dir.'/inc/menu-contestuale.php');
// Sostituisce il template del custom post "AVCP"
load_template($tpl_dir.'/inc/avcp_tpl.php');
// Aggiunge il nome del sito nel tag title
add_filter( 'wp_title', 'aa_wp_title', 10, 2 );
}
} // aa_setup
// Set up the content width value based on the theme's design.
if ( ! isset( $content_width ) ) {
$content_width = 555;
}
function jquery_cdn() {
wp_deregister_script( 'jquery' );
wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js', false, null, true );
} // jquery_cdn
function aa_css_js () {
// Load main stylesheets
wp_enqueue_style( 'aa-style', get_stylesheet_uri() );
// Load custom style
wp_add_inline_style( 'aa-style', get_option(TXTDOM.'_style_custom') );
// Load A11y Toolbar
wp_enqueue_script( 'scrollTo', get_template_directory_uri() . '/js/a11y-toolbar/js/jquery.scrollto.min.js', array('jquery'), null, true );
wp_enqueue_script( 'a11y', get_template_directory_uri() . '/js/a11y-toolbar/js/a11y.js', array('jquery'), null, true );
// Load custom scripts
wp_enqueue_script( 'aa-custom', get_stylesheet_directory_uri() . '/js/wp-aa-scripts.js', array('jquery'), null, true );
} // aa_css_js
// Add responsive container to embeds
function aa_embed_responsively( $html ) {
return '
' . $html . '
';
} // aa_embed_responsively
// De-registra tutti i default WP widgets
function unregister_default_wp_widgets() {
$widgets_da_disabilitare = array('WP_Widget_Pages', 'WP_Widget_Calendar', 'WP_Widget_Archives', 'WP_Widget_Links', 'WP_Widget_Meta', 'WP_Widget_Search', 'WP_Widget_Text', 'WP_Widget_Categories', 'WP_Widget_Recent_Comments', 'WP_Widget_RSS', 'WP_Widget_Tag_Cloud', 'WP_Nav_Menu_Widget');
foreach ($widgets_da_disabilitare as $w)
unregister_widget($w);
}
// Aggiunge classe list-group a menù pagine (creato con wp_list_pages)
function aa_menu_css_class($css_class, $page, $depth, $args, $current_page){
$css_class[] = 'list-group-item';
return $css_class;
}
function aa_plugins() {
$plugins = array(
array(
'name' => 'Amministrazione Accessibile',
'slug' => 'amministrazione-accessibile',
'source' => get_stylesheet_directory() . '/inc/site-specific-plugin/amministrazione-accessibile.zip',
'required' => true,
),
array(
'name' => 'Amministrazione Trasparente',
'slug' => 'amministrazione-trasparente',
'required' => false,
),
array(
'name' => 'Albo Pretorio On line',
'slug' => 'albo-pretorio-on-line',
'required' => false,
),
array(
'name' => 'AVCP XML',
'slug' => 'avcp',
'required' => false,
),
array(
'name' => 'Attachments',
'slug' => 'attachments',
'required' => false,
),
);
$config = array(
'strings' => array(
'page_title' => 'Installa Plugin Richiesti',
'menu_title' => 'Installa Plugin',
'installing' => 'Installing Plugin: %s', // %s = plugin name.
'oops' => 'Qualcosa è andato storto.',
'notice_can_install_required' => _n_noop(
'Questo tema richiede il seguente plugin: %1$s.',
'Questo tema richiede i seguenti plugin: %1$s.'
), // %1$s = plugin name(s).
'notice_can_install_recommended' => _n_noop(
'Questo tema raccomanda il seguente plugin: %1$s.',
'Questo tema raccomanda i seguenti plugin: %1$s.'
), // %1$s = plugin name(s).
'notice_cannot_install' => _n_noop(
'Spiacenti, non disponi dei permessi adeguati per installare il plugin %s. Contatta l\'amministratore di questo sito per ricevere assistenza nell\'installazione del plugin.',
'Spiacenti, non disponi dei permessi adeguati per installare i plugin %s. Contatta l\'amministratore di questo sito per ricevere assistenza nell\'installazione dei plugin.'
), // %1$s = plugin name(s).
'notice_can_activate_required' => _n_noop(
'Il seguente plugin richiesto è attualmente disattivato: %1$s.',
'I seguenti plugin richiesti sono attualmente disattivati: %1$s.'
), // %1$s = plugin name(s).
'notice_can_activate_recommended' => _n_noop(
'Il seguente plugin raccomandato è attualmente disattivato: %1$s.',
'I seguenti plugin raccomandati sono attualmente disattivati: %1$s.'
), // %1$s = plugin name(s).
'notice_cannot_activate' => _n_noop(
'Spiacenti, non disponi dei permessi adeguati per attivare il plugin %s. Contatta l\'amministratore di questo sito per ricevere assistenza nell\'attivazione del plugin.',
'Spiacenti, non disponi dei permessi adeguati per attivare i plugin %s. Contatta l\'amministratore di questo sito per ricevere assistenza nell\'attivazione dei plugin.'
), // %1$s = plugin name(s).
'notice_ask_to_update' => _n_noop(
'Il seguente plugin deve essere aggiornato all\'ultima versione per assicurare la massima compatibilità con questo tema: %1$s.',
'I seguenti plugin devono essere aggiornati all\'ultima versione per assicurare la massima compatibilità con questo tema: %1$s.'
), // %1$s = plugin name(s).
'notice_cannot_update' => _n_noop(
'Spiacenti, non disponi dei permessi adeguati per aggiornare il plugin %s. Contatta l\'amministratore di questo sito per ricevere assistenza nell\'aggiornamento del plugin.',
'Spiacenti, non disponi dei permessi adeguati per aggiornare i plugin %s. Contatta l\'amministratore di questo sito per ricevere assistenza nell\'aggiornamento dei plugin.'
), // %1$s = plugin name(s).
'install_link' => _n_noop( 'Inizio installazione plugin', 'Inizio installazione plugin' ),
'activate_link' => _n_noop( 'Inizio attivazione plugin', 'Inizio attivazione plugin' ),
'return' => 'Ritorna all\'installazione dei plugin richiesti',
'dashboard' => 'Ritorna alla bacheca',
'plugin_activated' => 'Plugin attivato correttamente.',
'complete' => 'Tutti i plugin sono installati e attivati correttamente. %s', // %s = dashboard link.
'dismiss' => 'Chiudi questo avviso',
)
);
tgmpa( $plugins, $config );
}
function aa_clean_comment_form( $defaults ) {
$defaults['comment_field'] = str_replace('aria-required="true"', '', $defaults['comment_field']);
$defaults['fields']['author'] = str_replace("aria-required='true'", '', $defaults['fields']['author']);
$defaults['fields']['email'] = str_replace("aria-required='true'", '', $defaults['fields']['email']);
return $defaults;
}
function aa_attachments( $attachments ) {
$fields = array(
array(
'name' => 'title', // unique field name
'type' => 'text', // registered field type
'label' => 'Titolo', // label to display
'default' => 'title', // default value upon selection
),
array(
'name' => 'caption', // unique field name
'type' => 'textarea', // registered field type
'label' => 'Didascalia', // label to display
'default' => 'caption', // default value upon selection
),
);
$args = array(
// title of the meta box (string)
'label' => 'Allegati',
// all post types to utilize (string|array)
'post_type' => array( 'post', 'page', 'amm-trasparente' ),
// meta box position (string) (normal, side or advanced)
'position' => 'normal',
// meta box priority (string) (high, default, low, core)
'priority' => 'high',
// allowed file type(s) (array) (image|video|text|audio|application)
'filetype' => null, // no filetype limit
// include a note within the meta box (string)
'note' => 'Allega file qui!',
// by default new Attachments will be appended to the list
// but you can have then prepend if you set this to false
'append' => true,
// text for 'Attach' button in meta box (string)
'button_text' => 'Allega file',
// text for modal 'Attach' button (string)
'modal_text' => 'Allega',
// which tab should be the default in the modal (string) (browse|upload)
'router' => 'browse',
// whether Attachments should set 'Uploaded to' (if not already set)
'post_parent' => false,
// fields array
'fields' => $fields,
);
$attachments->register( 'aa_attachments', $args ); // unique instance name
}
function aa_wp_title( $title, $sep ) {
if ( is_feed() )
return $title;
if ( !is_home() )
$title .= ' | ';
return $title . get_bloginfo( 'name', 'display' );
}