Skip to content
This repository has been archived by the owner on Feb 24, 2021. It is now read-only.

Commit

Permalink
[#1299] - template for microstory with filters
Browse files Browse the repository at this point in the history
  • Loading branch information
samvthom16 committed Jul 6, 2018
1 parent 4e87fea commit 6235b0e
Show file tree
Hide file tree
Showing 12 changed files with 332 additions and 194 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,16 @@
width:100%!important;

li{
width: 29%;
padding: 2%;
margin:0!important;
width : 29%;
padding : 2%;
margin : 0;

div.imgWrapper{
background:#fff!important;
padding:0px!important;
width:100%!important;
max-height: 217px;
overflow: hidden;
background : #fff;
padding : 0px;
width : 100%;
max-height : 217px;
overflow : hidden;

img, img:hover{
opacity: 1;
Expand All @@ -71,12 +71,10 @@
width:100%!important;

li {
width: 21%;
padding: 2%;
margin:0!important;
min-height:auto!important;

div.imgWrapper {background:#fff!important;padding:0px!important;width:100%!important;max-height: 217px;overflow: hidden;}
width : 21%;
padding : 2%;
margin : 0;
min-height : auto;

.staffName{text-align:center!important;}

Expand All @@ -95,6 +93,42 @@

}

&.microstory{

a[href]{ color:inherit; }

.imgWrapper{
position: relative;
background-size: cover;
background-position: center center;
height: 250px;

.excerpt{
display: none;
box-sizing: border-box;
padding: 10px;
background: rgba(0, 0, 0, 0.7);
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
color: white;
text-align: center;
margin: 0;
width: 100%;

p{ text-align: center; margin: 0;}
}

&:hover .excerpt{
display:block;
}
}



}

}

@media screen and ( max-width: 1024px ) and ( min-width: 768px ){
Expand All @@ -113,6 +147,13 @@
li:nth-child(4n+1){clear:none;}
li:nth-child(3n+1){clear:left;}
}

&.microstory{
li div.imgWrapper {max-height:350px;}
li:nth-child(3n+1){clear:none;}
li:nth-child(2n+1){clear:left;}

}
}
}
@media screen and ( max-width: 768px ){
Expand All @@ -132,8 +173,16 @@
li {width:46%;}
li:nth-child(2n+1){clear:left;}
}

&.microstory li{
width:96%;
div.imgWrapper {max-height:350px;}
}

}



}

@media screen and ( max-width: 400px ){
Expand Down
55 changes: 42 additions & 13 deletions code/wp-content/themes/Akvo-responsive/css/main.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 18 additions & 10 deletions code/wp-content/themes/Akvo-responsive/inc/class-akvo-post-type.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ function __construct(){
),
/* STAFF */
'new_staffs' => array(
'name' => 'Akvo staff',
'singular_name' => 'Akvo staff',
'name' => 'Akvo Staff',
'singular_name' => 'Akvo Staff',
'supports' => array( 'title', 'thumbnail', 'revisions'),
'menu_icon' => get_bloginfo('template_url').'/images/akvoStaff_icn.png',
'has_archive' => true
Expand All @@ -60,6 +60,14 @@ function __construct(){
'supports' => array( 'title', 'thumbnail', 'revisions'),
'menu_icon' => get_bloginfo('template_url').'/images/akvoPartner_icn.png',
'has_archive' => true
),
/* MICROSTORY */
'microstory' => array(
'name' => 'Akvo Microstories',
'singular_name' => 'Akvo Microstory',
'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail', 'revisions'),
//'menu_icon' => get_bloginfo('template_url').'/images/akvoPartner_icn.png',
'has_archive' => true
)
);

