Skip to content

Commit

Permalink
Added files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
YushkinaS committed May 7, 2016
1 parent ef9bc6c commit 6254f28
Show file tree
Hide file tree
Showing 3 changed files with 171 additions and 0 deletions.
88 changes: 88 additions & 0 deletions content-films.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<?php
/**
* Template part for displaying single posts.
*
* @package wpbss
*/

?>

<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<?php the_post_thumbnail(); ?>
<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
</header><!-- .entry-header -->

<div class="entry-content">
<?php
$post_id = get_the_ID();
$countries = get_the_terms( $post_id , 'country' );
$genres = get_the_terms( $post_id , 'genre' );
$fee = get_post_meta( $post_id,'fee',true );
$release_date = get_post_meta( $post_id,'release_date',true );
?>
<div class="row">
<div class="col-xs-6">
<div class="well well-sm">
<span class="glyphicon glyphicon-globe" title="Страна" data-toggle="tooltip"><?php
foreach ($countries as $country) {
$country_link=get_term_link($country);
?>
<a href="<?php echo $country_link; ?>"><?php echo $country->name; ?></a>
<?php
}
?>
</span>
</div>
</div>
<div class="col-xs-6">
<div class="well well-sm">
<span class="glyphicon glyphicon-tag" title="Жанр" data-toggle="tooltip"><?php
foreach ($genres as $genre) {
$genre_link=get_term_link($genre);
?>
<a href="<?php echo $genre_link; ?>"><?php echo $genre->name; ?></a>
<?php
}
?>
</span>
</div>
</div>
</div>

<div class="row">
<div class="col-xs-6">
<div class="well well-sm">
<span class="label label-info">Дата выхода</span>
<span class="glyphicon glyphicon-calendar" title="Дата выхода" data-toggle="tooltip"></span><?php echo $release_date; ?>
</div>
</div>
<div class="col-xs-6">
<div class="well well-sm">
<span class="label label-info">Стоимость сеанса</span>
<span class="glyphicon glyphicon-rub" title="Стоимость сеанса" data-toggle="tooltip"></span><?php echo $fee; ?>
</div>
</div>

</div>

<?php the_content(); ?>



<?php
wp_link_pages( array(
'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'wpbss' ),
'after' => '</div>',
) );
?>
</div><!-- .entry-content -->

<footer class="entry-footer">
<?php wpbss_entry_footer(); ?>
<div class="entry-meta">
<?php wpbss_posted_on(); ?>
</div><!-- .entry-meta -->
</footer><!-- .entry-footer -->
</article><!-- #post-## -->

48 changes: 48 additions & 0 deletions functions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php

// Faster than @import and stable http://getbootstrap.com/getting-started/#support-ie8-respondjs
add_action( 'wp_enqueue_scripts', 'wpbss_import_base_style', 22 );
function wpbss_import_base_style() {
wp_enqueue_style( 'parent-theme-css', get_template_directory_uri() . '/style.css' );
}

add_action( 'after_setup_theme', 'register_thumbnail_size');
function register_thumbnail_size() {
if ( function_exists( 'add_image_size' ) ) {
add_image_size( 'film-thumbnails', 300, 300);

}
}


add_shortcode('recent_films', 'recent_films_shortcode');
function recent_films_shortcode( $atts ) {
extract ( shortcode_atts( array(
'quantity' => 5,
), $atts ) );

$args = array(
'numberposts' => $quantity,
'post_type' => 'films',
'post_status' => 'publish',
'orderby' => 'post_date',
'order' => 'DESC',
);
$posts = get_posts($args);

ob_start();
?>
<ul>
<?php
foreach ( $posts as $post ) {
?>
<li><a href="<?php echo get_permalink($post->ID); ?>"><?php echo $post->post_title; ?></a></li>
<?php
}
?>
</ul>
<?php

return ob_get_clean();
}

35 changes: 35 additions & 0 deletions single-films.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
/**
* The template for displaying all single posts.
*
* @package wpbss
*/

get_header(); ?>

<div class="container">
<div class="row">
<div id="primary" class="content-area col-md-8 col-xs-12 pull-right">
<main id="main" class="site-main" role="main">

<?php while ( have_posts() ) : the_post(); ?>

<?php get_template_part( 'inc/template-parts/content', 'films' ); ?>

<?php the_post_navigation(); ?>

<?php
// If comments are open or we have at least one comment, load up the comment template
if ( comments_open() || get_comments_number() ) :
comments_template();
endif;
?>

<?php endwhile; // end of the loop. ?>

</main><!-- #main -->
</div><!-- #primary -->
<?php get_sidebar(); ?>
</div><!-- .row -->
</div><!-- .container -->
<?php get_footer(); ?>

0 comments on commit 6254f28

Please sign in to comment.