Skip to content

Commit

Permalink
Merge pull request #1096 from equalizedigital/feature/landingpage-cpt
Browse files Browse the repository at this point in the history
affiliate block
  • Loading branch information
tronsymphony authored Mar 6, 2024
2 parents b834e35 + 590dd3d commit f33a1eb
Show file tree
Hide file tree
Showing 10 changed files with 269 additions and 9 deletions.
2 changes: 1 addition & 1 deletion assets/css/editor-style.css

Large diffs are not rendered by default.

30 changes: 30 additions & 0 deletions assets/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -8061,6 +8061,36 @@ select.tab-block-container-tab-block_header-buttons_mobile_select {
border-radius: 50%;
margin: -50px auto 0; }

.ed_landing_works_editor.ed_landing_works_editor_empty {
padding: 90px 0 0; }

.ed_landing_works_editor_container {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
margin: 0 auto;
max-width: 1122px; }
.ed_landing_works_editor_container_content, .ed_landing_works_editor_container_media {
flex-basis: 48%;
margin-bottom: 20px; }
.ed_landing_works_editor_container_media {
position: -webkit-sticky;
position: sticky;
top: 20px;
align-self: flex-start; }
.ed_landing_works_editor_container_media iframe {
width: 100%;
height: 315px; }

@media (max-width: 768px) {
.ed_landing_works_editor_container {
flex-direction: column; }
.ed_landing_works_editor_container_content, .ed_landing_works_editor_container_media {
flex-basis: 100%; }
.ed_landing_works_editor_container_media {
position: relative;
top: auto; } }