Expand All @@ -68,25 +76,25 @@ function __construct(){
'new_staffs_team' => array(
'post_type' => 'new_staffs',
'labels' => array(
'name' => 'Staff team',
'name' => 'Staff Team',
'add_new_item' => 'New Akvo team',
'new_item_name' => 'New Akvo team'
)
),
'staff_hub' => array(
'post_type' => array( 'new_staffs', 'new_partners' ),
'post_type' => array( 'new_staffs', 'new_partners', 'microstory' ),
'labels' => array(
'name' => 'Staff hub',
'add_new_item' => 'Add new staff hub',
'new_item_name' => 'New staff hub'
'name' => 'Staff Hub',
'add_new_item' => 'Add New Hub',
'new_item_name' => 'New Hub'
)
),
'new_partners_category' => array(
'post_type' => 'new_partners',
'labels' => array(
'name' => 'Akvo partner category',
'add_new_item' => 'Add new Akvo category',
'new_item_name' => "New Akvo category"
'name' => 'Akvo Partner Category',
'add_new_item' => 'New Akvo Category',
'new_item_name' => "New Akvo Category"
)
),
);
Expand Down
2 changes: 1 addition & 1 deletion code/wp-content/themes/Akvo-responsive/inc/class-akvo.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function assets(){
if ( is_singular() ) wp_enqueue_script('comment-reply');

//enqueue style in the head section
wp_enqueue_style('akvo-style', get_template_directory_uri().'/css/main.css', false, '2.5.4' );
wp_enqueue_style('akvo-style', get_template_directory_uri().'/css/main.css', false, '2.5.5' );
wp_enqueue_style('akvo-fonts', '//fonts.googleapis.com/css?family=Source+Code+Pro:400,900,700,600,300,200,500|Quando|Questrial|Inconsolata|Muli:400,300italic,400italic,300|Raleway:400,900,800,700,600,500,100,200,300|Lobster|Lobster+Two:400,400italic,700,700italic|Lato:400,100,300,700,900,100italic,300italic,400italic,900italic,700italic', false, null );
wp_enqueue_style('jquery-bxslider', get_template_directory_uri().'/css/jquery.bxslider.css', false, '1.0.0' );

Expand Down
87 changes: 10 additions & 77 deletions code/wp-content/themes/Akvo-responsive/inc/shortcodes.php
Original file line number Diff line number Diff line change
@@ -1,86 +1,19 @@
<?php

/* BASE CLASS FOR SHORTCODE */
class AKVO_SHORTCODE{

var $shortcode;

function __construct(){
add_shortcode( $this->shortcode, array( $this, 'plain_shortcode' ), 100 );
}

function plain_shortcode( $atts ){

}

function get_atts( $atts ){
$defaults_atts = apply_filters( $this->shortcode.'_atts', $this->get_default_atts() );
return shortcode_atts( $defaults_atts, $atts, $this->shortcode );
}

function get_default_atts(){
return array();
}
}
$inc_files = array(
'class-akvo-shortcode.php', // BASE CLASS FOR SHORTCODE WHICH NEEDS TO BE IMPORTED FIRST
'class-akvo-shortcode-nested-filters.php',
'class-akvo-shortcode-custom-posts.php',
);

class AKVO_SHORTCODE_NESTED_FILTERS extends AKVO_SHORTCODE{

function __construct(){

$this->shortcode = 'akvo_nested_filters';

parent::__construct();

}

function get_default_atts(){
return array(
'title' => '',
'post_type' => '',
'primary_filter' => '',
'secondary_filter' => '',
'showposts' => 100
);
}

function plain_shortcode( $atts ){

$atts = $this->get_atts( $atts ); /* CREATE ATTS ARRAY FROM DEFAULT AND USER PARAMETERS IN THE SHORTCODE */

ob_start();

include('templates/nested_filters.php');

return ob_get_clean();
}

foreach( $inc_files as $inc_file ){
include( 'shortcodes/' . $inc_file );
}

new AKVO_SHORTCODE_NESTED_FILTERS;

/*
add_shortcode( 'akvo_nested_filters', function( $atts ){
/* CREATE ATTS ARRAY FROM DEFAULT AND USER PARAMETERS IN THE SHORTCODE *
$atts = shortcode_atts( array(
'title' => '',
'post_type' => '',
'primary_filter' => '',
'secondary_filter' => '',
'showposts' => 100
),
$atts,
'akvo_nested_filters'
);
ob_start();
include('templates/nested_filters.php');
return ob_get_clean();
} );
*/




add_shortcode( 'akvo_staff', function( $atts ){

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php
class AKVO_SHORTCODE_CUSTOM_POSTS extends AKVO_SHORTCODE{

function __construct(){

$this->shortcode = 'akvo_custom_posts';
$this->template = 'custom_posts.php';

parent::__construct();

}

function get_default_atts(){
return array(
'post_type' => 'new_staffs',
'filters' => '',
'showposts' => 100
);
}



}

new AKVO_SHORTCODE_CUSTOM_POSTS;
Loading

0 comments on commit 6235b0e

Please sign in to comment.