function yy_widget_links($args) { global $wpdb; $title = empty($options['title']) ? __('Links', 'xtec-11') : $options['title']; $link_cats = $wpdb->get_results("SELECT term_id, name FROM {$wpdb->terms}"); ?> <h2><?php echo $before_widget . $before_title . $title . $after_title; ?> </h2> <ul> <?php foreach ($link_cats as $link_cat) { ?> <li id="linkcat-<?php echo $link_cat->term_id; ?> "><?php echo $link_cat->name; ?> <ul> <?php wp_get_links($link_cat->term_id); ?> </ul> </li> <?php } ?> </ul> <?php }
/** function wp_get_linksbyname() ** Gets the links associated with the named category. ** Parameters: ** category (no default) - The category to use. **/ function wp_get_linksbyname($category, $args = '') { global $wpdb; $cat = $wpdb->get_row("SELECT cat_id, cat_name, auto_toggle, show_images, show_description, " . " show_rating, show_updated, sort_order, sort_desc, text_before_link, text_after_link, " . " text_after_all, list_limit FROM {$wpdb->linkcategories} WHERE cat_name='{$category}'"); if (!$cat) { return; } if (empty($args)) { if ($cat->sort_desc == 'Y') { $cat->sort_order = '_' . $cat->sort_order; } get_links($cat->cat_id, $cat->text_before_link, $cat->text_after_all, $cat->text_after_link, bool_from_yn($cat->show_images), $cat->sort_order, bool_from_yn($cat->show_description), bool_from_yn($cat->show_rating), $cat->list_limit, bool_from_yn($cat->show_updated)); } else { $args = add_query_arg('category', $cat->cat_id, $args); wp_get_links($args); } }
/** function wp_get_linksbyname() ** Gets the links associated with the named category. ** Parameters: ** category (no default) - The category to use. **/ function wp_get_linksbyname($category, $args = '') { global $wpdb; $cat_id = $wpdb->get_var("SELECT cat_ID FROM {$wpdb->categories} WHERE cat_name='{$category}' LIMIT 1"); if (!$cat_id) { return; } $args = add_query_arg('category', $cat_id, $args); wp_get_links($args); }
<div class="module-search module"> <h2 class="module-header">Search</h2> <div class="module-content"> <?php include TEMPLATEPATH . '/searchform.php'; ?> </div> </div> <div class="module"> <h2 class="module-header">Blogroll</h2> <div class="module-content"> <ul class="module-list"> <?php wp_get_links(1); ?> </ul> </div> </div> <div class="module-categories module"> <h2 class="module-header">Categories</h2> <div class="module-content"> <ul class="module-list"> <?php list_cats(0, '', 'name', 'asc', '', 1, 0, 1, 1, 1, 1, 0, '', '', '', '', ''); ?> </ul> </div> </div>
/** * @desc Output of plugin composing the get_links function call * @author Georg Leciejewski */ function widget_king_links($args, $number = 1) { # $args is an array of strings that help widgets to conform to # the active theme: before_widget, before_title, after_widget, # and after_title are the array keys. Default tags: li and h2. extract($args, EXTR_PREFIX_ALL, "default"); $options = get_option('widget_king_links'); $title = $options[$number]['title']; $category = empty($options[$number]['category']) ? -1 : $options[$number]['category']; $show_category = $options[$number]['show_category'] ? 1 : 0; $category_id = $options[$number]['category_id']; $show_on_site_area = $options[$number]['show_on_site_area'] ? 1 : 0; $site_area_id = $options[$number]['site_area_id']; $site_area = $options[$number]['site_area']; $before = stripslashes($options[$number]['before']); $after = stripslashes($options[$number]['after']); $between = stripslashes($options[$number]['between']); $show_images = $options[$number]['show_images'] ? 1 : 0; $orderby = $options[$number]['orderby']; $show_description = $options[$number]['show_description'] ? 1 : 0; $show_rating = $options[$number]['show_rating'] ? 1 : 0; $limit = empty($options[$number]['limit']) ? -1 : $options[$number]['limit']; $show_updated = $options[$number]['show_updated'] ? 1 : 0; $before_widget = empty($options[$number]['before_widget']) ? $default_before_widget : stripslashes($options[$number]['before_widget']); $before_widget_title = empty($options[$number]['before_widget_title']) ? $default_before_title : stripslashes($options[$number]['before_widget_title']); $after_widget_title = empty($options[$number]['after_widget_title']) ? $default_after_title : stripslashes($options[$number]['after_widget_title']); $after_widget = empty($options[$number]['after_widget']) ? $default_after_widget : stripslashes($options[$number]['after_widget']); # These lines generate our output. Widgets can be very complex # but as you can see here, they can also be very, very simple. if (!empty($show_category)) { $post = $wp_query->post; if (in_category($category_id)) { if (!empty($options[$number]['use_wpgetlinks'])) { echo $before_widget . "\n"; echo $before_widget_title . "\n"; echo $title . "\n"; echo $after_widget_title . "\n"; wp_get_links($category); echo $after_widget . "\n"; } else { echo $before_widget . "\n"; echo $before_widget_title . "\n"; echo $title . "\n"; echo $after_widget_title . "\n"; get_links($category, $before, $after, $between, $show_images, $orderby, $show_description, $show_rating, $limit, $show_updated, $echo = 1); echo $after_widget . "\n"; } } } elseif (!empty($show_on_site_area)) { # show only on specific site area if ($site_area($site_area_id)) { if (!empty($options[$number]['use_wpgetlinks'])) { echo $before_widget . "\n"; echo $before_widget_title . "\n"; echo $title . "\n"; echo $after_widget_title . "\n"; wp_get_links($category); echo $after_widget . "\n"; } else { echo $before_widget . "\n"; echo $before_widget_title . "\n"; echo $title . "\n"; echo $after_widget_title . "\n"; get_links($category, $before, $after, $between, $show_images, $orderby, $show_description, $show_rating, $limit, $show_updated, $echo = 1); echo $after_widget . "\n"; } } } else { # always show if (!empty($options[$number]['use_wpgetlinks'])) { echo $before_widget . "\n"; echo $before_widget_title . "\n"; echo $title . "\n"; echo $after_widget_title . "\n"; wp_get_links($category); echo $after_widget . "\n"; } else { echo $before_widget . "\n"; echo $before_widget_title . "\n"; echo $title . "\n"; echo $after_widget_title . "\n"; get_links($category, $before, $after, $between, $show_images, $orderby, $show_description, $show_rating, $limit, $show_updated, $echo = 1); echo $after_widget . "\n"; } } #end else if site area if (!empty($options[$number]['debug'])) { echo '<h2>' . __('Your Link Options are:', 'widgetKing') . '</h2>'; echo "get_links({$category},{$before},{$after},{$between},{$show_images},{$orderby},{$show_description},{$show_rating},{$limit},{$show_updated},{$echo})"; } }
<?php if (function_exists('wp_theme_switcher')) { // optional theme switcher plugin code ?> <h4>Themes</h4> <?php wp_theme_switcher(); } ?> <?php $link_cats = $wpdb->get_results("SELECT cat_id, cat_name FROM {$wpdb->linkcategories}"); foreach ($link_cats as $link_cat) { ?> <h4 id="linkcat-<?php echo $link_cat->cat_id; ?> "><?php echo $link_cat->cat_name; ?> </h4> <ul> <?php wp_get_links($link_cat->cat_id); ?> </ul> <?php } ?>
<?php wp_list_categories('title_li='); ?> </ul> </div> <div class="tabs_archive tabs_list"> <ul> <?php wp_get_archives('type=monthly'); ?> </ul> </div> <div class="tabs_links tabs_list"> <ul> <?php wp_get_links('before=<li>&after=</li>'); ?> </ul> </div> </div> <div class="clr"></div> <!--/content --> </div> <?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar()) { ?> <?php } ?> <div class="box_r ads"> <div class="content">
/** * Gets the links associated with the named category. * * @since 1.0.1 * @deprecated Use wp_get_links() * @see wp_get_links() * * @param string $category The category to use. * @param string $args * @return bool|null */ function wp_get_linksbyname($category, $args = '') { _deprecated_function(__FUNCTION__, '0.0', 'wp_get_links()'); $cat = get_term_by('name', $category, 'link_category'); if (!$cat) { return false; } $cat_id = $cat->term_id; $args = add_query_arg('category', $cat_id, $args); wp_get_links($args); }
/** function wp_get_linksbyname() ** Gets the links associated with the named category. ** Parameters: ** category (no default) - The category to use. **/ function wp_get_linksbyname($category, $args = '') { global $wpdb; $cat = get_term_by('name', $cat_name, 'link_category'); if (!$cat) { return false; } $cat_id = $cat->term_id; $args = add_query_arg('category', $cat_id, $args); wp_get_links($args); }
function freshy_links_menu() { global $wpdb; $ver = substr(get_bloginfo('version'), 0, 3); if (floatval($ver) <= 2) { $link_cats = $wpdb->get_results("SELECT cat_id, cat_name FROM {$wpdb->linkcategories}"); foreach ($link_cats as $link_cat) { ?> <li id="linkcat-<?php print $link_cat->cat_id; ?> "><?php print $link_cat->cat_name; ?> <ul> <?php wp_get_links($link_cat->cat_id); ?> </ul> </li> <?php } } else { $link_cats = $wpdb->get_results("SELECT DISTINCT cat_name, category_id FROM {$wpdb->categories} INNER JOIN {$wpdb->link2cat} ON {$wpdb->categories}.cat_id={$wpdb->link2cat}.category_id"); foreach ($link_cats as $link_cat) { ?> <li id="linkcat-<?php print $link_cat->cat_id; ?> "><?php print $link_cat->cat_name; ?> <ul> <?php wp_get_links('category=' . $link_cat->category_id . '&before=<li>&after=</li>&show_description=0&limit=100'); ?> </ul> </li> <?php } } }
?> <div class="bottom"></div> </ul> <h3>Archives</h3> <ul> <?php wp_get_archives('type=monthly'); ?> <div class="bottom"></div> </ul> <h3>Recommended</h3> <ul> <?php wp_get_links('category=2&before=<li>&between=&after=</li>'); ?> <div class="bottom"></div> </ul> <?php /* If this is the frontpage */ if (is_home() || is_page()) { ?> <h3>Meta</h3> <ul> <?php wp_register(); ?> <li><?php
<?php $link_cats = get_categories("type=link&orderby=name&order=ASC&hierarchical=0"); foreach ($link_cats as $link_cat) { ?> <div id="linkcat-<?php echo $link_cat->cat_ID; ?> " class="sideheading"><?php echo $link_cat->cat_name; ?> </div> <ul> <?php wp_get_links($link_cat->cat_ID); ?> </ul> <?php } ?> <?php } ?> </ul> <div class="sideheading"><?php _e('et cetera', 'girl');