.grid-middle-line {
position: relative; }
.grid-middle-line::after {
Expand Down
53 changes: 53 additions & 0 deletions assets/scss/blocks/_affiliate-landing.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@

.ed_landing_works_editor {
&.ed_landing_works_editor_empty {
padding: 90px 0 0;
}

&_container {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
margin: 0 auto;
max-width: 1122px;

&_content,
&_media {
flex-basis: 48%;
margin-bottom: 20px;
}

&_content {}

&_media {

position: -webkit-sticky;
position: sticky;
top: 20px;
align-self: flex-start;

iframe {

width: 100%;
height: 315px;
}
}
}


@media (max-width: 768px) {
&_container {
flex-direction: column;

&_content,
&_media {
flex-basis: 100%;
}

&_media {
position: relative;
top: auto;
}
}
}
}
1 change: 1 addition & 0 deletions assets/scss/blocks/block-loader.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@
@import "./featured-post";
@import "./squared-image-content-callout";
@import "./testimonial-videos";
@import "./affiliate-landing";
18 changes: 11 additions & 7 deletions assets/scss/partials/_gutenberg.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
body, p {
@include style( 'text', null, true );
body,
p {
@include style('text', null, true);
}

/* Post title width */
Expand All @@ -8,7 +9,7 @@ body, p {

/* Post title styling */
.editor-post-title__input {
@include style( 'title', 1, true );
@include style('title', 1, true);
}
}

Expand All @@ -25,15 +26,15 @@ body, p {
max-width: none;
}

&[data-align="center"] > [data-type="core/group"] {
&[data-align="center"]>[data-type="core/group"] {
text-align: inherit;

.wp-block-group__inner-container {
max-width: $content-width;
}
}

&[data-align="wide"] > [data-type="core/group"] {
&[data-align="wide"]>[data-type="core/group"] {

.wp-block-group__inner-container {
max-width: $grid-width;
Expand Down Expand Up @@ -65,7 +66,8 @@ body, p {
}
}

ul, ol {
ul,
ol {
margin-bottom: 24px;
}

Expand All @@ -85,7 +87,7 @@ ul, ol {
}

.grid-middle-line {
position: relative;
position: relative;
}


Expand All @@ -94,3 +96,5 @@ ul, ol {
@import "entry-content";




44 changes: 44 additions & 0 deletions config.codekit3
Original file line number Diff line number Diff line change
Expand Up @@ -2518,6 +2518,21 @@
"sC" : 3,
"tS" : 0
},
"\/assets\/scss\/blocks\/_affiliate-landing.scss" : {
"aP" : 0,
"bl" : 0,
"co" : 0,
"dP" : 10,
"ec" : 1,
"ft" : 4,
"ma" : 0,
"oA" : 1,
"oAP" : "\/assets\/scss\/css\/_affiliate-landing.css",
"oF" : 0,
"oS" : 0,
"pg" : 0,
"sct" : 1
},
"\/assets\/scss\/blocks\/_testimonial-videos.scss" : {
"aP" : 0,
"bl" : 0,
Expand Down Expand Up @@ -3854,6 +3869,35 @@
"oAP" : "\/template-parts\/blocks\/accordion\/template.php",
"oF" : 0
},
"\/template-parts\/blocks\/affiliant-landing-block\/block.json" : {
"ft" : 524288,
"oA" : 1,
"oAP" : "\/template-parts\/blocks\/affiliant-landing-block\/block-min.json",
"oF" : 0,
"oO" : 0,
"oS" : 1
},
"\/template-parts\/blocks\/affiliant-landing-block\/screenshot.png" : {
"ft" : 32768,
"iS" : 1047008,
"oA" : 0,
"oAP" : "\/template-parts\/blocks\/affiliant-landing-block\/screenshot.png",
"oF" : 0,
"oIPL" : 0,
"opt" : 0,
"oT" : 1,
"ou" : "lpckwebp-none",
"q" : 100,
"rq" : 75
},
"\/template-parts\/blocks\/affiliant-landing-block\/template.php" : {
"cB" : 0,
"ft" : 8192,
"hM" : 0,
"oA" : 2,
"oAP" : "\/template-parts\/blocks\/affiliant-landing-block\/template.php",
"oF" : 0
},
"\/template-parts\/blocks\/calculator-form-cta\/block.json" : {
"ft" : 524288,
"oA" : 1,
Expand Down
15 changes: 14 additions & 1 deletion inc/loop.php
Original file line number Diff line number Diff line change
Expand Up @@ -339,10 +339,22 @@ function eqd_single_landing_page() {
</section>
<?php } ?>


<?php if(!empty($parameter_page)): ?>
<section class="ed_landing_works <?php if(empty($parameter_page)){ echo 'ed_landing_works_empty'; } else {} ?>">
<div class="ed_landing_works_container">
<div class="ed_landing_works_container_content">
<h2 class="heading">How Does the Consult Work?</h2>
<h2 class="heading">
<?php
if(empty($parameter_page)){
the_field('heading');
} else {
the_field('heading', $parameter_page);
}
?>

</h2>

<?php
if(empty($parameter_page)){
the_field('how_does_the_consult_work');
Expand Down Expand Up @@ -371,6 +383,7 @@ function eqd_single_landing_page() {
?>
</div>
</section>
<?php endif; ?>

<?php
}
Expand Down
26 changes: 26 additions & 0 deletions template-parts/blocks/affiliant-landing-block/block.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "acf/affialiate-landing-block",
"title": "Affiliate Landing",
"description": "Two columns. Text and Video",
"category": "custom-blocks",
"icon": "screenoptions",
"keywords": [
"featured",
"Affiliate Landing",
"Affiliate Landing block",
"Affiliate Landing logos",
"Affiliate Landing logos block",
"Affiliate Landing logos list",
"Affiliate Landing logos list block"
],
"acf": {
"mode": "preview",
"renderTemplate": "template.php"
},
"attributes": {
"previewImage": {
"type": "string",
"default": "/wp-content/themes/student-loan-planner-theme/template-parts/blocks/affiliate-landing-block/screenshot.png"
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
89 changes: 89 additions & 0 deletions template-parts/blocks/affiliant-landing-block/template.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<?php

/**
* Affiliate Landing block Block Template.
*
* @param array $block The block settings and attributes.
* @param string $content The block inner HTML (empty).
* @param bool $is_preview True during AJAX preview.
* @param (int|string) $post_id The post ID this block is saved to.
*/

if( isset( $block['data']['preview_image_help'] ) ) :
echo Loader_Gutenberg::get_preview_image( $block['data']['preview_image_help'], $block['name'] );
return;
endif;

// Create id attribute allowing for custom 'anchor' value.
$id = 'affiliate-landing-block-' . $block['id'];
if (!empty($block['anchor'])) :
$id = $block['anchor'];
endif;

// Create class attribute allowing for custom 'className' and 'align' values.
$className = 'block affiliate-landing-block';
if (!empty($block['className'])) :
$className .= ' ' . $block['className'];
endif;

if (!empty($block['align'])) :
$className .= ' align' . $block['align'];
endif;

$className = apply_filters( 'loader_block_class', $className, $block, $post_id );

// Load values and assing defaults.
$title = get_field('title');


// Check if 'slug' is set in the URL parameters
if (isset($_GET['landing_page'])) {
$page_slug = $_GET['landing_page'];

// Query for the page by slug
$args = array(
'post_type' => 'slp_landing',
'post_status' => 'publish',
'numberposts' => 1,
'meta_query' => array(
array(
'key' => 'landing_page_url_text',
'value' => $page_slug,
'compare' => '=',
),
),
);
$page = get_posts($args);

// If the page exists, redirect or load the page
if ($page) {
$page_id = $page[0]->ID;

$parameter_page = $page_id;
}
}

if (!isset($parameter_page)) {

?>
<section id="<?php echo esc_attr($id); ?>" class="ed_landing_works_editor <?php if(empty($parameter_page)){ echo 'ed_landing_works_editor_empty'; } else {} ?> <?php echo esc_attr($className); ?>">
<div class="ed_landing_works_editor_container">
<div class="ed_landing_works_editor_container_content">
<h2 class="heading"><?php the_field('heading'); ?></h2>
<?php
the_field('how_does_the_consult_work');
?>
</div>


<?php
if(get_field('how_does_the_consult_work_youtube_id')): ?>
<div class="ed_landing_works_editor_container_media">
<iframe width="560" height="315" src="https://www.youtube.com/embed/<?php the_field('how_does_the_consult_work_youtube_id'); ?>" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
</div>
<?php endif;
?>
</div>
</section>

<?php } ?>

0 comments on commit f33a1eb

Please sign in to comment.