はこのエラーを取得この
<div class="eventssec hidden-xs hidden-sm">
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$type = 'posts';
$args=array(
'post_type' => $type,
'posts_per_page'=>4,
'caller_get_posts'=>1,
'paged' => $paged,
'order'=>'asc'
);
$my_query = new WP_Query($args);
$i=0;
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<div class="events">
<figure>
<?php
$image = get_field('image');
if(!empty($image)): ?>
<img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" />
<?php endif; ?>
</figure>
<div class="desctext">
<h2><?php the_field('name'); ?></h2>
<p><?php the_field('designition'); ?></p>
<p><?php the_field('emp-id'); ?></p>
</div>
</div>
<?php $i++; endwhile;
my_custom_pagination($my_query->max_num_pages, "", $paged);
wp_reset_query(); ?>
</div>
<?php
function my_custom_pagination($numpages = '', $pagerange = '', $paged = '', $search = false) {
if (empty($pagerange)) {
$pagerange = 2;
}
/**
* This first part of our function is a fallback
* for custom pagination inside a regular loop that
* uses the global $paged and global $wp_query variables.
*
* It's good because we can now override default pagination
* in our theme, and use this function in default queries
* and custom queries.
*/
global $paged;
if (empty($paged)) {
$paged = 1;
}
if ($numpages == '') {
global $wp_query;
$numpages = $wp_query->max_num_pages;
if (!$numpages) {
$numpages = 1;
}
}
if ($search) {
$format = '&paged=%#%';
} else {
$format = 'page/%#%';
}
/**
* We construct the pagination arguments to enter into our paginate_links
* function.
*/
$pagination_args = array(
'base' => get_pagenum_link(1) . '%_%',
'format' => $format,
// 'format' => '&paged=%#%',
'total' => $numpages,
'current' => $paged,
'show_all' => False,
'end_size' => 1,
'mid_size' => $pagerange,
'prev_next' => True,
'prev_text' => __('«'),
'next_text' => __('»'),
'type' => 'plain',
'add_args' => false,
'add_fragment' => ''
);
$paginate_links = paginate_links($pagination_args);
if ($paginate_links) {
echo "<nav class='custom-pagination'>";
//echo "<span class='page-numbers page-num'>Page " . $paged . " of " . $numpages . "</span> ";
echo $paginate_links;
echo "</nav>";
}
}
をお試しください:
は、ここに私のコードです。致命的なエラー:D:\ xampp \ htdocs \ velma \ wp-content \ themes \ velma \ page-templates \ sub_committee.phpの88行目にある未定義の関数my_custom_pagination()を呼び出してください –
ここからmy_custom_pagination関数を切り取り、 function.php 最後に定義した –
恐ろしい!それは働いている!ありがとう –