get_post_reply_link

Definition:
function get_post_reply_link($args = array() {}

Retrieve HTML content for reply to post link.
The default arguments that can be override are ‘add_below’, ‘respond_id’, ‘reply_text’, ‘login_text’, and ‘depth’. The ‘login_text’ argument will be used, if the user must log in or register first before posting a comment. The ‘reply_text’ will be used, if they can post a reply. The ‘add_below’ and ‘respond_id’ arguments are for the JavaScript moveAddCommentForm() function parameters.

Parameters

  • array $args: Optional. Override default options.
  • int|object $post: Optional. Post that the comment is going to be displayed on. Defaults to current post.

Return values

returns:Link to show comment form, if successful. False, if comments are closed.

Defined filters

  • post_comments_link
    apply_filters('post_comments_link', $before . $link . $after, $post)

Source code

function get_post_reply_link($args = array(), $post = null) {

	global $user_ID;



	$defaults = array('add_below' => 'post', 'respond_id' => 'respond', 'reply_text' => __('Leave a Comment'),

		'login_text' => __('Log in to leave a Comment'), 'before' => '', 'after' => '');



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

	extract($args, EXTR_SKIP);

	$post = get_post($post);



	if ( !comments_open($post->ID) )

		return false;



	if ( get_option('comment_registration') && !$user_ID ) {

		$link = '<a rel="nofollow" href="' . wp_login_url( get_permalink() ) . '">' . $login_text . '</a>';

	} else {

		$link = "<a rel='nofollow' class='comment-reply-link' href='" . get_permalink($post->ID) . "#$respond_id' onclick='return addComment.moveForm(\"$add_below-$post->ID\", \"0\", \"$respond_id\", \"$post->ID\")'>$reply_text</a>";

	}

	return apply_filters('post_comments_link', $before . $link . $after, $post);

}

1605

get_post_permalink

Definition:
function get_post_permalink( $id = 0, $leavename = false, $sample = false ) {}

Retrieve the permalink for a post with a custom post type.

Parameters

  • int $id: Optional. Post ID.
  • bool $leavename: Optional, defaults to false. Whether to keep post name.
  • bool $sample: Optional, defaults to false. Is it a sample permalink.

Defined filters

  • post_type_link
    apply_filters('post_type_link', $post_link, $post, $leavename, $sample)

Source code

function get_post_permalink( $id = 0, $leavename = false, $sample = false ) {

	global $wp_rewrite;



	$post = &get_post($id);



	if ( is_wp_error( $post ) )

		return $post;



	$post_link = $wp_rewrite->get_extra_permastruct($post->post_type);



	$slug = $post->post_name;



	$draft_or_pending = isset($post->post_status) && in_array( $post->post_status, array( 'draft', 'pending', 'auto-draft' ) );



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



	if ( !empty($post_link) && ( !$draft_or_pending || $sample ) ) {

		if ( ! $leavename ) {

			if ( $post_type->hierarchical )

				$slug = get_page_uri($id);

			$post_link = str_replace("%$post->post_type%", $slug, $post_link);

		}

		$post_link = home_url( user_trailingslashit($post_link) );

	} else {

		if ( $post_type->query_var && ( isset($post->post_status) && !$draft_or_pending ) )

			$post_link = add_query_arg($post_type->query_var, $slug, '');

		else

			$post_link = add_query_arg(array('post_type' => $post->post_type, 'p' => $post->ID), '');

		$post_link = home_url($post_link);

	}



	return apply_filters('post_type_link', $post_link, $post, $leavename, $sample);

}

1603

get_post_modified_time

Definition:
function get_post_modified_time( $d = 'U', $gmt = false, $post = null, $translate = false ) {}

Retrieve the time at which the post was last modified.

Parameters

  • string $d: Optional, default is ‘U’. Either ‘G’, ‘U’, or php date format.
  • bool $gmt: Optional, default is false. Whether to return the gmt time.
  • int|object $post: Optional, default is global post object. A post_id or post object
  • bool $translate: Optional, default is false. Whether to translate the result

Return values

returns:Returns timestamp

Defined filters

  • get_post_modified_time
    apply_filters('get_post_modified_time', $time, $d, $gmt)

Source code

function get_post_modified_time( $d = 'U', $gmt = false, $post = null, $translate = false ) {

	$post = get_post($post);



	if ( $gmt )

		$time = $post->post_modified_gmt;

	else

		$time = $post->post_modified;

	$time = mysql2date($d, $time, $translate);



	return apply_filters('get_post_modified_time', $time, $d, $gmt);

}

1601

get_post_mime_types

Definition:
function get_post_mime_types() {}

Get default post mime types

Defined filters

  • post_mime_types
    apply_filters('post_mime_types', $post_mime_types)

Source code

function get_post_mime_types() {

	$post_mime_types = array(	//	array( adj, noun )

		'image' => array(__('Images'), __('Manage Images'), _n_noop('Image <span class="count">(%s)</span>', 'Images <span class="count">(%s)</span>')),

		'audio' => array(__('Audio'), __('Manage Audio'), _n_noop('Audio <span class="count">(%s)</span>', 'Audio <span class="count">(%s)</span>')),

		'video' => array(__('Video'), __('Manage Video'), _n_noop('Video <span class="count">(%s)</span>', 'Video <span class="count">(%s)</span>')),

	);



	return apply_filters('post_mime_types', $post_mime_types);

}

1599

get_post_mime_type

Definition:
function get_post_mime_type($ID = '') {}

Retrieve the mime type of an attachment based on the ID.
This function can be used with any post type, but it makes more sense with attachments.

Parameters

  • int $ID: Optional. Post ID.

Return values

returns:False on failure or returns the mime type

Source code

function get_post_mime_type($ID = '') {

	$post = & get_post($ID);



	if ( is_object($post) )

		return $post->post_mime_type;



	return false;

}

1597