Skip to content

Commit a994868

Browse files
authored
Merge pull request #18 from creativecommons/component-fix
Component fix
2 parents 6ff9e7a + c10a845 commit a994868

File tree

4 files changed

+30
-16
lines changed

4 files changed

+30
-16
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,6 @@ node_modules/
1818
*.log
1919
*.sql
2020
*.sqlite
21+
22+
# ignore VSCode project files
23+
*.code-workspace

inc/class-components.php

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,15 @@ public static function card_post(
9090
$out .= '<span class="pre-title">' . $pre_title . '</span>';
9191
}
9292
$out .= '<h4 class="card-title"><a href="' . $card_url . '">' . $card_title . '</a></h4>';
93-
if ( ! $is_video && ! empty( $card_date ) ) {
93+
if ( ! $is_video && ! empty( $card_date ) & $date ) {
9494
$out .= '<span class="subtitle"> ' . $card_date . ' </span>';
9595
}
9696
if ( $has_content ) {
9797
$the_post = ( $use_post_data ) ? get_post( $post_id ) : false;
9898
$the_description = ( $use_post_data ) ? do_excerpt( $the_post, array( 'length' => 110 ) ) : $description;
99+
$filtered_content = apply_filters( 'cc_theme_base_filter_card_content', $the_description, $post_id );
99100
$out .= '<div class="content">';
100-
$out .= $the_description;
101+
$out .= $filtered_content;
101102
$out .= '</div>';
102103
}
103104
if ( $has_button ) {
@@ -128,11 +129,13 @@ public static function card_post_event( $post_id, $has_content = true ) {
128129
$out .= '<h4 class="card-title"><a href="' . get_permalink( $post_id ) . '">' . get_the_title( $post_id ) . '</a></h4>';
129130
if ( $has_content ) {
130131
$the_post = get_post( $post_id );
132+
$entry_content = do_excerpt( $the_post );
133+
$filtered_content = apply_filters( 'cc_theme_base_filter_card_event_content', $entry_content, $post_id );
131134
$out .= '<div class="content">';
132-
$out .= do_excerpt( $the_post );
135+
$out .= $filtered_content;
133136
$out .= '</div>';
134137
}
135-
$out .= '<a href="' . get_permalink( $post_id ) . '" class="read-more">Read more</a>';
138+
$out .= '<a href="' . get_permalink( $post_id ) . '" class="read-more">Read more <i class="icon chevron-right"></i></a>';
136139
$out .= '</div>';
137140
$out .= '</article>';
138141

@@ -161,8 +164,10 @@ public static function card_statistic( $post_id, $number, $caption, $caption_is_
161164
$out .= '<div class="card-content">';
162165
if ( $has_content ) {
163166
$the_post = get_post( $post_id );
167+
$entry_content = do_excerpt( $the_post );
168+
$filtered_content = apply_filters( 'cc_theme_base_filter_card_event_content', $entry_content, $post_id );
164169
$out .= '<div class="content">';
165-
$out .= do_excerpt( $the_post );
170+
$out .= $filtered_content;
166171
$out .= '</div>';
167172
}
168173
if ( $has_link ) {
@@ -194,8 +199,10 @@ public static function card_quote( $post_id, $show_image = true, $author_name, $
194199
$out .= '<div class="card-content">';
195200
$out .= '<span class="quote"></span>';
196201
$the_post = get_post( $post_id );
202+
$entry_content = apply_filters( 'the_content', $the_post->post_content );
203+
$filtered_content = apply_filters( 'cc_theme_base_filter_card_quote_content', $entry_content, $post_id );
197204
$out .= '<div class="content">';
198-
$out .= apply_filters( 'the_content', $the_post->post_content );
205+
$out .= $filtered_content;
199206
$out .= '<div class="quote-author">';
200207
$out .= '<strong class="title"> ' . $author_name . '</strong>';
201208
$out .= '<p class="description">' . $author_description . '</p>';
@@ -268,9 +275,12 @@ public static function card_link( $post_id = null, $use_post_data = false, $back
268275
if ( $has_content ) {
269276
if ( $use_post_data ) {
270277
$the_post = get_post( $post_id );
271-
$the_content = do_excerpt( $the_post );
278+
$get_content = do_excerpt( $the_post );
279+
$filtered_content = apply_filters( 'cc_theme_base_filter_card_link_content', $get_content, $post_id );
280+
$the_content = $filtered_content;
272281
} else {
273-
$the_content = $description;
282+
$filtered_content = apply_filters( 'cc_theme_base_filter_card_link_content', $description, $post_id );
283+
$the_content = $filtered_content;
274284
}
275285
$out .= '<span class="content">' . esc_attr( $description ) . '</span>';
276286
}
@@ -361,8 +371,10 @@ public static function simple_entry( $post_id, $has_content = true, $has_image =
361371
$out .= '<span class="entry-date">' . get_the_date( CC_Site::get_date_format() ) . '</span>';
362372
if ( $has_content ) {
363373
$the_post = get_post( $post_id );
374+
$the_content = do_excerpt( $the_post );
375+
$filtered_content = apply_filters( 'cc_theme_base_filter_card_link_content', $the_content, $post_id );
364376
$out .= '<div class="entry-description">';
365-
$out .= do_excerpt( $the_post );
377+
$out .= $filtered_content;
366378
$out .= '</div>';
367379
}
368380
$out .= '</div>';

inc/helpers.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,19 +137,19 @@ public static function get_video_embed( $url, $width = '100%', $height = 450 ) {
137137
$output = array();
138138
parse_str( $parse_url['query'], $output );
139139
$id = $output['v'];
140-
$iframe = '<iframe width="' . $width . '" height="' . $height . '" src="http://www.youtube.com/embed/' . $id . '" frameborder="0" allowfullscreen></iframe>';
140+
$iframe = '<iframe width="' . $width . '" height="' . $height . '" src="https://www.youtube.com/embed/' . $id . '" frameborder="0" allowfullscreen></iframe>';
141141
return $iframe;
142142
}
143143
if ( strstr( $url, 'youtu.be' ) ) {
144144
$parse_url = parse_url( $url );
145145
$id = array_pop( explode( '/', $parse_url ) );
146-
$iframe = '<iframe width="' . $width . '" height="' . $height . '" src="http://www.youtube.com/embed/' . $id . '" frameborder="0" allowfullscreen></iframe>';
146+
$iframe = '<iframe width="' . $width . '" height="' . $height . '" src="https://www.youtube.com/embed/' . $id . '" frameborder="0" allowfullscreen></iframe>';
147147
return $iframe;
148148
}
149149
if ( strstr( $url, 'vimeo' ) ) {
150150
if ( ! empty( $url ) ) {
151151
$id = array_pop( explode( '/', $url ) );
152-
$iframe = '<iframe src="http://player.vimeo.com/video/' . $id . '" width="' . $width . '" height="' . $height . '" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
152+
$iframe = '<iframe src="https://player.vimeo.com/video/' . $id . '" width="' . $width . '" height="' . $height . '" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
153153
return $iframe;
154154
}
155155
}
@@ -183,14 +183,14 @@ public static function get_video_thumb( $url, $size = 'full' ) {
183183
parse_str( $parse_url['query'] );
184184
$id = $v;
185185
$def_size = ( $size == 'small' ) ? 1 : 0;
186-
$thumb = 'http://img.youtube.com/vi/' . $id . '/' . $def_size . '.jpg';
186+
$thumb = 'https://img.youtube.com/vi/' . $id . '/' . $def_size . '.jpg';
187187
return $thumb;
188188
}
189189
if ( strstr( $url, 'youtu.be' ) ) {
190190
$parse_url = parse_url( $url );
191191
$id = array_pop( explode( '/', $parse_url ) );
192192
$def_size = ( $size == 'small' ) ? 1 : 0;
193-
$thumb = 'http://img.youtube.com/vi/' . $id . '/' . $def_size . '.jpg';
193+
$thumb = 'https://img.youtube.com/vi/' . $id . '/' . $def_size . '.jpg';
194194
return $thumb;
195195
}
196196
if ( strstr( $url, 'vimeo' ) ) {
@@ -199,7 +199,7 @@ public static function get_video_thumb( $url, $size = 'full' ) {
199199
if ( false === ( $thumb = get_transient( 'vimeo_' . $id ) ) ) {
200200
$id = array_pop( explode( '/', $url ) );
201201
$request = new WP_Http();
202-
$result = $request->request( 'http://vimeo.com/api/v2/video/' . $id . '.php', $args );
202+
$result = $request->request( 'https://vimeo.com/api/v2/video/' . $id . '.php', $args );
203203
if ( ! is_wp_error( $result ) ) {
204204
$body = maybe_unserialize( $result['body'] );
205205
if ( $size == 'medium' ) {

template-no-sidebar.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
get_header();
55
the_post();
6-
$post_format = get_post_format();
76
?>
87
<section class="main-content">
98
<header class="single-header">

0 commit comments

Comments
 (0)