if ( version_compare( $GLOBALS['wp_version'], '4.1-alpha', '<' ) ) {
require get_template_directory() . '/inc/back-compat.php';
}
if ( ! function_exists( 'lideranca_setup' ) ) :
function lideranca_setup() {
/*
* Let WordPress manage the document title.
* By adding theme support, we declare that this theme does not use a
* hard-coded
tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support( 'title-tag' );
/* Enable support for Post Thumbnails on posts and pages. */
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 441, 360, true );
add_image_size( 'home-latest-news', 320, 240, true );
add_image_size( 'services-thumb', 480, 270, true );
add_image_size( 'services-header', 1120, 460, true );
// This theme uses wp_nav_menu() in two locations.
register_nav_menus( array(
'main' => __( 'Menu principal' ),
'footer' => __( 'Menu rodapé' ),
) );
/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support( 'html5', array(
'search-form', 'comment-form', 'comment-list', 'gallery', 'caption'
) );
/*
* Enable support for Post Formats.
*
* See: https://codex.wordpress.org/Post_Formats
*/
add_theme_support( 'post-formats', array(
'aside',
) );
/*
* This theme styles the visual editor to resemble the theme style,
* specifically font, colors, icons, and column width.
*/
add_editor_style( array( 'css/editor-style.css', 'genericons/genericons.css' ) );
}
endif; // twentyfifteen_setup
add_action( 'after_setup_theme', 'lideranca_setup' );
// Enqueue scripts and styles
function lideranca_scripts() {
// Load main stylesheet
wp_enqueue_style( 'lideranca-style', get_stylesheet_uri() );
}
add_action( 'wp_enqueue_scripts', 'lideranca_scripts' );
// Remove admin bar
add_filter('show_admin_bar', '__return_false');
// Widgets
function lideranca_widgets_init() {
register_sidebar( array(
'name' => __( 'Barra lateral - Curso' ),
'id' => 'course',
'description' => __( 'Adicione widgets para aparecerem na página do curso.' ),
'before_widget' => '',
'before_title' => '',
));
}
add_action( 'widgets_init', 'lideranca_widgets_init' );
// Get custom field array_count_values
function get_custom_field($key, $echo = FALSE) {
global $post;
$custom_field = get_post_meta($post->ID, $key, true);
if ($echo == FALSE) return $custom_field;
echo $custom_field;
}
// Home features
function features_type() {
$labels = array(
'name' => _x( 'Destaques', 'text_domain' ),
'singular_name' => _x( 'Destaque', 'text_domain' ),
'menu_name' => __( 'Destaques', 'text_domain' ),
'parent_item_colon' => __( 'Pai:', 'text_domain' ),
'all_items' => __( 'Ver todos', 'text_domain' ),
'view_item' => __( 'Ver destaque', 'text_domain' ),
'add_new_item' => __( 'Adicionar destaque', 'text_domain' ),
'add_new' => __( 'Adicionar novo', 'text_domain' ),
'edit_item' => __( 'Editar', 'text_domain' ),
'update_item' => __( 'Atualizar', 'text_domain' ),
'search_items' => __( 'Pesquisar', 'text_domain' ),
'not_found' => __( 'Não encontrado', 'text_domain' ),
'not_found_in_trash' => __( 'Lixeira vazia', 'text_domain' ),
);
$args = array(
'label' => 'Features',
'labels' => $labels,
'supports' => array( 'title', 'editor', 'thumbnail', 'page-attributes', 'custom-fields', ),
'taxonomies' => array( ),
'hierarchical' => true,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'show_in_admin_bar' => true,
'menu_position' => 2,
'menu_icon' => 'dashicons-format-aside',
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'post',
'rewrite' => array( 'slug' => 'features' ),
);
register_post_type( 'lideranca_features', $args );
}
add_action( 'init', 'features_type', 0 );
// Home features
function services_type() {
$labels = array(
'name' => _x( 'Serviços', 'text_domain' ),
'singular_name' => _x( 'Serviço', 'text_domain' ),
'menu_name' => __( 'Serviços', 'text_domain' ),
'parent_item_colon' => __( 'Pai:', 'text_domain' ),
'all_items' => __( 'Ver todos', 'text_domain' ),
'view_item' => __( 'Ver serviço', 'text_domain' ),
'add_new_item' => __( 'Adicionar serviço', 'text_domain' ),
'add_new' => __( 'Adicionar novo', 'text_domain' ),
'edit_item' => __( 'Editar', 'text_domain' ),
'update_item' => __( 'Atualizar', 'text_domain' ),
'search_items' => __( 'Pesquisar', 'text_domain' ),
'not_found' => __( 'Não encontrado', 'text_domain' ),
'not_found_in_trash' => __( 'Lixeira vazia', 'text_domain' ),
);
$args = array(
'label' => 'Services',
'labels' => $labels,
'supports' => array( 'title', 'editor', 'thumbnail', 'page-attributes', 'excerpt' ),
'taxonomies' => array( ),
'hierarchical' => true,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'show_in_admin_bar' => true,
'menu_position' => 2,
'menu_icon' => 'dashicons-format-aside',
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'post',
'rewrite' => array( 'slug' => 'servico' ),
);
register_post_type( 'lideranca_services', $args );
}
add_action( 'init', 'services_type', 0 );
// Mission and Vision
function about_type() {
$labels = array(
'name' => _x( 'Empresa', 'text_domain' ),
'singular_name' => _x( 'Empresa', 'text_domain' ),
'menu_name' => __( 'Empresa', 'text_domain' ),
'parent_item_colon' => __( 'Pai:', 'text_domain' ),
'all_items' => __( 'Ver todos', 'text_domain' ),
'view_item' => __( 'Ver item', 'text_domain' ),
'add_new_item' => __( 'Adicionar item', 'text_domain' ),
'add_new' => __( 'Adicionar novo', 'text_domain' ),
'edit_item' => __( 'Editar', 'text_domain' ),
'update_item' => __( 'Atualizar', 'text_domain' ),
'search_items' => __( 'Pesquisar', 'text_domain' ),
'not_found' => __( 'Não encontrado', 'text_domain' ),
'not_found_in_trash' => __( 'Lixeira vazia', 'text_domain' ),
);
$args = array(
'label' => 'Empresa',
'labels' => $labels,
'supports' => array( 'title', 'editor', 'page-attributes', ),
'taxonomies' => array( ),
'hierarchical' => true,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'show_in_admin_bar' => true,
'menu_position' => 2,
'menu_icon' => 'dashicons-format-aside',
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'post',
'rewrite' => array( 'slug' => 'sobre' ),
);
register_post_type( 'about_features', $args );
}
add_action( 'init', 'about_type', 0 );
// Shortcodes
function contact_infos( $atts, $content = null ) {
return '' . do_shortcode($content) . '
';
}
add_shortcode( 'contatos', 'contact_infos' );
function subscribe_form( $atts, $content = null ) {
return '' . do_shortcode($content) . '
';
}
add_shortcode( 'formulario-inscricao', 'subscribe_form' );