-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.php
More file actions
60 lines (38 loc) · 1.33 KB
/
functions.php
File metadata and controls
60 lines (38 loc) · 1.33 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
50
51
52
53
54
55
56
57
58
59
60
<?php
//! All Default Functions:
include_once('inc/default.php');
//! All Enqueue Functions:
include_once('inc/enqueue.php');
//! All Customize Register Functions:
include_once('inc/customize_register.php');
//! Menu Register Functions:
include_once('inc/menu_register.php');
//! Menu Register Functions:
include_once('inc/menu_register.php');
//! Sidebar Widget Register:
include_once('inc/widget_register.php');
//! Custom Posts Register:
include_once('inc/custom_post.php');
//! Shortcode:
include_once('inc/shortcode.php');
function load_more_posts_ajax() {
$paged = isset($_POST['page']) ? intval($_POST['page']) : 1;
$args = array(
'post_type' => 'post',
'posts_per_page' => 3,
'paged' => $paged,
);
$query = new WP_Query($args);
if ($query->have_posts()) :
while ($query->have_posts()) : $query->the_post(); ?>
<div class="single-post">
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<p><?php the_excerpt(); ?></p>
</div>
<?php endwhile;
endif;
wp_reset_postdata();
wp_die();
}
add_action('wp_ajax_load_more_posts', 'load_more_posts_ajax');
add_action('wp_ajax_nopriv_load_more_posts', 'load_more_posts_ajax');