get_sample_permalink_html [ WordPress Function ]
get_sample_permalink_html ( $id, $new_title = null, $new_slug = null )
| Parameters: |
|
| Returns: |
|
| Defined at: |
|
Soorgelijke functies: get_sample_permalink, get_post_permalink, get_blog_permalink, wp_ajax_sample_permalink, get_permalink
sample permalink html
intended to be used for the inplace editor of the permalink post slug on in the post (and page?) editor.
Source
<?php
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). '…' . 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). '…' . 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 .= '‎'; // 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;
}
?>
Examples [ wp-snippets.com ]
Top Google zoekresultaten
- get_sample_permalink_html (WordPress Function) - WPSeek.com
WordPress lookup for get_sample_permalink_html, a WordPress Function. wpseek.com is a WordPress-centric search tool for developers and theme authors.
wpseek.com - get_sample_permalink_html Wordpress hook details -- Adam Brown ...
WordPress hook directory get_sample_permalink_html. WordPress version history for get_sample_permalink_html. This database has information for all major ...
adambrown.info - get_sample_permalink_html not multi-byte safe - WordPress Trac
The code of get_sample_permalink_html() if (strlen($post_name) > 30) { $ post_name_abridged = substr($post_name, 0, 14). '…' . substr($post_name, -14) ...
core.trac.wordpress.org - get_sample_permalink_html
Function and Method Cross Reference. get_sample_permalink_html(). Defined at: /wp-admin/includes/post.php -> line 1065. Referenced 2 times: ...
phpxref.ftwr.co.uk