当前位置: 首页>>代码示例>>PHP>>正文


PHP p_link函数代码示例

本文整理汇总了PHP中p_link函数的典型用法代码示例。如果您正苦于以下问题:PHP p_link函数的具体用法?PHP p_link怎么用?PHP p_link使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了p_link函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: pagenavi

function pagenavi($p = 5)
{
    if (is_singular()) {
        return;
    }
    global $wp_query, $paged;
    $max_page = $wp_query->max_num_pages;
    if ($max_page == 1) {
        return;
    }
    echo '<ol class="page-navigator">';
    if (empty($paged)) {
        $paged = 1;
    }
    if ($paged > 1) {
        p_link($paged - 1, '&laquo; Previous', '&laquo; Previous');
    }
    if ($paged > $p + 2) {
        echo '<li><span>...</span></li>';
    }
    for ($i = $paged - $p; $i <= $paged + $p; $i++) {
        if ($i > 0 && $i <= $max_page) {
            $i == $paged ? print "<li class='current'><span>{$i}</span></li>" : p_link($i);
        }
    }
    if ($paged < $max_page - $p - 1) {
        echo '<li><span>...</span></li>';
    }
    if ($paged < $max_page) {
        p_link($paged + 1, 'Next &raquo;', 'Next &raquo;');
    }
    echo '</ol>';
}
开发者ID:FateStayNight,项目名称:maupassant,代码行数:33,代码来源:functions.php

示例2: foundation_pagination

/**
 *
 * @param int $p The number of page items to display before and after the current page
 * @param bool $return Whether to return or echo the page
 * @return null|string
 */
function foundation_pagination($p = 2, $return = false)
{
    $output = '';
    if (is_singular()) {
        return null;
    }
    global $wp_query, $paged;
    $max_page = $wp_query->max_num_pages;
    if ($max_page == 1) {
        return null;
    }
    if (empty($paged)) {
        $paged = 1;
    }
    if ($paged > 1) {
        $output .= p_link($paged - 1, 'previous');
    }
    if ($paged > $p + 1) {
        $output .= p_link(1, 'first');
    }
    if ($paged > $p + 2) {
        $output .= '<li class="unavailable" aria-disabled="true"><a href="#">&hellip;</a></li>';
    }
    for ($i = $paged - $p; $i <= $paged + $p; $i++) {
        // Middle pages
        if ($i == 1) {
            $rel = 'rel="first"';
        } elseif ($i == $max_page) {
            $rel = 'rel="last"';
        } else {
            $rel = '';
        }
        if ($i > 0 && $i <= $max_page) {
            $i == $paged ? $output .= "<li class='current' {$rel}><a href='#'>{$i}</a></li> " : ($output .= p_link($i));
        }
    }
    if ($paged < $max_page - $p - 1) {
        $output .= '<li class="unavailable" aria-disabled="true"><a href="#">&hellip;</a></li>';
    }
    if ($paged < $max_page - $p) {
        $output .= p_link($max_page, 'last');
    }
    if ($paged < $max_page) {
        $output .= p_link($paged + 1, 'next');
    }
    if (!empty($output)) {
        $output = '<ul class="pagination" role="navigation" aria-label="Pagination">' . $output . '</ul>';
    }
    if ($return) {
        return $output;
    } else {
        echo $output;
    }
}
开发者ID:BrownBox,项目名称:diana,代码行数:60,代码来源:pagination.php

示例3: pagenavi

function pagenavi($before = '', $after = '', $p = 2)
{
    if (is_singular()) {
        return;
    }
    global $wp_query, $paged;
    $max_page = $wp_query->max_num_pages;
    if ($max_page == 1) {
        return;
    }
    if (empty($paged)) {
        $paged = 1;
    }
    if ($paged > 1) {
        p_link($paged - 1, '上一页', '&laquo');
    } else {
        print '<li class="am-disabled"><a href="#">&laquo;</a></li>';
    }
    if ($paged > $p + 1) {
        p_link(1, 'First Page');
    }
    if ($paged > $p + 2) {
        echo '... ';
    }
    for ($i = $paged - $p; $i <= $paged + $p; $i++) {
        if ($i > 0 && $i <= $max_page) {
            $i == $paged ? print "<li class='am-active'><a href='#'>{$i}</a></li>" : p_link($i);
        }
    }
    if ($paged < $max_page - $p - 1) {
        echo '... ';
    }
    if ($paged < $max_page - $p) {
        p_link($max_page, '尾页');
    }
    if ($paged < $max_page) {
        p_link($paged + 1, '下一页', '&raquo;');
    } else {
        print '<li class="am-disabled"><a href="#">&raquo;</a></li>';
    }
    //echo '</div>'.$after."\n";
}
开发者ID:xstone,项目名称:srdp,代码行数:42,代码来源:functions.php

