Skip to content

Commit

Permalink
issue #9
Browse files Browse the repository at this point in the history
  • Loading branch information
matheusgimenez committed Feb 18, 2015
1 parent 671f71a commit 5e729ad
Show file tree
Hide file tree
Showing 11 changed files with 1,036 additions and 5 deletions.
34 changes: 34 additions & 0 deletions archive-equipe.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php
/**
* Template Name: Archive Equipe
* Description: A full-width template with no sidebar
*
* @package Tema Brasa
*/

get_header(); ?>

<div id="primary" class="full-width">
<div id="content" role="main">

<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header intro">
<h1 class="entry-title"><?php echo get_option('team_title'); ?></h1>
<p class="lead"><?php echo get_option('team_subtitle'); ?></p><!-- .lead -->
</header><!-- .entry-header -->

<?php /* Start the Loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>

<?php get_template_part( 'content', 'team' ); ?>

<?php endwhile; ?>

</article><!-- #post-<?php the_ID(); ?> -->

<?php comments_template( '', true ); ?>

</div><!-- #content -->
</div><!-- #primary -->

<?php get_footer('simples'); ?>
38 changes: 38 additions & 0 deletions content-team.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php
/*
* Content equipe
*/
global $post;
$thumb_src = null;
if ( has_post_thumbnail($post->ID) ) {
$src = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'thumbnail' );
$thumb_src = $src[0];
}
?>
<article class="col-sm-6 profile">
<div class="profile-header">
<?php if ( $thumb_src ): ?>
<img src="<?php echo $thumb_src; ?>" alt="<?php the_title(); ?>" class="img-circle">
<?php endif; ?>
</div>

<div class="profile-content">
<h3><?php the_title(); ?></h3>
<p class="lead position"><?php the_field('team_position'); ?></p>
<?php the_content(); ?>
</div>

<div class="profile-footer">
<a href="tel:<?php the_field('team_phone'); ?>"><i class="genericon genericon-handset"></i></a>
<a href="mailto:<?php echo antispambot( get_field('team_email') ); ?>"><i class="genericon genericon-mail"></i></a>
<?php if ( $twitter = get_field('team_twitter') ): ?>
<a href="<?php echo $twitter; ?>"><i class="genericon genereicon-twitter"></i></a>
<?php endif; ?>
<?php if ( $linkedin = get_field('team_linkedin') ): ?>
<a href="<?php echo $linkedin; ?>"><i class="genericon genericon-linkedin"></i></a>
<?php endif; ?>
<?php if ( $github = get_field('team_github') ): ?>
<a href="<?php echo $github; ?>"><i class="genericon genericon-github"></i></a>
<?php endif; ?>
</div>
</article>
Binary file added fonts/Genericons.eot
Binary file not shown.
543 changes: 543 additions & 0 deletions fonts/Genericons.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added fonts/Genericons.ttf
Binary file not shown.
Binary file added fonts/Genericons.woff
Binary file not shown.
13 changes: 13 additions & 0 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -338,4 +338,17 @@ function shortcode_date( $atts ){

add_shortcode( 'data', 'shortcode_date' );

require_once get_stylesheet_directory() . '/inc/custom-types.php';
if (!function_exists('get_field')) {
function get_field($field) {
global $post;
return get_post_meta($post->ID, $field, true);
}
}
if (!function_exists('the_field')) {
function the_field($field) {
global $post;
echo get_field($field);
}
}
?>
45 changes: 45 additions & 0 deletions inc/custom-types.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php
/*
* Register post types
*/
// Register Custom Post Type
function custom_post_type() {

$labels = array(
'name' => _x( 'Equipe', 'Post Type General Name', 'tema-brasa' ),
'singular_name' => _x( 'Equipe', 'Post Type Singular Name', 'tema-brasa' ),
'menu_name' => __( 'Equipe', 'tema-brasa' ),
'parent_item_colon' => __( 'Item parente', 'tema-brasa' ),
'all_items' => __( 'Todos membros', 'tema-brasa' ),
'view_item' => __( 'Ver membro', 'tema-brasa' ),
'add_new_item' => __( 'Adicionar novo membro', 'tema-brasa' ),
'add_new' => __( 'Adicionar novo', 'tema-brasa' ),
'edit_item' => __( 'Editar item', 'tema-brasa' ),
'update_item' => __( 'Atualizar item', 'tema-brasa' ),
'search_items' => __( 'Buscar membro', 'tema-brasa' ),
'not_found' => __( 'Não encontrado', 'tema-brasa' ),
'not_found_in_trash' => __( 'Não encontrado na lixeira', 'tema-brasa' ),
);
$args = array(
'labels' => $labels,
'supports' => array( 'title', 'editor', 'thumbnail', ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'show_in_admin_bar' => true,
'menu_position' => 5,
'menu_icon' => 'dashicons-groups',
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'page',
);
register_post_type( 'equipe', $args );

}

// Hook into the 'init' action
add_action( 'init', 'custom_post_type', 0 );
48 changes: 47 additions & 1 deletion metaboxes-portfolio.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,51 @@
)
)
);

$team_metabox = new Odin_Metabox(
'team_metabox', // Slug/ID do Metabox (obrigatório)
'Team', // Nome do Metabox (obrigatório)
'equipe', // Slug do Post Type, sendo possível enviar apenas um valor ou um array com vários (opcional)
'normal', // Contexto (opções: normal, advanced, ou side) (opcional)
'high' // Prioridade (opções: high, core, default ou low) (opcional)
);
$team_metabox->set_fields(
array(
array(
'id' => 'team_position',
'label' => 'Cargo',
'type' => 'text',
'description' => ''
),
array(
'id' => 'team_phone',
'label' => 'Telefone',
'type' => 'text',
'description' => ''
),
array(
'id' => 'team_email',
'label' => 'E-mail',
'type' => 'text',
'description' => ''
),
array(
'id' => 'team_twitter',
'label' => 'Twitter',
'type' => 'text',
'description' => ''
),
array(
'id' => 'team_linkedin',
'label' => 'Linkedin',
'type' => 'text',
'description' => ''
),
array(
'id' => 'team_github',
'label' => 'Github',
'type' => 'text',
'description' => ''
),
)
);
?>
16 changes: 14 additions & 2 deletions options/admin_options.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,21 @@
array( "type" => "close"),

/** Fim Toggle Rodapé */

);
array( "name" => "Pagina Equipe",
"type" => "section"),
array( "type" => "open"),

array( "name" => "Titulo da pagina",
"desc" => "",
"id" => "team_title",
"type" => "text",
"std" => ""),
array( "name" => "Sub-titulo da pagina",
"desc" => "",
"id" => "team_subtitle",
"type" => "text",
"std" => "")
);

function mytheme_add_admin() {

Expand Down
304 changes: 302 additions & 2 deletions style-default.css

Large diffs are not rendered by default.

0 comments on commit 5e729ad

Please sign in to comment.