wp_get_links

函式
wp_get_links ( $args = '' )
引數
  • (string) $args a query string
    Required:
    Default: (empty)
返回值
  • (null|string)
相關
  • wp_list_bookmarks()
定義位置
相關方法
get_linkswp_get_link_catsget_linkwp_get_linksbynamewp_get_shortlink
引入
1.0.1
棄用
2.1.0

wp_get_links: 這個函式檢索連結。它接收一個可選的引數陣列,如要檢索的類別或ID,並返回一個連結物件陣列。

獲得與類別相關的連結。

function wp_get_links($args = '') {
	_deprecated_function( __FUNCTION__, '2.1.0', 'wp_list_bookmarks()' );

	if ( strpos( $args, '=' ) === false ) {
		$cat_id = $args;
		$args = add_query_arg( 'category', $cat_id, $args );
	}

	$defaults = array(
		'after' => '<br />',
		'before' => '',
		'between' => ' ',
		'categorize' => 0,
		'category' => '',
		'echo' => true,
		'limit' => -1,
		'orderby' => 'name',
		'show_description' => true,
		'show_images' => true,
		'show_rating' => false,
		'show_updated' => true,
		'title_li' => '',
	);

	$parsed_args = wp_parse_args( $args, $defaults );

	return wp_list_bookmarks($parsed_args);
}

常見問題

FAQs
檢視更多 >