示例4: pagenavi

function pagenavi($before = '', $after = '', $p = 3)
{
    if (is_singular()) {
        return;
    }
    global $wp_query, $paged;
    $max_page = $wp_query->max_num_pages;
    if ($max_page == 1) {
        return;
    }
    if (empty($paged)) {
        $paged = 1;
    }
    echo $before . '<div id="pagenavi">' . "\n";
    echo '<span class="pages">第' . $paged . '页 共' . $max_page . '页</span>';
    if ($paged > 1) {
        p_link($paged - 1, '上一页', '上一页');
    }
    if ($paged > $p + 1) {
        p_link(1, '第一页');
    }
    if ($paged > $p + 2) {
        echo '<span class="pages">...</span>';
    }
    for ($i = $paged - $p; $i <= $paged + $p; $i++) {
        if ($i > 0 && $i <= $max_page) {
            $i == $paged ? print "<span class='page-numbers current'>{$i}</span>" : p_link($i);
        }
    }
    if ($paged < $max_page - $p - 1) {
        echo '<span class="pages">...</span>';
    }
    if ($paged < $max_page - $p) {
        p_link($max_page, '最后一页');
    }
    if ($paged < $max_page) {
        p_link($paged + 1, '下一页', '下一页');
    }
    echo '</div>' . $after . "\n";
}
开发者ID:areszn,项目名称:wordpress,代码行数:40,代码来源:pagenavi.php

示例5: pagenavi

function pagenavi($p = 2)
{
    if (is_singular()) {
        return;
    }
    global $wp_query, $paged;
    $max_page = $wp_query->max_num_pages;
    if ($max_page == 1) {
        return;
    }
    if (empty($paged)) {
        $paged = 1;
    }
    echo '<span class="page-numbers">' . $paged . ' / ' . $max_page . ' </span> ';
    if ($paged > 1) {
        p_link($paged - 1, '上一页', '上一页');
    }
    if ($paged > $p + 1) {
        p_link(1, '最前页');
    }
    if ($paged > $p + 2) {
        echo '<span class="page-numbers">...</span>';
    }
    for ($i = $paged - $p; $i <= $paged + $p; $i++) {
        if ($i > 0 && $i <= $max_page) {
            $i == $paged ? print "<span class='page-numbers current'>{$i}</span> " : p_link($i);
        }
    }
    if ($paged < $max_page - $p - 1) {
        echo '<span class="page-numbers">...</span>';
    }
    if ($paged < $max_page - $p) {
        p_link($max_page, '最末页');
    }
    if ($paged < $max_page) {
        p_link($paged + 1, '下一页', '下一页');
    }
}
开发者ID:surmon-china,项目名称:Wordpress_Theme_Think,代码行数:38,代码来源:functions.php

示例6: pagenavi

function pagenavi($before = '', $after = '', $p = 2)
{
    if (is_singular()) {
        return;
    }
    global $wp_query, $paged;
    $max_page = $wp_query->max_num_pages;
    if ($max_page == 1) {
        return;
    }
    if (empty($paged)) {
        $paged = 1;
    }
    // $before = "<span class='pg-item'><a href='".esc_html( get_pagenum_link( $i ) )."'>{$i}</a></span>";
    echo $before;
    if ($paged > 1) {
        p_link($paged - 1, '上一页', '<span class="pg-item pg-nav-item pg-prev">', '上一页');
    }
    if ($paged > $p + 1) {
        p_link(1, '首页', '<span class="pg-item">', 1);
    }
    for ($i = $paged - $p; $i <= $paged + $p; $i++) {
        if ($i > 0 && $i <= $max_page) {
            $i == $paged ? print "<span class='pg-item pg-item-current'><span class='current'>{$i}</span></span>" : p_link($i, '', '<span class="pg-item">', $i);
        }
    }
    if ($paged < $max_page - $p) {
        p_link($max_page, __('末页', 'tinection'), '<span class="pg-item"> ... </span><span class="pg-item">', $max_page);
    }
    if ($paged < $max_page) {
        p_link($paged + 1, __('下一页', 'tinection'), '<span class="pg-item pg-nav-item pg-next">', __('下一页', 'tinection'));
    }
    echo $after;
}
开发者ID:jackycgq,项目名称:tinection-pro,代码行数:34,代码来源:functions.php

