Skip to content

Commit 1278db1

Browse files
committed
new patch -> allow users choose to display lists
1 parent 85a66ec commit 1278db1

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

display-medium-posts.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ function run_display_medium_posts() {
7676

7777
// Example 1 : WP Shortcode to display form on any page or post.
7878
function posts_display($atts){
79-
$a = shortcode_atts(array('handle'=>'-1', 'default_image'=>'http://i.imgur.com/p4juyuT.png', 'display' => 3, 'offset' => 0, 'total' => 10), $atts);
79+
$a = shortcode_atts(array('handle'=>'-1', 'default_image'=>'http://i.imgur.com/p4juyuT.png', 'display' => 3, 'offset' => 0, 'total' => 10, 'list' => false), $atts);
8080
// No ID value
8181
if(strcmp($a['handle'], '-1') == 0){
8282
return "";
@@ -86,6 +86,7 @@ function posts_display($atts){
8686
$display = $a['display'];
8787
$offset = $a['offset'];
8888
$total = $a['total'];
89+
$list = $a['list'];
8990

9091
$data = file_get_contents("https://medium.com/".$handle."/latest?format=json");
9192
$data = str_replace("])}while(1);</x>", "", $data);
@@ -151,8 +152,12 @@ function initializeOwl(count) {
151152
});
152153
}
153154
</script>
154-
<script>initializeOwl(<?php echo $display; ?>);</script>
155-
155+
<?php
156+
if(!$list)
157+
{
158+
echo '<script>initializeOwl(<?php echo $display; ?>);</script>';
159+
}
160+
?>
156161
<?php
157162
}
158163
add_shortcode('display_medium_posts', 'posts_display');

0 commit comments

Comments
 (0)