-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
889 additions
and
595 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
{ | ||
"$schema": "https://schemas.wp.org/trunk/block.json", | ||
"apiVersion": 2, | ||
"name": "carkeek-blocks/youtube-embed", | ||
"version": "0.1.0", | ||
"title": "Youtube Embeds", | ||
"category": "widgets", | ||
"icon": "smiley", | ||
"description": "Display a List of Youtube Videos.", | ||
"supports": { | ||
"html": false, | ||
"anchor": true | ||
}, | ||
"keywords": [ | ||
"youtube", | ||
"carousel", | ||
"videos" | ||
], | ||
"textdomain": "carkeek-blocks", | ||
"editorScript": "file:./index.js", | ||
"editorStyle": "file:./index.css", | ||
"style": "file:./style-index.css", | ||
"render": "file:./render.php", | ||
"viewScript": "file:./script.js", | ||
"attributes": { | ||
"taxTermsSelected": { | ||
"type": "string", | ||
"default": "" | ||
}, | ||
"taxQueryType": { | ||
"type": "string", | ||
"default": "AND" | ||
}, | ||
"displayAs": { | ||
"type": "string", | ||
"default": "grid" | ||
}, | ||
"sortBy": { | ||
"type": "string", | ||
"default": "title" | ||
}, | ||
"order": { | ||
"type": "string", | ||
"default": "ASC" | ||
}, | ||
"columns": { | ||
"type": "number", | ||
"default": 3 | ||
}, | ||
"columnsMobile": { | ||
"type": "number", | ||
"default": 1 | ||
}, | ||
"columnsTablet": { | ||
"type": "number", | ||
"default": 3 | ||
}, | ||
"autoPlay": { | ||
"type": "boolean", | ||
"default": true | ||
}, | ||
"autoPlaySpeed": { | ||
"type": "number", | ||
"default": 3000 | ||
}, | ||
"context": { | ||
"type": "string", | ||
"default": "view" | ||
} | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
build/custom-links/index.asset.php → build/yt-embed/index.asset.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-server-side-render'), 'version' => 'f08c1cb2fc39ace359c9'); | ||
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-server-side-render'), 'version' => '3d7c8ccd42b1c4ace6e5'); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
/** Layout template for the youtube embeds */ | ||
|
||
$number = 'carousel' === $attributes['displayAs'] && 'edit' === $attributes['context'] ? $attributes['columns'] : -1; | ||
|
||
$args = array( | ||
'numberposts' => $number, | ||
'post_type' => 'yt_embed', | ||
'order' => $attributes['order'], | ||
'post_status' => 'publish', | ||
'orderby' => $attributes['sortBy'], | ||
); | ||
|
||
if ( ! empty( $attributes['taxTermsSelected'] ) ) { | ||
$args['tax_query'] = array( | ||
'relation' => 'AND', | ||
array( | ||
'taxonomy' => 'embed_cat', | ||
'field' => 'term_id', | ||
'terms' => explode( ',', $attributes['taxTermsSelected'] ), | ||
), | ||
); | ||
} | ||
|
||
$embeds = get_posts( $args ); | ||
$data_attrs = ''; | ||
if ( $attributes['displayAs'] == 'grid' || $attributes['context'] == 'edit') { | ||
$wrapper_classes = 'ck-columns-grid has-' . $attributes['columns'] . '-columns has-' . $attributes['columnsTablet'] . '-columns-tablet has-' . $attributes['columnsMobile'] . '-columns-mobile'; | ||
} else { | ||
$wrapper_classes = 'slider-carousel'; | ||
$data_attrs = 'data-slick=\'{ "slidesToShow": ' . $attributes['columns'] . ', "slidesToScroll": ' . $attributes['columns'] . ', "responsive": [ { "breakpoint": 1024, "settings": { "slidesToShow": ' . $attributes['columnsTablet'] . ', "slidesToScroll": ' . $attributes['columnsTablet'] . ' } }, { "breakpoint": 600, "settings": { "slidesToShow": ' . $attributes['columnsMobile'] . ', "slidesToScroll": ' . $attributes['columnsMobile'] . ' } } ] }\''; | ||
} | ||
|
||
?> | ||
<div <?php echo get_block_wrapper_attributes( array( 'class' => $wrapper_classes ) ); ?> <?php echo $data_attrs; ?>> | ||
<?php | ||
foreach ( $embeds as $embed ) { | ||
|
||
$yt = get_field( 'yt_embed_oembed', $embed->ID, false ); | ||
$yt_id = ''; | ||
if ( strpos( $yt, 'youtu.be' ) !== false ) { | ||
$yt = explode( '/', $yt ); | ||
$yt_id = end( $yt ); | ||
} else { | ||
$yt = explode( 'v=', $yt ); | ||
$yt_id = $yt[1]; | ||
} | ||
$description = get_field( 'yt_embed_description', $embed->ID ); | ||
if ( ! empty( $description ) ) { | ||
$description = '<div class="embed-description">' . $description . '</div>'; | ||
} | ||
|
||
if ( ! empty( $yt_id ) ) { | ||
|
||
echo '<div class="yt-embed"><lite-youtube | ||
videotitle="' . $embed->post_title . '" | ||
videoid="' . $yt_id . '" | ||
></lite-youtube> | ||
<p class="embed-title">' . $embed->post_title . '</p>' . $description . ' | ||
</div>'; | ||
|
||
|
||
} | ||
} | ||
?> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<?php return array('dependencies' => array('jquery'), 'version' => 'e7fefeb72aedcf88f778'); |
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.