示例7: deel_paging

 function deel_paging()
 {
     $p = 4;
     if (is_singular()) {
         return;
     }
     global $wp_query, $paged;
     $max_page = $wp_query->max_num_pages;
     if ($max_page == 1) {
         return;
     }
     echo '<div class="pagination"><ul>';
     if (empty($paged)) {
         $paged = 1;
     }
     // echo '<span class="pages">Page: ' . $paged . ' of ' . $max_page . ' </span> ';
     echo '<li class="prev-page">';
     previous_posts_link('上一页');
     echo '</li>';
     if ($paged > $p + 1) {
         p_link(1, '<li>第一页</li>');
     }
     if ($paged > $p + 2) {
         echo "<li><span>···</span></li>";
     }
     for ($i = $paged - $p; $i <= $paged + $p; $i++) {
         if ($i > 0 && $i <= $max_page) {
             $i == $paged ? print "<li class=\"active\"><span>{$i}</span></li>" : p_link($i);
         }
     }
     if ($paged < $max_page - $p - 1) {
         echo "<li><span> ... </span></li>";
     }
     //if ( $paged < $max_page - $p ) p_link( $max_page, '&raquo;' );
     echo '<li class="next-page">';
     next_posts_link('下一页');
     echo '</li>';
     // echo '<li><span>共 '.$max_page.' 页</span></li>';
     echo '</ul></div>';
 }
开发者ID:dfc643,项目名称:ARCHIVE-2014-wordpress-theme-backup,代码行数:40,代码来源:functions.php

示例8: hui_paging

 function hui_paging()
 {
     $p = 3;
     if (is_singular()) {
         return;
     }
     global $wp_query, $paged;
     $max_page = $wp_query->max_num_pages;
     if ($max_page == 1) {
         return;
     }
     echo '<div class="pagination' . (_hui('paging_type') == 'multi' ? ' pagination-multi' : '') . '"><ul>';
     if (empty($paged)) {
         $paged = 1;
     }
     if (_hui('paging_type') == 'multi' && $paged !== 1) {
         p_link(0);
     }
     // echo '<span class="pages">Page: ' . $paged . ' of ' . $max_page . ' </span> ';
     echo '<li class="prev-page">';
     previous_posts_link(__('上一页', 'haoui'));
     echo '</li>';
     if (_hui('paging_type') == 'multi') {
         if ($paged > $p + 1) {
             p_link(1, '<li>' . __('第一页', 'haoui') . '</li>');
         }
         if ($paged > $p + 2) {
             echo "<li><span>···</span></li>";
         }
         for ($i = $paged - $p; $i <= $paged + $p; $i++) {
             if ($i > 0 && $i <= $max_page) {
                 $i == $paged ? print "<li class=\"active\"><span>{$i}</span></li>" : p_link($i);
             }
         }
         if ($paged < $max_page - $p - 1) {
             echo "<li><span> ... </span></li>";
         }
     }
     //if ( $paged < $max_page - $p ) p_link( $max_page, '&raquo;' );
     echo '<li class="next-page">';
     next_posts_link(__('下一页', 'haoui'));
     echo '</li>';
     if (_hui('paging_type') == 'multi' && $paged < $max_page) {
         p_link($max_page, '', 1);
     }
     if (_hui('paging_type') == 'multi') {
         echo '<li><span>' . __('共', 'haoui') . ' ' . $max_page . ' ' . __('页', 'haoui') . '</span></li>';
     }
     echo '</ul></div>';
 }
开发者ID:yszar,项目名称:linuxwp,代码行数:50,代码来源:functions.xiu.php

示例9: pagenavi

function pagenavi($before = '', $after = '', $p = 2)
{
    // 取當前頁前後各 2 頁
    if (is_singular()) {
        return;
    }
    // 文章與插頁不用
    global $wp_query, $paged;
    $max_page = $wp_query->max_num_pages;
    if ($max_page == 1) {
        return;
    }
    // 只有一頁不用
    if (empty($paged)) {
        $paged = 1;
    }
    echo $before . '<div id="pagenavi">' . "\n";
    echo '<span class="pages">Page: ' . $paged . ' of ' . $max_page . ' </span>';
    // 頁數
    if ($paged > 1) {
        p_link($paged - 1, 'Previous Page', '«');
    }
    /* 如果当前页大于1就显示上一页链接 */
    if ($paged > $p + 1) {
        p_link(1, 'First Page');
    }
    if ($paged > $p + 2) {
        echo '... ';
    }
    for ($i = $paged - $p; $i <= $paged + $p; $i++) {
        // 中間頁
        if ($i > 0 && $i <= $max_page) {
            $i == $paged ? print "<span class='page-numbers current'>{$i}</span>" : p_link($i);
        }
    }
    if ($paged < $max_page - $p - 1) {
        echo '... ';
    }
    if ($paged < $max_page - $p) {
        p_link($max_page, 'Last Page');
    }
    if ($paged < $max_page) {
        p_link($paged + 1, 'Next Page', '»');
    }
    /* 如果当前页不是最后一页显示下一页链接 */
    echo '</div>' . $after . "\n";
}
开发者ID:shuaica,项目名称:97world_GWhite,代码行数:47,代码来源:functions.php

