post-list-load-more.php
1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
// Create id attribute allowing for custom "anchor" value.
$id = 'news-and-stories-' . $block['id'] . rand(0,100);
if( !empty($block['anchor']) ) {
$id = $block['anchor'];
}
// Create class attribute allowing for custom "className" and "align" values.
$className = 'news-and-stories-block';
$className .= ' ' .get_field('style');
if( !empty($block['className']) ) {
$className .= ' ' . $block['className'];
}
$categories = get_field('categories')?:null;
if(!$categories) {
$categories = [];
}
$pattern = get_field('layout_pattern') ?: null;
$no_load_more = get_field('static_no_load_more') ?: null;
$static_limit = get_field('static_limit') ?: 4;
$link_out = get_field('link_out_button')?: null;
?>
<div data-lang="<?= get_locale() ?>" data-static-limit="<?= $static_limit ?>" data-published="<?= __("Published:", 'msf') ?>" data-updated="<?= __("Updated:", 'msf') ?>" data-no-load="<?= $no_load_more ?>" class="<?= $className ?>" id='<?= $id ?>' data-pattern="<?= $pattern ?>" data-categories='<?= implode(",",$categories) ?>'>
<div class='post-list-left-col'>
</div>
<div class='post-list-right-col'>
</div>
<div class='mobile-article-list'>
</div>
<?php if($link_out) {?>
<a class='load-more-link-out btn' href='<?= $link_out['url'] ?>' target="<?= $link_out['target'] ?>" >
<?= $link_out['title'] ?>
</a>
<?php } ?>
<?php if(!$no_load_more && !$link_out) { ?>
<button data-segment="1" class='post-list-load-more'><span class='loaded-text'><?= get_field('load_more_button_text') ?></span>
<div class="spinner-border" role="status">
<span class="sr-only"><?= __("Loading...", 'msf') ?></span>
</div>
</button>
<?php } ?>
</div>