当我将我的功能添加到functions.php时,wp-admin仅显示白屏

时间:2015-12-05 09:57:09

标签: wordpress function

您好我有小问题,我尝试做自定义分页,但是当我将我的功能添加到functions.php管理页面变白时,奇怪的是我的朋友计算机管理页面工作的但是当他试图保存时他还有白屏

    function custom_pagination($numpages='', $pagerange='', $paged='') {

  if (empty($pagerange)) {
    $pagerange = 2;
  }

  global $paged;
  if (empty($paged)) {
    $paged = 1;
  }

  if ($numpages == '') {
    global $wp_query;
    $numpages = $wp_query->max_num_pages;
        if(!$numpages) {
            $numpages = 1;
        }
  }

  $pagination_args = array(
    'base'            => get_pagenum_link(1) . '%_%',
    'format'          => 'page/%#%/',
    '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) {
    $showpagination = "";
    $showpagination .= "<nav class='custom-pagination'>";
     // echo "<span class='page-numbers page-num'>Page " . $paged . " of " . $numpages . "</span> ";
    $showpagination .= $paginate_links;
    $showpagination .= "</nav>";
  }else{
     $showpagination = "";
  }

  return $showpagination;

}

1 个答案:

答案 0 :(得分:0)

您在<?php?>之外还有一些额外的空格。检查文件末尾是否有空格。

否则,在<?php之前或任何?>之后检查空格