mirror of
https://github.com/ascribe/wp-theme
synced 2024-12-22 09:13:38 +01:00
Merge pull request #44 from ascribe/feature/testimonials
Testimonials functionality
This commit is contained in:
commit
94712bf4de
@ -30,6 +30,7 @@
|
||||
@import 'ascribe/_feature-circles.less';
|
||||
@import 'ascribe/_team.less';
|
||||
@import 'ascribe/_blog.less';
|
||||
@import 'ascribe/_testimonials.less';
|
||||
|
||||
@import '_page-api.less';
|
||||
|
||||
|
98
assets/_src/less/ascribe/_testimonials.less
Normal file
98
assets/_src/less/ascribe/_testimonials.less
Normal file
@ -0,0 +1,98 @@
|
||||
|
||||
|
||||
.testimonials {
|
||||
background: @greyBg;
|
||||
margin-bottom: 0;
|
||||
|
||||
.row { background: none; }
|
||||
|
||||
.grid { margin-bottom: 0; }
|
||||
|
||||
.grid__col {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
}
|
||||
|
||||
.testimonial {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.testimonial__quote,
|
||||
.testimonial__caption {
|
||||
flex: 0 0 100%;
|
||||
}
|
||||
|
||||
.testimonial__quote {
|
||||
// blockquote reset
|
||||
margin: 0;
|
||||
position: relative;
|
||||
border: none;
|
||||
color: @text-color;
|
||||
padding: 0;
|
||||
font-style: normal;
|
||||
|
||||
// styling
|
||||
//&:extend(.bold);
|
||||
padding: (@spacer / 2);
|
||||
align-self: flex-start;
|
||||
|
||||
// quote characters
|
||||
// &:before {
|
||||
// content: "“";
|
||||
// font-size: 250%;
|
||||
// color: @greyHr;
|
||||
// line-height: 0;
|
||||
// margin-left: -1em;
|
||||
// }
|
||||
}
|
||||
|
||||
.testimonial__caption {
|
||||
align-self: flex-end;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border-top: 2px solid lighten(@greySocial, 10%);
|
||||
padding-top: (@spacer / 2);
|
||||
position: relative;
|
||||
background: @greyBg;
|
||||
|
||||
// speech triangle
|
||||
&:before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
width: 0;
|
||||
height: 0;
|
||||
border-style: solid;
|
||||
left: 4em;
|
||||
top: 0;
|
||||
border-width: .9em .9em 0 0;
|
||||
border-color: transparent;
|
||||
border-top-color: lighten(@greySocial, 10%);
|
||||
}
|
||||
}
|
||||
|
||||
.testimonial__avatar {
|
||||
width: 4em;
|
||||
height: 4em;
|
||||
display: inline-block;
|
||||
margin-right: (@spacer / 2);
|
||||
border-radius: 50%;
|
||||
border: 2px solid lighten(@greySocial, 20%);
|
||||
}
|
||||
|
||||
.testimonial__cite {
|
||||
&:extend(.small);
|
||||
font-style: normal;
|
||||
flex: 1;
|
||||
color: @greySocial;
|
||||
}
|
||||
|
||||
.testimonial__name {
|
||||
font-weight: @font-weight-bold;
|
||||
}
|
||||
|
||||
.testimonial__org {
|
||||
display: block;
|
||||
}
|
2
assets/dist/css/ascribe.css
vendored
2
assets/dist/css/ascribe.css
vendored
File diff suppressed because one or more lines are too long
2
assets/dist/css/ascribe.min.css
vendored
2
assets/dist/css/ascribe.min.css
vendored
File diff suppressed because one or more lines are too long
@ -104,6 +104,9 @@ class Subtemplate {
|
||||
case 'events':
|
||||
$result .= $this->eventPage($subtemplateTitle);
|
||||
break;
|
||||
case 'testimonials':
|
||||
$result .= $this->testimonials($subtemplateTitle);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1174,4 +1177,51 @@ class Subtemplate {
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
//
|
||||
// Subtemplate: Testimonials
|
||||
//
|
||||
public function testimonials($subtemplateTitle) {
|
||||
|
||||
$testimonials = get_sub_field('testimonials');
|
||||
$testimonialMarkup = '';
|
||||
|
||||
if ( $testimonials ) {
|
||||
foreach ($testimonials as $testimonial) {
|
||||
|
||||
$id = $testimonial->ID;
|
||||
$quote = get_field('quote', $id);
|
||||
$name = get_field('name', $id);
|
||||
$company = get_field('company', $id);
|
||||
$link = get_field('link', $id);
|
||||
$photo_object = get_field('photo', $id);
|
||||
$photo_size = 'thumbnail';
|
||||
$photo_url = $photo_object['sizes'][$photo_size];
|
||||
|
||||
$testimonialMarkup .= "<div class='grid__col'>
|
||||
<figure class='testimonial'>
|
||||
<blockquote class='testimonial__quote'>{$quote}</blockquote>
|
||||
<figcaption class='testimonial__caption'>
|
||||
<img class='testimonial__avatar' src='{$photo_url}'>
|
||||
<cite class='testimonial__cite'>
|
||||
<span class='testimonial__name'>{$name}</span>
|
||||
<span class='testimonial__org'><a href='{$link}'>{$company}</a></span>
|
||||
</cite>
|
||||
</figcaption>
|
||||
</figure>
|
||||
</div>";
|
||||
}
|
||||
}
|
||||
|
||||
$result = "<section class='subtemplate testimonials'>
|
||||
<div class='row'>
|
||||
<h1 class='subtemplate__title'>{$subtemplateTitle}</h1>
|
||||
<article class='grid grid--full grid-medium--fit grid--gutters'>
|
||||
{$testimonialMarkup}
|
||||
</article>
|
||||
</div>
|
||||
</section>";
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,12 @@ define( 'WPTHEME_PATH', get_template_directory() . '/' );
|
||||
define( 'WPTHEME_INC', WPTHEME_PATH . 'includes/' );
|
||||
|
||||
// Include compartmentalized functions
|
||||
require_once WPTHEME_INC . 'functions/core.php';
|
||||
require_once WPTHEME_INC . 'core.php';
|
||||
require_once WPTHEME_INC . 'cpt-team.php';
|
||||
require_once WPTHEME_INC . 'cpt-career.php';
|
||||
require_once WPTHEME_INC . 'cpt-presscoverage.php';
|
||||
require_once WPTHEME_INC . 'cpt-event.php';
|
||||
require_once WPTHEME_INC . 'cpt-testimonial.php';
|
||||
|
||||
// Run the setup functions
|
||||
TenUp\ascribe\Core\setup();
|
||||
|
31
includes/cpt-career.php
Normal file
31
includes/cpt-career.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
function ascribe_register_cpt_career() {
|
||||
$labels = array(
|
||||
"name" => "Careers",
|
||||
"singular_name" => "Career",
|
||||
);
|
||||
|
||||
$args = array(
|
||||
"labels" => $labels,
|
||||
"description" => "",
|
||||
"public" => true,
|
||||
"show_ui" => true,
|
||||
"show_in_rest" => false,
|
||||
"has_archive" => false,
|
||||
"show_in_menu" => true,
|
||||
"exclude_from_search" => false,
|
||||
"capability_type" => "post",
|
||||
"map_meta_cap" => true,
|
||||
"hierarchical" => false,
|
||||
"rewrite" => array( "slug" => "career", "with_front" => true ),
|
||||
"query_var" => true,
|
||||
"menu_icon" => 'dashicons-businessman'
|
||||
|
||||
);
|
||||
register_post_type( "career", $args );
|
||||
}
|
||||
|
||||
add_action( 'init', 'ascribe_register_cpt_career' );
|
||||
|
||||
?>
|
31
includes/cpt-event.php
Normal file
31
includes/cpt-event.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
function ascribe_register_cpt_event() {
|
||||
$labels = array(
|
||||
"name" => "Events",
|
||||
"singular_name" => "Event",
|
||||
);
|
||||
|
||||
$args = array(
|
||||
"labels" => $labels,
|
||||
"description" => "",
|
||||
"public" => true,
|
||||
"show_ui" => true,
|
||||
"show_in_rest" => false,
|
||||
"has_archive" => false,
|
||||
"show_in_menu" => true,
|
||||
"exclude_from_search" => false,
|
||||
"capability_type" => "post",
|
||||
"map_meta_cap" => true,
|
||||
"hierarchical" => false,
|
||||
"rewrite" => array( "slug" => "event", "with_front" => true ),
|
||||
"query_var" => true,
|
||||
"supports" => array( "title" ),
|
||||
"menu_icon" => 'dashicons-calendar-alt'
|
||||
);
|
||||
register_post_type( "event", $args );
|
||||
}
|
||||
|
||||
add_action( 'init', 'ascribe_register_cpt_event' );
|
||||
|
||||
?>
|
31
includes/cpt-presscoverage.php
Normal file
31
includes/cpt-presscoverage.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
function ascribe_register_cpt_press() {
|
||||
$labels = array(
|
||||
"name" => "Press Coverage",
|
||||
"singular_name" => "Press Coverage",
|
||||
);
|
||||
|
||||
$args = array(
|
||||
"labels" => $labels,
|
||||
"description" => "",
|
||||
"public" => true,
|
||||
"show_ui" => true,
|
||||
"show_in_rest" => false,
|
||||
"has_archive" => false,
|
||||
"show_in_menu" => true,
|
||||
"exclude_from_search" => false,
|
||||
"capability_type" => "post",
|
||||
"map_meta_cap" => true,
|
||||
"hierarchical" => false,
|
||||
"rewrite" => array( "slug" => "presscoverage", "with_front" => true ),
|
||||
"query_var" => true,
|
||||
"menu_icon" => 'dashicons-media-document'
|
||||
|
||||
);
|
||||
register_post_type( "presscoverage", $args );
|
||||
}
|
||||
|
||||
add_action( 'init', 'ascribe_register_cpt_press' );
|
||||
|
||||
?>
|
30
includes/cpt-team.php
Normal file
30
includes/cpt-team.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
function ascribe_register_cpt_team() {
|
||||
$labels = array(
|
||||
"name" => "Team Members",
|
||||
"singular_name" => "Team Member",
|
||||
);
|
||||
|
||||
$args = array(
|
||||
"labels" => $labels,
|
||||
"description" => "",
|
||||
"public" => true,
|
||||
"show_ui" => true,
|
||||
"show_in_rest" => false,
|
||||
"has_archive" => false,
|
||||
"show_in_menu" => true,
|
||||
"exclude_from_search" => false,
|
||||
"capability_type" => "post",
|
||||
"map_meta_cap" => true,
|
||||
"hierarchical" => false,
|
||||
"rewrite" => array( "slug" => "team", "with_front" => true ),
|
||||
"query_var" => true,
|
||||
"menu_icon" => 'dashicons-nametag'
|
||||
);
|
||||
register_post_type( "team", $args );
|
||||
}
|
||||
|
||||
add_action( 'init', 'ascribe_register_cpt_team' );
|
||||
|
||||
?>
|
44
includes/cpt-testimonial.php
Normal file
44
includes/cpt-testimonial.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
add_action( 'init', 'ascribe_register_cpt_testimonial' );
|
||||
|
||||
function ascribe_register_cpt_testimonial() {
|
||||
$labels = array(
|
||||
"name" => "Testimonials",
|
||||
"singular_name" => "Testimonial",
|
||||
"menu_name" => "Testimonials",
|
||||
"all_items" => "All Testimonials",
|
||||
"add_new" => "Add New",
|
||||
"add_new_item" => "Add New Testimonial",
|
||||
"edit" => "Edit",
|
||||
"edit_item" => "Edit Testimonial",
|
||||
"new_item" => "New Testimonial",
|
||||
"view" => "View",
|
||||
"view_item" => "View Testimonial",
|
||||
"search_items" => "Search Testimonial",
|
||||
"not_found" => "No Testimonials found",
|
||||
"not_found_in_trash" => "No Testimonials found in Trash",
|
||||
"parent" => "Parent Testimonial",
|
||||
);
|
||||
|
||||
$args = array(
|
||||
"labels" => $labels,
|
||||
"description" => "",
|
||||
"public" => true,
|
||||
"show_ui" => true,
|
||||
"show_in_rest" => false,
|
||||
"has_archive" => false,
|
||||
"show_in_menu" => true,
|
||||
"exclude_from_search" => true,
|
||||
"capability_type" => "post",
|
||||
"map_meta_cap" => true,
|
||||
"hierarchical" => false,
|
||||
"rewrite" => false,
|
||||
"query_var" => true,
|
||||
"menu_icon" => 'dashicons-format-quote'
|
||||
|
||||
);
|
||||
register_post_type( "testimonial", $args );
|
||||
}
|
||||
|
||||
?>
|
@ -1,3 +0,0 @@
|
||||
# Includes
|
||||
|
||||
All theme classes, objects, and libraries should be hidden away in this `/includes` directory.
|
Loading…
Reference in New Issue
Block a user