734b44a8 by Jeremy Groot

strategic projects

1 parent d5530b34
...@@ -14522,6 +14522,49 @@ a.pdf:hover, a.extern:hover, a.xls:hover, a.mailto:hover { ...@@ -14522,6 +14522,49 @@ a.pdf:hover, a.extern:hover, a.xls:hover, a.mailto:hover {
14522 font-family: "Helvetica-Bold"; 14522 font-family: "Helvetica-Bold";
14523 } 14523 }
14524 14524
14525 .strategic-child-page {
14526 display: flex;
14527 flex-direction: row;
14528 align-items: end;
14529 padding: 0.5rem 0;
14530 border-bottom: 1px solid #949598;
14531 }
14532 .strategic-child-page:first-of-type {
14533 border-top: 1px solid #949598;
14534 }
14535 .strategic-child-page .strategic-content {
14536 flex-basis: 70%;
14537 }
14538 .strategic-child-page .strategic-content h2 {
14539 font-size: 1rem;
14540 }
14541 .strategic-child-page .strategic-read-more-button {
14542 flex-basis: 30%;
14543 }
14544 .strategic-child-page .strategic-read-more-button a {
14545 display: block;
14546 background-color: #009ade;
14547 border: 0 !important;
14548 color: #000;
14549 border-radius: 0;
14550 padding: 0;
14551 font-family: Helvetica;
14552 font-size: 1rem;
14553 padding: 1.1875rem 2.5rem;
14554 display: flex;
14555 align-items: center;
14556 transition: none;
14557 justify-content: center;
14558 width: 100%;
14559 text-transform: uppercase;
14560 max-width: 256px;
14561 margin-bottom: 1rem;
14562 }
14563 .strategic-child-page .strategic-read-more-button a:hover {
14564 background-color: #acd6f2;
14565 text-decoration: none;
14566 }
14567
14525 article > h5 { 14568 article > h5 {
14526 margin-top: 0; 14569 margin-top: 0;
14527 } 14570 }
......
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
...@@ -304,6 +304,52 @@ a.pdf, a.extern, a.xls, a.mailto { ...@@ -304,6 +304,52 @@ a.pdf, a.extern, a.xls, a.mailto {
304 } 304 }
305 } 305 }
306 306
307 .strategic-child-page {
308 display: flex;
309 flex-direction: row;
310 align-items: end;
311
312 padding:0.5rem 0;
313 border-bottom:1px solid #949598;
314
315 &:first-of-type {
316 border-top:1px solid #949598;
317 }
318
319 .strategic-content {
320 flex-basis: 70%;
321 h2 {
322 font-size: 1rem;
323 }
324 }
325 .strategic-read-more-button {
326 flex-basis: 30%;
327 a {
328 display: block;
329 background-color: #009ade;
330 border: 0!important;
331 color: #000;
332 border-radius: 0;
333 padding: 0;
334 font-family: Helvetica;
335 font-size: 1rem;
336 padding: 1.1875rem 2.5rem;
337 display: flex;
338 align-items: center;
339 transition: none;
340 justify-content: center;
341 width: 100%;
342 text-transform: uppercase;
343 max-width: 256px;
344 margin-bottom:1rem;
345 &:hover {
346 background-color: #acd6f2;
347 text-decoration: none;
348 }
349 }
350 }
351 }
352
307 article { 353 article {
308 & > h5 { 354 & > h5 {
309 margin-top:0; 355 margin-top:0;
......
...@@ -15,6 +15,7 @@ require_once 'inc/shortcodes-circulars.php'; ...@@ -15,6 +15,7 @@ require_once 'inc/shortcodes-circulars.php';
15 require_once 'inc/blocks.php'; 15 require_once 'inc/blocks.php';
16 require_once 'inc/breadcrumb.php'; 16 require_once 'inc/breadcrumb.php';
17 require_once 'inc/brokers_cli.php'; 17 require_once 'inc/brokers_cli.php';
18 require_once 'inc/strategic-projects.php';
18 19
19 function load_custom_wp_admin_style(){ 20 function load_custom_wp_admin_style(){
20 wp_register_style( 'custom_wp_admin_css', get_bloginfo('template_url') . '/style.css', false, '1.0.0' ); 21 wp_register_style( 'custom_wp_admin_css', get_bloginfo('template_url') . '/style.css', false, '1.0.0' );
......
1 <?php
2
3 function strategic_crop($content, $maxCharacters, $append = '...', $respectWordBoundaries = false, $stripTags = false)
4 {
5 if ($stripTags) {
6 $content = strip_tags($content);
7 }
8
9 if ($maxCharacters) {
10 if (mb_strlen($content, 'utf-8') > abs($maxCharacters)) {
11 $truncatePosition = false;
12 if ($maxCharacters < 0) {
13 $content = mb_substr($content, $maxCharacters, null, 'utf-8');
14 if ($respectWordBoundaries) {
15 $truncatePosition = strpos($content, ' ');
16 }
17 $content = $truncatePosition ? $append . substr($content, $truncatePosition) : $append . $content;
18 } else {
19 $content = mb_substr($content, 0, $maxCharacters, 'utf-8');
20 if ($respectWordBoundaries) {
21 $truncatePosition = strrpos($content, ' ');
22 }
23 $content = $truncatePosition ? substr($content, 0, $truncatePosition) . $append : $content . $append;
24 }
25 }
26 }
27 return $content;
28 }
29
30
31 function strategic_projects_shortcode($atts) {
32 $atts = shortcode_atts(array(
33 'parent_id' => 0,
34 ), $atts, 'strategic_projects');
35
36 $parent_id = intval($atts['parent_id']);
37 $children = get_pages(array('child_of' => $parent_id));
38
39 $output = '';
40
41 if(count($children) == 0) {
42 return "<h1 style='text-align:center'>".__("Coming Soon")."</h1>";
43 }
44 foreach ($children as $child) {
45
46 if(strlen($child->post_content) > 300) {
47 $post_content = strategic_crop($child->post_content, 300, '...', true, false);
48 } else {
49 $post_content = $child->post_content;
50 }
51
52
53 $output .= '<div class="strategic-child-page">';
54 $output .= '<div class="strategic-content"><h2>' . $child->post_title . '</h2>';
55 $output .= '<div class="strategic-child-page-content">' . strategic_crop($child->post_content, 300, '...', true, false) . '</div></div>';
56 $output .= '<div class="strategic-read-more-button"><a href="' . get_permalink($child->ID) . '" class="strategic-read-more">Read More</a></div>';
57 $output .= '</div>';
58 }
59
60 return $output;
61 }
62 add_shortcode('strategic_projects', 'strategic_projects_shortcode');