示例10: pagenavi

function pagenavi($p = 2)
{
    if (is_singular()) {
        return;
    }
    global $wp_query, $paged;
    $max_page = $wp_query->max_num_pages;
    if ($max_page == 1) {
        echo '<style>pagebar{display:none;}</style>';
        return;
    }
    if (empty($paged)) {
        $paged = 1;
        print "<li >Back</li> ";
    }
    if ($paged > 1) {
        p_link($paged - 1, 'Back', 'Back');
    }
    if ($paged > $p + 1) {
        p_link(1, 'First');
    }
    if ($paged > $p + 2) {
        echo '<li>...</li>';
    }
    for ($i = $paged - $p; $i <= $paged + $p; $i++) {
        if ($i > 0 && $i <= $max_page) {
            $i == $paged ? print " <li >{$i}</li> " : p_link($i);
        }
    }
    if ($paged < $max_page - $p - 1) {
        echo '<li >...</li>';
    }
    if ($paged < $max_page - $p) {
        p_link($max_page, ' Last');
    }
    if ($paged < $max_page) {
        p_link($paged + 1, ' Next', 'Next');
    }
}
开发者ID:teshna01,项目名称:gulzar,代码行数:39,代码来源:functions.php

示例11: pagenavi

function pagenavi($p = 2)
{
    // pages will be show before and after current page
    if (is_singular()) {
        return;
    }
    // don't show in single page
    global $wp_query, $paged;
    $max_page = $wp_query->max_num_pages;
    if ($max_page == 1) {
        return;
    }
    // don't show when only one page
    if (empty($paged)) {
        $paged = 1;
    }
    // echo '<span class="pages">Page: ' . $paged . ' of ' . $max_page . ' </span> '; // pages
    if ($paged > $p + 1) {
        p_link(1, 'First');
    }
    if ($paged > $p + 2) {
        echo '... ';
    }
    for ($i = $paged - $p; $i <= $paged + $p; $i++) {
        // Middle pages
        if ($i > 0 && $i <= $max_page) {
            $i == $paged ? print "<span class='page-numbers current'>{$i}</span><span class='separator'>|</span>" : p_link($i);
        }
    }
    if ($paged < $max_page - $p - 1) {
        echo '... ';
    }
    if ($paged < $max_page - $p) {
        p_link($max_page, 'Last');
    }
}
开发者ID:ApartmentDigital,项目名称:Neon-Dinosaur,代码行数:36,代码来源:functions.php

示例12: bropaul_pagination

function bropaul_pagination($p = 2)
{
    if (is_singular()) {
        return;
    }
    global $wp_query, $paged;
    $max_page = $wp_query->max_num_pages;
    if ($max_page == 1) {
        return;
    }
    if (empty($paged)) {
        $paged = 1;
    }
    echo '<div class="pagination"><span class="page-numbers page-count">' . $paged . ' / ' . $max_page . ' </span> ';
    if ($paged > $p + 1) {
        p_link(1, '最前页', '&laquo;');
    }
    if ($paged > 1) {
        p_link($paged - 1, '上一页', '&lsaquo;');
    }
    if ($paged > $p + 2) {
        echo '<a>...</a>';
    }
    for ($i = $paged - $p; $i <= $paged + $p; $i++) {
        if ($i > 0 && $i <= $max_page) {
            $i == $paged ? print "<span class='page-numbers current'>{$i}</span> " : p_link($i);
        }
    }
    if ($paged < $max_page - $p - 1) {
        echo '<span class="page-numbers">...</span>';
    }
    if ($paged < $max_page) {
        p_link($paged + 1, '下一页', '&rsaquo;');
    }
    if ($paged < $max_page - $p) {
        p_link($max_page, '最末页', '&raquo;');
    }
    // echo '<span>共['.$max_page.']页</span>';
    echo '</div>';
}
开发者ID:pemiu01,项目名称:biopaul,代码行数:40,代码来源:functions.php

