get_search_comments_feed_link

Definition:
function get_search_comments_feed_link($search_query = '', $feed = '') {}

Retrieve the permalink for the comments feed of the search results.

Parameters

  • string $search_query: Optional. Search query.
  • string $feed: Optional. Feed type.

Defined filters

  • search_feed_link
    apply_filters('search_feed_link', $link, $feed, 'comments')

Source code

function get_search_comments_feed_link($search_query = '', $feed = '') {

	global $wp_rewrite;



	if ( empty($feed) )

		$feed = get_default_feed();



	$link = get_search_feed_link($search_query, $feed);



	$permastruct = $wp_rewrite->get_search_permastruct();



	if ( empty($permastruct) )

		$link = add_query_arg('feed', 'comments-' . $feed, $link);

	else

		$link = add_query_arg('withcomments', 1, $link);



	$link = apply_filters('search_feed_link', $link, $feed, 'comments');



	return $link;

}

1669

get_sample_permalink_html

Definition:
function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) {}

sample permalink html
intended to be used for the inplace editor of the permalink post slug on in the post (and page?) editor.

Parameters

  • int|object $id: Post ID or post object.
  • string $new_title: (optional) New title
  • string $new_slug: (optional) New slug

Return values

returns:intended to be used for the inplace editor of the permalink post slug on in the post (and page?) editor.

Defined filters

  • get_sample_permalink_html
    apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug)
  • get_sample_permalink_html
    apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug)

Source code

function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) {

	global $wpdb;

	$post = &get_post($id);



	list($permalink, $post_name) = get_sample_permalink($post->ID, $new_title, $new_slug);



	if ( 'publish' == $post->post_status ) {

		$ptype = get_post_type_object($post->post_type);

		$view_post = $ptype->labels->view_item;

		$title = __('Click to edit this part of the permalink');

	} else {

		$title = __('Temporary permalink. Click to edit this part.');

	}



	if ( false === strpos($permalink, '%postname%') && false === strpos($permalink, '%pagename%') ) {

		$return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink">' . $permalink . "</span>\n";

		if ( '' == get_option( 'permalink_structure' ) && current_user_can( 'manage_options' ) && !( 'page' == get_option('show_on_front') && $id == get_option('page_on_front') ) )

			$return .= '<span id="change-permalinks"><a href="options-permalink.php" class="button" target="_blank">' . __('Change Permalinks') . "</a></span>\n";

		if ( isset($view_post) )

			$return .= "<span id='view-post-btn'><a href='$permalink' class='button' target='_blank'>$view_post</a></span>\n";



		$return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);



		return $return;

	}



	if ( function_exists('mb_strlen') ) {

		if ( mb_strlen($post_name) > 30 ) {

			$post_name_abridged = mb_substr($post_name, 0, 14). '&hellip;' . mb_substr($post_name, -14);

		} else {

			$post_name_abridged = $post_name;

		}

	} else {

		if ( strlen($post_name) > 30 ) {

			$post_name_abridged = substr($post_name, 0, 14). '&hellip;' . substr($post_name, -14);

		} else {

			$post_name_abridged = $post_name;

		}

	}



	$post_name_html = '<span id="editable-post-name" title="' . $title . '">' . $post_name_abridged . '</span>';

	$display_link = str_replace(array('%pagename%','%postname%'), $post_name_html, $permalink);

	$view_link = str_replace(array('%pagename%','%postname%'), $post_name, $permalink);

	$return =  '<strong>' . __('Permalink:') . "</strong>\n";

	$return .= '<span id="sample-permalink">' . $display_link . "</span>\n";

	$return .= '&lrm;'; // Fix bi-directional text display defect in RTL languages.

	$return .= '<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug button hide-if-no-js" onclick="editPermalink(' . $id . '); return false;">' . __('Edit') . "</a></span>\n";

	$return .= '<span id="editable-post-name-full">' . $post_name . "</span>\n";

	if ( isset($view_post) )

		$return .= "<span id='view-post-btn'><a href='$view_link' class='button' target='_blank'>$view_post</a></span>\n";



	$return = apply_filters('get_sample_permalink_html', $return, $id, $new_title, $new_slug);



	return $return;

}

1667

get_sample_permalink

Definition:
function get_sample_permalink($id, $title = null, $name = null) {}

Parameters

  • int|object $id: Post ID or post object.
  • string $title: (optional) Title
  • string $name: (optional) Name

Return values

returns:With two entries of type string

Defined filters

  • editable_slug
    apply_filters( 'editable_slug', $uri )

Source code

function get_sample_permalink($id, $title = null, $name = null) {

	$post = &get_post($id);

	if ( !$post->ID )

		return array('', '');



	$ptype = get_post_type_object($post->post_type);



	$original_status = $post->post_status;

	$original_date = $post->post_date;

	$original_name = $post->post_name;



	// Hack: get_permalink would return ugly permalink for

	// drafts, so we will fake, that our post is published

	if ( in_array($post->post_status, array('draft', 'pending')) ) {

		$post->post_status = 'publish';

		$post->post_name = sanitize_title($post->post_name ? $post->post_name : $post->post_title, $post->ID);

	}



	// If the user wants to set a new name -- override the current one

	// Note: if empty name is supplied -- use the title instead, see #6072

	if ( !is_null($name) )

		$post->post_name = sanitize_title($name ? $name : $title, $post->ID);



	$post->post_name = wp_unique_post_slug($post->post_name, $post->ID, $post->post_status, $post->post_type, $post->post_parent);



	$post->filter = 'sample';



	$permalink = get_permalink($post, true);



	// Replace custom post_type Token with generic pagename token for ease of use.

	$permalink = str_replace("%$post->post_type%", '%pagename%', $permalink);



	// Handle page hierarchy

	if ( $ptype->hierarchical ) {

		$uri = get_page_uri($post);

		$uri = untrailingslashit($uri);

		$uri = strrev( stristr( strrev( $uri ), '/' ) );

		$uri = untrailingslashit($uri);

		$uri = apply_filters( 'editable_slug', $uri );

		if ( !empty($uri) )

			$uri .= '/';

		$permalink = str_replace('%pagename%', "{$uri}%pagename%", $permalink);

	}

1665

get_rss

Definition:
function get_rss ($url, $num_items = 5) { // Like get posts, but for RSS

Display RSS items in HTML list items.
You have to specify which HTML list you want, either ordered or unordered before using the function. You also have to specify how many items you wish to display. You can’t display all of them like you can with wp_rss() function.

Parameters

  • string $url: URL of feed to display. Will not auto sense feed URL.
  • int $num_items: Optional. Number of items to display, default is all.

Return values

returns:False on failure.

Source code

function get_rss ($url, $num_items = 5) { // Like get posts, but for RSS

	$rss = fetch_rss($url);

	if ( $rss ) {

		$rss->items = array_slice($rss->items, 0, $num_items);

		foreach ( (array) $rss->items as $item ) {

			echo "<li>\n";

			echo "<a href='$item[link]' title='$item[description]'>";

			echo esc_html($item['title']);

			echo "</a><br />\n";

			echo "</li>\n";

		}

	} else {

		return false;

	}

}

1663

get_role

Definition:
function get_role( $role ) {}

Retrieve role object.

Parameters

  • string $role: Role name.

Source code

function get_role( $role ) {

	global $wp_roles;



	if ( ! isset( $wp_roles ) )

		$wp_roles = new WP_Roles();



	return $wp_roles->get_role( $role );

}

1661