Structure fixes and additions #1

Merged
plazmonii merged 11 commits from structure-fixes-and-additions into master 2014-10-05 20:21:53 +03:00
14 changed files with 501 additions and 171 deletions

View File

@ -235,16 +235,17 @@ nav ul {
margin: 0;
padding: 0;
}
nav ul > li {
nav ul li {
position: relative;
}
nav .menu > li {
float: left;
margin: 0;
padding: 0;
}
nav ul a {
color: #000;
text-decoration: none;
display: block;
padding: 1.5em 0.4em;
nav .menu > li {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
@ -252,9 +253,40 @@ nav ul a {
-webkit-transition: border-top 200ms;
border-top: 0 solid #FFF;
}
nav ul a:hover {
nav .menu > li:hover {
border-top: 0.4em solid #A8D6FF;
}
nav ul a {
color: #000;
text-decoration: none;
display: block;
padding: 1.5em 0.4em;
}
nav ul .sub-menu {
display: none;
position: absolute;
background: #fff;
width: 200px;
left: 50%;
margin-left: -100px;
box-shadow: 0 3px 5px -3px #000
}
nav ul li:hover .sub-menu {
display: block;
position: absolute;
}
nav ul .sub-menu li,
nav ul .sub-menu li a { display: block; width: 100%; }
nav ul .sub-menu li a { padding: 1em 0; text-align: center; }
nav ul .sub-menu li { border-bottom: 1px solid #ccc; }
nav ul .separator {
display: block;
width: 0.05em;
@ -424,6 +456,12 @@ footer {
background: #ddd;
}
footer .content li { list-style: none; }
#copyright {
text-align: center;
}
/* Sub navigation */
.subnav {
margin-top: 1.6em;
@ -492,3 +530,4 @@ footer {
display: inline-block;
margin: 0 0 2em 0;
}

View File

@ -1,6 +1,6 @@
<div class="clear"></div>
<div class="clear"></div>
<footer>
<footer>
<div class="content grid">
<div class="col4">
<h3>OpenFest</h3>
@ -27,10 +27,10 @@
</p>
</div>
</div>
<div id="copyright">
<?php echo sprintf( __( '%1$s %2$s %3$s. Some Rights Reserved.', 'initfest' ), '&copy;', date( 'Y' ), esc_html( get_bloginfo( 'name' ) ) ); ?>
</div>
<div id="copyright">
<?php echo sprintf( __( '%1$s %2$s %3$s. Some Rights Reserved.', 'initfest' ), '&copy;', date( 'Y' ), esc_html( get_bloginfo( 'name' ) ) ); ?>
</div>
</footer>
<?php wp_footer(); ?>
</body>
<?php wp_footer(); ?>
</body>
</html>

View File

@ -1,10 +1,66 @@
<?php get_header(); ?>
<section id="content" role="main">
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'entry' ); ?>
<?php comments_template(); ?>
<?php endwhile; endif; ?>
<?php get_template_part( 'nav', 'below' ); ?>
<section class="content grid">
<?php
/*
if ( have_posts() ) : while ( have_posts() ) : the_post();
get_template_part( 'entry' );
comments_template();
endwhile; endif;
get_template_part( 'nav', 'below' );
*/
?>
<div class="col2">
<h1><?php echo get_bloginfo('name'); ?> </h1>
<p><?php echo get_bloginfo('description'); ?></p>
</div>
<div class="col2">
<h3>Спонсори</h3>
<?php echo do_shortcode( '[sponsors]' ); ?>
</div>
</section>
<div class="separator"></div>
<section class="content">
<h3>Новини | <small><a href="">виж всички новини</a></small></h3>
<div class="grid">
<?php
$news_args = array( 'cat' => 5, posts_per_page => 3 );
$news = new WP_Query( $news_args );
if ( $news->have_posts() ) :
while ( $news->have_posts() ) : $news->the_post();
?>
<div class="col3">
<h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
<p class="info">От <?php the_author(); ?> | Публикувано на <?php the_date(); ?> </p>
<?php the_excerpt(); ?>
<a class="button" href="<?php the_permalink(); ?>">виж цялата новина</a>
</div>
<?php
endwhile;
endif;
?>
</div>
</section>
<div class="separator"></div>
<section class="content grid">
<h3>Място: Интерпред, София, България</h3>
<?php
$transport_args = array( 'post_type' => 'transportation' );
$transport = new WP_Query( $transport_args );
if ( $transport->have_posts() ) :
while ( $transport->have_posts() ) : $transport->the_post();
?>
<p><?php the_title(); ?> <br /> <?php the_content(); ?></p>
<?php
endwhile;
endif;
?>
</section>
<?php get_sidebar(); ?>
<?php get_footer(); ?>

View File

@ -1,5 +1,4 @@
<?php
register_nav_menus(
array( 'main-menu' => __( 'Main Menu', 'initfest' ),
'footer-openfest' => __('OpenFest', 'initfest'),
@ -71,3 +70,146 @@ function sh_latest_posts($atts){
return $result;
}
# Add support for thumbnais
add_theme_support( 'post-thumbnails' );
# Create a custom post type for Sponsors
function create_sponsors_posttype() {
$labels = array(
'name' => __( 'Sponsors' ),
'singular_name' => __( 'Sponsor' ),
'menu_name' => __( 'Sponsors'),
'all_items' => __( 'All Sponsors' ),
'view_item' => __( 'View Sponsor' ),
'add_new_item' => __( 'Add New Sponsor' ),
'add_new' => __( 'Add New' ),
'edit_item' => __( 'Edit Sponsor' ),
'update_item' => __( 'Update Sponsor' ),
'search_item' => __( 'Search Sponsor' ),
'not_found' => __( 'Not Found' ),
'not_found_in_trash' => __( 'Not Found In Trash' ),
);
$args = array(
'label' => __( 'sponsors' ),
'description' => __( 'Sponsors of OpenFest' ),
'labels' => $labels,
'supports' => array( 'title', 'excerpt', 'thumbnail', 'custom-fields', ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'show_in_admin_bar' => true,
'menu_position' => 5,
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'post',
);
register_post_type( 'sponsors', $args );
}
add_action( 'init', create_sponsors_posttype );
# Create a custom post type for Speakers
function create_speakers_posttype() {
$labels = array(
'name' => __( 'Speakers' ),
'singular_name' => __( 'Speaker' ),
'menu_name' => __( 'Speakers'),
'all_items' => __( 'All Speakers' ),
'view_item' => __( 'View Speaker' ),
'add_new_item' => __( 'Add New Speaker' ),
'add_new' => __( 'Add New' ),
'edit_item' => __( 'Edit Speaker' ),
'update_item' => __( 'Update Speaker' ),
'search_item' => __( 'Search Speaker' ),
'not_found' => __( 'Not Found' ),
'not_found_in_trash' => __( 'Not Found In Trash' ),
);
$args = array(
'label' => __( 'speakers' ),
'description' => __( 'Speakers on OpenFest' ),
'labels' => $labels,
'supports' => array( 'title', 'excerpt', 'thumbnail', 'custom-fields', ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'show_in_admin_bar' => true,
'menu_position' => 6,
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'post',
);
register_post_type( 'speakers', $args );
}
add_action( 'init', create_speakers_posttype );
# Create a custom post type for Tranportation
function transportation_posttype() {
register_post_type( 'transportation',
array(
'labels' => array(
'name' => __( 'Tranportation' ),
),
'public' => true,
'has_archive' => true,
'rewrite' => array('slug' => 'transportation'),
)
);
}
add_action( 'init', 'transportation_posttype' );
# Create shortcode for sponsors
function sponsors_shortcode() {
global $post;
$output = '';
$sponsors_args = array( 'post_type' => 'sponsors', 'orderby' => 'rand' );
$sponsors = new WP_Query( $sponsors_args );
if ( $sponsors->have_posts() ) :
while ( $sponsors->have_posts() ) : $sponsors->the_post();
if ( has_post_thumbnail() ) {
$output .= the_post_thumbnail();
} else {
$output .= get_the_title();
}
endwhile;
endif;
return $output;
}
# Register all shortcodes
function register_shortcodes(){
add_shortcode('sponsors', 'sponsors_shortcode');
}
add_action( 'init', 'register_shortcodes');
?>

View File

@ -1,5 +1,5 @@
<?php get_header(); ?>
<section id="content" role="main">
<section id="content" role="main" class="content">
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'entry' ); ?>
<?php comments_template(); ?>

View File

@ -0,0 +1,42 @@
<?php
/*
Template Name: Speakers
*/
get_header(); ?>
<div class="separator"></div>
<section class="content grid">
<div class="col-left">
<h1 class="big">Лектори</h1>
<?php
$speakers_args = array( 'post_type' => 'speakers' );
$speakers = new WP_Query( $speakers_args );
if ( $speakers->have_posts() ) :
while ( $speakers->have_posts() ) : $speakers->the_post();
?>
<div class="speaker">
<?php
if ( has_post_thumbnail() ) {
the_post_thumbnail();
} else {
?>
<img src="img/speakers.jpg">
<?php
}
?>
<h3><?php the_title(); ?></h3>
<?php
the_content();
?>
</div>
<?php
endwhile;
wp_reset_postdata();
endif;
?>
</div>
<div class="col-right"><?php get_sidebar(); ?></div>
</section>
<?php get_footer(); ?>

View File

@ -0,0 +1,51 @@
<?php
/*
Template Name: Sponsors
*/
get_header(); ?>
<section class="content">
<?php
if ( have_posts() ) : while ( have_posts() ) : the_post();
the_content();
endwhile; endif;
?>
</section>
<div class="separator"></div>
<section class="content grid sponsors-item">
<?php
$sponsors_args = array( 'post_type' => 'sponsors', 'orderby' => 'rand' );
$sponsors = new WP_Query( $sponsors_args );
$sponsor_count = 0;
if ( $sponsors->have_posts() ) :
while ( $sponsors->have_posts() ) : $sponsors->the_post();
?>
<div class="col2 tac">
<?php
if ( has_post_thumbnail() ) {
the_post_thumbnail();
} else {
the_title();
}
the_content();
?>
</div>
<?php
$sponsor_count++;
if ($sponsor_count % 2 == 0) {
?>
</section>
<section class="content grid sponsors-item">
<?php
}
endwhile;
wp_reset_postdata();
endif;
?>
</section>
<?php get_footer(); ?>