示例13: bymt_pagenav

function bymt_pagenav($onlynext = 'no', $p = 3)
{
    if (wp_is_mobile()) {
        $p = 2;
    }
    global $wp_query, $paged;
    $max_page = $wp_query->max_num_pages;
    if (empty($paged)) {
        $paged = 1;
    }
    if ($max_page == 1 || is_singular()) {
        return;
    } elseif ($onlynext == 'yes') {
        if ($paged < $max_page) {
            p_link($paged + 1, '下页', '下页', 'page_next', 'next');
        }
    } else {
        echo "<div class=\"pagination\">\n";
        if ($paged > 1) {
            p_link($paged - 1, '上页', '上页', 'page_previous', 'prev');
        }
        if ($paged > $p + 1) {
            p_link(1, '首页', '', '', 'first');
        }
        if ($paged > $p + 2) {
            echo '<span class="page-numbers">···</span>';
        }
        for ($i = $paged - $p; $i <= $paged + $p; $i++) {
            if ($i > 0 && $i <= $max_page) {
                $i == $paged ? print "<span class='page-numbers current'>{$i}</span> " : p_link($i);
            }
        }
        if ($paged < $max_page - $p - 1) {
            echo '<span class="page-numbers">···</span>';
        }
        if ($paged < $max_page - $p) {
            p_link($max_page, '末页', '', '', 'last');
        }
        if ($paged < $max_page) {
            p_link($paged + 1, '下页', '下页', 'page_next', 'next');
        }
        echo "</div>\n";
    }
}
开发者ID:wdq233,项目名称:BYMT2,代码行数:44,代码来源:functions.php

示例14: pagenavi

 function pagenavi($p = 2)
 {
     // 取当前页前后各 2 页
     if (is_singular()) {
         return;
     }
     // 文章与插页不用
     global $wp_query, $paged;
     $max_page = $wp_query->max_num_pages;
     if ($max_page == 1) {
         return;
     }
     // 只有一页不用
     if (empty($paged)) {
         $paged = 1;
     }
     echo '<span class="page-numbers page-count">' . $paged . '/' . $max_page . ' </span> ';
     // 显示页数
     if ($paged > $p + 1) {
         p_link(1, '最前页', '«');
     }
     if ($paged > 1) {
         p_link($paged - 1, '上一页', '‹');
     }
     /* 如果当前页大于1就显示上一页链接 */
     if ($paged > $p + 2) {
         echo '... ';
     }
     for ($i = $paged - $p; $i <= $paged + $p; $i++) {
         // 中间页
         if ($i > 0 && $i <= $max_page) {
             $i == $paged ? print "<span class='page-numbers current'>{$i}</span> " : p_link($i);
         }
     }
     if ($paged < $max_page - $p - 1) {
         echo '<span class="page-numbers">...</span>';
     }
     if ($paged < $max_page) {
         p_link($paged + 1, '下一页', '›');
     }
     /* 如果当前页不是最后一页显示下一页链接 */
     if ($paged < $max_page - $p) {
         p_link($max_page, '最后页', '»');
     }
 }
开发者ID:leon0407,项目名称:xiangrenya.com,代码行数:45,代码来源:functions.php

示例15: van_pagenavi

function van_pagenavi($p = 5)
{
    if (is_singular()) {
        return;
    }
    global $wp_query, $paged;
    $max_page = $wp_query->max_num_pages;
    if ($max_page == 1) {
        return;
    }
    if (empty($paged)) {
        $paged = 1;
    }
    echo '<div class="van-pagenavi">';
    //if ( $paged > 1 )  posts_nav_link('','','&laquo; Previous');
    if ($paged > $p + 1) {
        p_link(1, 'Oldest');
    }
    if ($paged > $p + 2) {
        echo '<em>...</em>';
    }
    for ($i = $paged - $p; $i <= $paged + $p; $i++) {
        if ($i > 0 && $i <= $max_page) {
            $i == $paged ? print "<span class='current'>{$i}</span> " : p_link($i);
        }
    }
    if ($paged < $max_page - $p - 1) {
        $return_navi .= '<em>...</em>';
    }
    if ($paged < $max_page - $p) {
        p_link($max_page, 'Newest');
    }
    //if ( $paged < $max_page ) posts_nav_link('','','Next &raquo;');
    echo '</div>';
}
开发者ID:m-godefroid76,项目名称:devrestofactory,代码行数:35,代码来源:common-functions.php


注:本文中的p_link函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。