本文整理汇总了PHP中wp_list_bookmarks函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_list_bookmarks函数的具体用法?PHP wp_list_bookmarks怎么用?PHP wp_list_bookmarks使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_list_bookmarks函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: widget
/**
* Outputs the content for the current Links widget instance.
*
* @since 2.8.0
* @access public
*
* @param array $args Display arguments including 'before_title', 'after_title',
* 'before_widget', and 'after_widget'.
* @param array $instance Settings for the current Links widget instance.
*/
public function widget($args, $instance)
{
$show_description = isset($instance['description']) ? $instance['description'] : false;
$show_name = isset($instance['name']) ? $instance['name'] : false;
$show_rating = isset($instance['rating']) ? $instance['rating'] : false;
$show_images = isset($instance['images']) ? $instance['images'] : true;
$category = isset($instance['category']) ? $instance['category'] : false;
$orderby = isset($instance['orderby']) ? $instance['orderby'] : 'name';
$order = $orderby == 'rating' ? 'DESC' : 'ASC';
$limit = isset($instance['limit']) ? $instance['limit'] : -1;
$before_widget = preg_replace('/id="[^"]*"/', 'id="%id"', $args['before_widget']);
$widget_links_args = array('title_before' => $args['before_title'], 'title_after' => $args['after_title'], 'category_before' => $before_widget, 'category_after' => $args['after_widget'], 'show_images' => $show_images, 'show_description' => $show_description, 'show_name' => $show_name, 'show_rating' => $show_rating, 'category' => $category, 'class' => 'linkcat widget', 'orderby' => $orderby, 'order' => $order, 'limit' => $limit);
/**
* Filters the arguments for the Links widget.
*
* @since 2.6.0
* @since 4.4.0 The `$instance` parameter was added.
*
* @see wp_list_bookmarks()
*
* @param array $widget_links_args An array of arguments to retrieve the links list.
* @param array $instance The settings for the particular instance of the widget.
*/
wp_list_bookmarks(apply_filters('widget_links_args', $widget_links_args, $instance));
}
示例2: master_array
/**
*
* @TODO document
*
*/
function master_array()
{
$left = sprintf('<div class="widget"><div class="widget-pad"><h3 class="widget-title">%s</h3><p>%s</p>%s<br class="clear"/><p>%s</p></div></div>', __('Looking for something?', 'pagelines'), __('Use the form below to search the site:', 'pagelines'), pagelines_search_form(false), __("Still not finding what you're looking for? Drop us a note so we can take care of it!", 'pagelines'));
$middle = sprintf('<div class="widget"><div class="widget-pad"><h3 class="widget-title">%s</h3><p>%s</p><ul>%s</ul></div></div>', __('Visit our friends!', 'pagelines'), __('A few highly recommended friends...', 'pagelines'), wp_list_bookmarks('title_li=&categorize=0&echo=0'));
$right = sprintf('<div class="widget"><div class="widget-pad"><h3 class="widget-title">%s</h3><p>%s</p><ul>%s</ul></div></div>', __('Archives', 'pagelines'), __('All entries, chronologically...', 'pagelines'), wp_get_archives('type=monthly&limit=12&echo=0'));
$this->master = array('left' => array('name' => 'MoreFoot Left', 'description' => __('Left sidebar in morefoot section.', 'pagelines'), 'default' => $left), 'middle' => array('name' => 'MoreFoot Middle', 'description' => __('Middle sidebar in morefoot section.', 'pagelines'), 'default' => $middle), 'right' => array('name' => 'MoreFoot Right', 'description' => __('Right sidebar in morefoot section.', 'pagelines'), 'default' => $right));
}
示例3: render
function render($args, $instance)
{
global $gantry, $post;
ob_start();
$show_description = $instance['description'];
$show_name = $instance['name'];
$show_rating = $instance['rating'];
$show_images = $instance['images'];
$catid = get_term_by('slug', $instance['category'], 'link_category');
$menu_class = $instance['menu_class'];
if ($menu_class != '') {
$menu_class = $menu_class . ' ';
} else {
$menu_class = '';
}
$links = array();
$links = wp_list_bookmarks(apply_filters('widget_links_args', array('title_before' => $args['before_title'], 'title_after' => $args['after_title'], 'category_before' => '<div class="' . $instance['category_class'] . '">', 'category_after' => '</div>', 'show_images' => $show_images, 'show_description' => $show_description, 'show_name' => $show_name, 'show_rating' => $show_rating, 'category' => $catid->term_id, 'class' => 'linkcat widget', 'category_orderby' => $instance['category_orderby'], 'orderby' => $instance['links_orderby'], 'categorize' => $instance['categorize'], 'title_li' => '', 'limit' => $instance['limit'], 'link_before' => '<span>', 'link_after' => '</span>')));
$links = ob_get_clean();
$lines = explode("\n", $links);
$out = '';
foreach ($lines as $line) {
$line = trim($line);
if (substr($line, 0, 11) == "<ul class='") {
$line = str_replace("<ul class='", "<ul class='" . $menu_class, $line);
}
$out .= $line . "\n";
}
if (!$instance['categorize']) {
echo '<ul class="' . trim($menu_class) . '">';
}
echo $out;
if (!$instance['categorize']) {
echo '</ul>';
}
}
示例4: widget
function widget($args, $instance)
{
extract($args, EXTR_SKIP);
$instance = wp_parse_args((array) $instance, $this->defaults);
if (Footer_Putter_Utils::hide_widget($instance['visibility'])) {
return;
}
//check visibility requirements
$title = apply_filters('widget_title', $instance['title']);
$category = isset($instance['category']) ? $instance['category'] : false;
$orderby = isset($instance['orderby']) ? $instance['orderby'] : 'name';
$order = $orderby == 'rating' ? 'DESC' : 'ASC';
$limit = isset($instance['limit']) && $instance['limit'] ? $instance['limit'] : -1;
$nofollow = isset($instance['nofollow']) && $instance['nofollow'];
$links = wp_list_bookmarks(apply_filters('widget_links_args', array('echo' => 0, 'title_before' => $before_title, 'title_after' => $after_title, 'title_li' => '', 'categorize' => false, 'before' => '', 'after' => '', 'category_before' => '', 'category_after' => '', 'show_images' => true, 'show_description' => false, 'show_name' => false, 'show_rating' => false, 'category' => $category, 'class' => 'trademark widget', 'orderby' => $orderby, 'order' => $order, 'limit' => $limit)));
echo $before_widget;
if ($title) {
echo $before_title . $title . $after_title;
}
if ($nofollow) {
echo $this->nofollow_links($links);
} else {
echo $links;
}
echo $after_widget;
}
示例5: get_friend_links
function get_friend_links($args)
{
extract($args, EXTR_SKIP);
$themePath = get_bloginfo('template_url');
$imageLink = '<h2>Links<span style="display:none">';
$before_widget = preg_replace('/id="[^"]*"/', 'id="%id"', $before_widget);
wp_list_bookmarks(apply_filters('widget_links_args', array('title_before' => $imageLink, 'title_after' => '</span></h2>', 'category_before' => $before_widget, 'category_after' => $after_widget, 'show_images' => true, 'class' => 'linkcat widget')));
}
示例6: widget_wkc_advanced_blogroll
function widget_wkc_advanced_blogroll($args)
{
extract($args);
$options = get_option('widget_wkc_advanced_blogroll');
if (function_exists('wp_list_bookmarks')) {
$param = array('title_before' => $before_title, 'title_after' => $after_title, 'category_before' => $before_widget, 'category_after' => $after_widget, 'orderby' => $options['orderby'], 'category' => $options['category'], 'limit' => $options['limit'], 'show_images' => true, 'class' => 'linkcat widget', 'echo' => 0);
echo wp_list_bookmarks($param);
}
}
示例7: avia_dummy_widget
function avia_dummy_widget($number)
{
switch ($number) {
case 1:
$title = apply_filters('widget_title', __('Interesting links', 'avia_framework'));
?>
<section class='widget'>
<h3 class='widgettitle'><?php
echo $title;
?>
</h3>
<span class='minitext'><?php
_e('Here are some interesting links for you! Enjoy your stay :)', 'avia_framework');
?>
</span>
</section>
<?php
break;
case 4:
$title = apply_filters('widget_title', __('Archive', 'avia_framework'));
echo "<section class='widget widget_archive'>";
echo "<h3 class='widgettitle'>" . $title . "</h3>";
echo "<ul>";
wp_get_archives('type=monthly');
echo "</ul>";
echo "<span class='seperator extralight-border'></span></section>";
break;
case 3:
$title = apply_filters('widget_title', __('Categories', 'avia_framework'));
echo "<section class='widget widget_categories'>";
echo "<h3 class='widgettitle'>" . $title . "</h3>";
echo "<ul>";
wp_list_categories('sort_column=name&optioncount=0&hierarchical=0&title_li=');
echo "</ul>";
echo "<span class='seperator extralight-border'></span></section>";
break;
case 2:
$title = apply_filters('widget_title', __('Pages', 'avia_framework'));
echo "<section class='widget widget_pages'>";
echo "<h3 class='widgettitle'>" . $title . "</h3>";
echo "<ul>";
wp_list_pages('title_li=&depth=-1');
echo "</ul>";
echo "<span class='seperator extralight-border'></span></section>";
break;
case 5:
$title = apply_filters('widget_title', __('Bookmarks', 'avia_framework'));
echo "<section class='widget widget_archive'>";
echo "<h3 class='widgettitle'>" . $title . "</h3>";
echo "<ul>";
wp_list_bookmarks('title_li=&categorize=0');
echo "</ul>";
echo "<span class='seperator extralight-border'></span></section>";
break;
}
}
示例8: links_sidebar_module
function links_sidebar_module($args)
{
extract($args);
echo $before_module . $before_title . $title . $after_title;
?>
<ul>
<?php
wp_list_bookmarks('title_before=<h4>&title_after=</h4>');
?>
</ul>
<?php
echo $after_module;
}
示例9: heidelicious_links
function heidelicious_links($atts)
{
$out = '<div class="bookmarks">';
extract(shortcode_atts(array('limit' => '-1', 'category' => '', 'show_description' => true, 'orderby' => 'name'), $atts));
if ($limit != '-1') {
$orderby = 'rand';
}
$cat = explode(",", $category);
foreach ($cat as $id => $category) {
$out .= wp_list_bookmarks(array('limit' => $limit, 'show_images' => false, 'show_description' => $show_description, 'show_name' => true, 'category_name' => $category, 'orderby' => $orderby, 'order' => 'ASC', 'title_li' => 'Related Links', 'echo' => false));
}
$out .= '</div>';
return $out;
}
示例10: widget
function widget($args, $instance)
{
extract($args, EXTR_SKIP);
$show_description = isset($instance['description']) ? $instance['description'] : false;
$show_name = isset($instance['name']) ? $instance['name'] : false;
$show_rating = isset($instance['rating']) ? $instance['rating'] : false;
$show_images = isset($instance['images']) ? $instance['images'] : true;
$category = isset($instance['category']) ? $instance['category'] : false;
$orderby = isset($instance['orderby']) ? $instance['orderby'] : 'name';
$order = $orderby == 'rating' ? 'DESC' : 'ASC';
$limit = isset($instance['limit']) ? $instance['limit'] : -1;
$before_widget = preg_replace('/id="[^"]*"/', 'id="%id"', $before_widget);
wp_list_bookmarks(apply_filters('widget_links_args', array('title_before' => $before_title, 'title_after' => $after_title, 'category_before' => $before_widget, 'category_after' => $after_widget, 'show_images' => $show_images, 'show_description' => $show_description, 'show_name' => $show_name, 'show_rating' => $show_rating, 'category' => $category, 'class' => 'linkcat widget', 'orderby' => $orderby, 'order' => $order, 'limit' => $limit)));
}
示例11: widget
/**
* Outputs the widget based on the arguments input through the widget controls.
* @since 0.6.0
*/
function widget($args, $instance)
{
extract($args);
/* Set up the $before_widget ID for multiple widgets created by the bookmarks widget. */
if ($instance['categorize']) {
$before_widget = preg_replace('/id="[^"]*"/', 'id="%id"', $before_widget);
}
/* Add a class to $before_widget if one is set. */
if ($instance['class']) {
$before_widget = str_replace('class="', 'class="' . esc_attr($instance['class']) . ' ', $before_widget);
}
/* Set up the arguments for wp_list_bookmarks(). */
$args = array('title_li' => apply_filters('widget_title', $instance['title_li'], $instance, $this->id_base), 'category' => !empty($instance['category']) ? join(', ', $instance['category']) : '', 'exclude_category' => !empty($instance['exclude_category']) ? join(', ', $instance['exclude_category']) : '', 'category_order' => $instance['category_order'], 'category_orderby' => $instance['category_orderby'], 'include' => !empty($instance['include']) ? join(', ', $instance['include']) : '', 'exclude' => !empty($instance['exclude']) ? join(', ', $instance['exclude']) : '', 'order' => $instance['order'], 'orderby' => $instance['orderby'], 'limit' => $instance['limit'] ? intval($instance['limit']) : -1, 'between' => $instance['between'], 'link_before' => $instance['link_before'], 'link_after' => $instance['link_after'], 'search' => $instance['search'], 'categorize' => !empty($instance['categorize']) ? true : false, 'show_description' => !empty($instance['show_description']) ? true : false, 'hide_invisible' => !empty($instance['hide_invisible']) ? true : false, 'show_rating' => !empty($instance['show_rating']) ? true : false, 'show_updated' => !empty($instance['show_updated']) ? true : false, 'show_images' => !empty($instance['show_images']) ? true : false, 'show_name' => !empty($instance['show_name']) ? true : false, 'show_private' => !empty($instance['show_private']) ? true : false, 'title_before' => $before_title, 'title_after' => $after_title, 'category_before' => $before_widget, 'category_after' => $after_widget, 'category_name' => false, 'echo' => false);
/* Output the bookmarks widget. */
echo str_replace(array("\r", "\n", "\t"), '', wp_list_bookmarks($args));
}
示例12: widget_rounded_links
function widget_rounded_links()
{
$a = get_bloginfo('template_directory');
?>
<!-- //start sideitem //--><br /><div class="sideitem"><div class="sideitemtop"><img src="<?php
echo $a;
?>
/img/stl.gif" alt="" width="15" height="15" class="corner" style="display: none" /></div>
<?php
wp_list_bookmarks(array('title_before' => '<h2>', 'title_after' => '</h2>'));
?>
<div class="sideitembottom"><img src="<?php
echo $a;
?>
/img/sbl.gif" alt="" width="15" height="15" class="corner" style="display: none" /></div></div><!-- //end sideitem //-->
<?php
}
示例13: widget
/**
* Outputs the widget based on the arguments input through the widget controls.
*
* @since 0.6.0
*/
function widget($sidebar, $instance)
{
extract($sidebar);
/* Set up the $before_widget ID for multiple widgets created by the bookmarks widget. */
if (!empty($instance['categorize'])) {
$before_widget = preg_replace('/id="[^"]*"/', 'id="%id"', $before_widget);
}
/* Add a class to $before_widget if one is set. */
if (!empty($instance['class'])) {
$before_widget = str_replace('class="', 'class="' . esc_attr($instance['class']) . ' ', $before_widget);
}
/* Set the $args for wp_list_bookmarks() to the $instance array. */
$args = $instance;
/* wp_list_bookmarks() hasn't been updated in WP to use wp_parse_id_list(), so we have to pass strings for includes/excludes. */
if (!empty($args['category']) && is_array($args['category'])) {
$args['category'] = join(', ', $args['category']);
}
if (!empty($args['exclude_category']) && is_array($args['exclude_category'])) {
$args['exclude_category'] = join(', ', $args['exclude_category']);
}
if (!empty($args['include']) && is_array($args['include'])) {
$args['include'] = join(',', $args['include']);
}
if (!empty($args['exclude']) && is_array($args['exclude'])) {
$args['exclude'] = join(',', $args['exclude']);
}
/* If no limit is given, set it to -1. */
$args['limit'] = empty($args['limit']) ? -1 : $args['limit'];
/* Some arguments must be set to the sidebar arguments to be output correctly. */
$args['title_li'] = apply_filters('widget_title', empty($args['title_li']) ? __('Bookmarks', 'hybrid-core') : $args['title_li'], $instance, $this->id_base);
$args['title_before'] = $before_title;
$args['title_after'] = $after_title;
$args['category_before'] = $before_widget;
$args['category_after'] = $after_widget;
$args['category_name'] = '';
$args['echo'] = false;
/* Output the bookmarks widget. */
$bookmarks = str_replace(array("\r", "\n", "\t"), '', wp_list_bookmarks($args));
/* If no title is given and the bookmarks aren't categorized, add a wrapper <ul>. */
if (empty($args['title_li']) && false === $args['categorize']) {
$bookmarks = '<ul class="xoxo bookmarks">' . $bookmarks . '</ul>';
}
/* Output the bookmarks. */
echo $bookmarks;
}
示例14: bf_nav
/**
* bf_nav() - Buffet Framework filter function
*
* Displays the main navigation on the theme, after the header.
* You can override the default navigation using the <b>bf_nav</b> filter.
*
*
* @since 0.5.2
* @hook filter bf_nav
* @return string HTML code
*/
function bf_nav()
{
$output = '<div class="menu clearfix"><ul id="nav" class="nav clearfix">';
$output .= '<li><a href="' . get_bloginfo('url') . '" title="' . get_bloginfo('name') . '">' . bf_get_option('home_link') . '</a></li>';
if (!bf_get_option('topnav_linkcat')) {
$output .= wp_list_categories('hierarchical=false&orderby=id&hide_empty=1&title_li=&exclude=1&echo=');
} else {
$output .= wp_list_bookmarks('category=' . bf_get_option('topnav_linkcat') . '&show_private=1&hide_invisible=0&title_li=&categorize=0&orderby=id&echo=');
}
$output .= '</ul><!-- .nav -->';
$output .= '<ul class="rss-links clearfix">';
$output .= '<li><a href="' . get_bloginfo('rss2_url') . '" rel="alternate" type="application/rss+xml" title="' . sprintf(__('%s Posts RSS Feed', 'arras'), wp_specialchars(get_bloginfo('name'), 1)) . '">';
$output .= __('Posts', 'buffet') . '</a></li>';
$output .= '<li><a href="' . get_bloginfo('comments_rss2_url') . '" rel="alternate" type="application/rss+xml" title="' . sprintf(__('%s Comments RSS Feed', 'arras'), wp_specialchars(get_bloginfo('name'), 1)) . '">';
$output .= __('Comments', 'buffet') . '</a></li>';
$output .= '</ul><!-- .rss-links --></div><!-- .menu -->';
echo apply_filters('bf_nav', $output);
}
示例15: widget
function widget($args, $instance)
{
extract($args);
$category = $instance['category'];
$category_name = $instance['category_name'];
$category_order = $instance['category_order'];
$category_orderby = $instance['category_orderby'];
$exclude_category = $instance['exclude_category'];
$limit = (int) $instance['limit'];
$include = $instance['include'];
$exclude = $instance['exclude'];
$orderby = $instance['orderby'];
$order = $instance['order'];
$between = $instance['between'];
$class = $instance['class'];
$link_before = $instance['link_before'];
$link_after = $instance['link_after'];
$categorize = isset($instance['categorize']) ? $instance['categorize'] : false;
$show_description = isset($instance['show_description']) ? $instance['show_description'] : false;
$hide_invisible = isset($instance['hide_invisible']) ? $instance['hide_invisible'] : false;
$show_rating = isset($instance['show_rating']) ? $instance['show_rating'] : false;
$show_updated = isset($instance['show_updated']) ? $instance['show_updated'] : false;
$show_images = isset($instance['show_images']) ? $instance['show_images'] : false;
$show_name = isset($instance['show_name']) ? $instance['show_name'] : false;
$show_private = isset($instance['show_private']) ? $instance['show_private'] : false;
if ($categorize) {
$before_widget = preg_replace('/id="[^"]*"/', 'id="%id"', $before_widget);
}
if (!$limit) {
$limit = -1;
}
if ($category_name) {
$category = intval($category_name);
}
$bookmarks = array('orderby' => $orderby, 'order' => $order, 'limit' => $limit, 'include' => $include, 'exclude' => $exclude, 'hide_invisible' => $hide_invisible, 'show_rating' => $show_rating, 'show_updated' => $show_updated, 'show_description' => $show_description, 'show_images' => $show_images, 'show_name' => $show_name, 'between' => ' ' . $between, 'categorize' => $categorize, 'category' => $category, 'exclude_category' => $exclude_category, 'show_private' => $show_private, 'category_orderby' => $category_orderby, 'category_order' => $category_order, 'title_li' => $title, 'title_before' => $before_title, 'title_after' => $after_title, 'category_before' => $before_widget, 'category_after' => $after_widget, 'link_before' => $link_before, 'link_after' => $link_after, 'class' => $class, 'category_name' => false, 'echo' => 0);
if (!$categorize) {
echo $before_widget . $before_title . __('Bookmarks', 'rolopress') . $after_title . "\n\t\t\t" . '<ul class="xoxo bookmarks">';
}
echo "\n\t\t" . str_replace(array("\r", "\n", "\t"), '', wp_list_bookmarks($bookmarks));
if (!$categorize) {
echo "\n\t\t\t" . '</ul><!-- .xoxo .bookmarks -->' . $after_widget;
}
}