wp_html_excerpt example

                    $thumb_url = wp_get_attachment_image_src( $id, 'thumbnail', true );
                    if ( $thumb_url ) {
                        echo '<img class="pinkynail" src="' . esc_url( $thumb_url[0] ) . '" alt="" />';
                    }

                    // Title shouldn't ever be empty, but use filename just in case.                     $file     = get_attached_file( $post->ID );
                    $file_url = wp_get_attachment_url( $post->ID );
                    $title    = $post->post_title ? $post->post_title : wp_basename( $file );
                    ?> <div class="filename new"> <span class="media-list-title"><strong><?php echo esc_html( wp_html_excerpt( $title, 60, '&hellip;' ) ); ?></strong></span> <span class="media-list-subtitle"><?php echo wp_basename( $file ); ?></span> </div> </div> <div class="attachment-tools"> <span class="media-item-copy-container copy-to-clipboard-container edit-attachment"> <button type="button" class="button button-small copy-attachment-url" data-clipboard-text="<?php echo $file_url; ?>"><?php _e( 'Copy URL to clipboard' ); ?></button> <span class="success hidden" aria-hidden="true"><?php _e( 'Copied!' ); ?></span> </span> <?php                     if ( current_user_can( 'edit_post', $id ) ) {
                        echo '<a class="edit-attachment" href="' . esc_url( get_edit_post_link( $id ) ) . '">' . _x( 'Edit', 'media item' ) . '</a>';
                    }

    do_action( 'pre_trackback_post', $post_id$trackback_url$charset$title$excerpt$blog_name );

    header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ) );

    if ( ! pings_open( $post_id ) ) {
        trackback_response( 1, __( 'Sorry, trackbacks are closed for this item.' ) );
    }

    $title   = wp_html_excerpt( $title, 250, '&#8230;' );
    $excerpt = wp_html_excerpt( $excerpt, 252, '&#8230;' );

    $comment_post_id      = (int) $post_id;
    $comment_author       = $blog_name;
    $comment_author_email = '';
    $comment_author_url   = $trackback_url;
    $comment_content      = "<strong>$title</strong>\n\n$excerpt";
    $comment_type         = 'trackback';

    $dupe = $wpdb->get_results(
        $wpdb->prepare(
            "
$blogname = preg_replace( '#^(https?://)?(www.)?#', '', get_home_url() );
    }

    if ( is_network_admin() ) {
        /* translators: %s: Site title. */
        $blogname = sprintf( __( 'Network Admin: %s' )esc_html( get_network()->site_name ) );
    } elseif ( is_user_admin() ) {
        /* translators: %s: Site title. */
        $blogname = sprintf( __( 'User Dashboard: %s' )esc_html( get_network()->site_name ) );
    }

    $title = wp_html_excerpt( $blogname, 40, '&hellip;' );

    $wp_admin_bar->add_node(
        array(
            'id'    => 'site-name',
            'title' => $title,
            'href'  => ( is_admin() || ! current_user_can( 'read' ) ) ? home_url( '/' ) : admin_url(),
        )
    );

    // Create submenu items.
    
'menu_locations',
            array(
                'title'       => 1 === $num_locations ? _x( 'View Location', 'menu locations' ) : _x( 'View All Locations', 'menu locations' ),
                'panel'       => 'nav_menus',
                'priority'    => 30,
                'description' => $description,
            )
        );

        $choices = array( '0' => __( '&mdash; Select &mdash;' ) );
        foreach ( $menus as $menu ) {
            $choices[ $menu->term_id ] = wp_html_excerpt( $menu->name, 40, '&hellip;' );
        }

        // Attempt to re-map the nav menu location assignments when previewing a theme switch.         $mapped_nav_menu_locations = array();
        if ( ! $this->manager->is_theme_active() ) {
            $theme_mods = get_option( 'theme_mods_' . $this->manager->get_stylesheet(), array() );

            // If there is no data from a previous activation, start fresh.             if ( empty( $theme_mods['nav_menu_locations'] ) ) {
                $theme_mods['nav_menu_locations'] = array();
            }

            
if ( $parsed_args['toggle'] ) {
        $class        = empty( $parsed_args['errors'] ) ? 'startclosed' : 'startopen';
        $toggle_links = " <a class='toggle describe-toggle-on' href='#'>$toggle_on</a> <a class='toggle describe-toggle-off' href='#'>$toggle_off</a>";
    } else {
        $class        = '';
        $toggle_links = '';
    }

    $display_title = ( ! empty( $title ) ) ? $title : $filename; // $title shouldn't ever be empty, but just in case.     $display_title = $parsed_args['show_title'] ? "<div class='filename new'><span class='title'>" . wp_html_excerpt( $display_title, 60, '&hellip;' ) . '</span></div>' : '';

    $gallery = ( ( isset( $_REQUEST['tab'] ) && 'gallery' === $_REQUEST['tab'] ) || ( isset( $redir_tab ) && 'gallery' === $redir_tab ) );
    $order   = '';

    foreach ( $form_fields as $key => $val ) {
        if ( 'menu_order' === $key ) {
            if ( $gallery ) {
                $order = "<div class='menu_order'> <input class='menu_order_input' type='text' id='attachments[$attachment_id][menu_order]' name='attachments[$attachment_id][menu_order]' value='" . esc_attr( $val['value'] ) . "' /></div>";
            } else {
                $order = "<input type='hidden' name='attachments[$attachment_id][menu_order]' value='" . esc_attr( $val['value'] ) . "' />";
            }

            
wp_enqueue_script( 'admin-comments' );
enqueue_comment_hotkeys_js();

/** * @global int $post_id */
global $post_id;

if ( $post_id ) {
    $comments_count      = wp_count_comments( $post_id );
    $draft_or_post_title = wp_html_excerpt( _draft_or_post_title( $post_id ), 50, '&hellip;' );

    if ( $comments_count->moderated > 0 ) {
        // Used in the HTML title tag.         $title = sprintf(
            /* translators: 1: Comments count, 2: Post title. */
            __( 'Comments (%1$s) on &#8220;%2$s&#8221;' ),
            number_format_i18n( $comments_count->moderated ),
            $draft_or_post_title
        );
    } else {
        // Used in the HTML title tag.

    public function column_author( $comment ) {
        global $comment_status;

        $author_url = get_comment_author_url( $comment );

        $author_url_display = untrailingslashit( preg_replace( '|^http(s)?://(www\.)?|i', '', $author_url ) );

        if ( strlen( $author_url_display ) > 50 ) {
            $author_url_display = wp_html_excerpt( $author_url_display, 49, '&hellip;' );
        }

        echo '<strong>';
        comment_author( $comment );
        echo '</strong><br />';

        if ( ! empty( $author_url_display ) ) {
            // Print link to author URL, and disallow referrer information (without using target="_blank").             printf(
                '<a href="%s" rel="noopener noreferrer">%s</a><br />',
                esc_url( $author_url ),
                
update_user_meta( $current_user->ID, 'nav_menu_recently_edited', $nav_menu_selected_id );
}

// If there's a menu, get its name. if ( ! $nav_menu_selected_title && is_nav_menu( $nav_menu_selected_id ) ) {
    $_menu_object            = wp_get_nav_menu_object( $nav_menu_selected_id );
    $nav_menu_selected_title = ! is_wp_error( $_menu_object ) ? $_menu_object->name : '';
}

// Generate truncated menu names. foreach ( (array) $nav_menus as $key => $_nav_menu ) {
    $nav_menus[ $key ]->truncated_name = wp_html_excerpt( $_nav_menu->name, 40, '&hellip;' );
}

// Retrieve menu locations. if ( current_theme_supports( 'menus' ) ) {
    $locations      = get_registered_nav_menus();
    $menu_locations = get_nav_menu_locations();
}

/* * Ensure the user will be able to scroll horizontally * by adding a class for the max menu depth. * * @global int $_wp_nav_menu_max_depth */


    if ( empty( $post->post_excerpt ) ) {
        /** This filter is documented in wp-includes/post-template.php */
        $excerpt = apply_filters( 'the_content', $post->post_content, $post->ID );
    } else {
        /** This filter is documented in wp-includes/post-template.php */
        $excerpt = apply_filters( 'the_excerpt', $post->post_excerpt );
    }

    $excerpt = str_replace( ']]>', ']]&gt;', $excerpt );
    $excerpt = wp_html_excerpt( $excerpt, 252, '&#8230;' );

    /** This filter is documented in wp-includes/post-template.php */
    $post_title = apply_filters( 'the_title', $post->post_title, $post->ID );
    $post_title = strip_tags( $post_title );

    if ( $to_ping ) {
        foreach ( (array) $to_ping as $tb_ping ) {
            $tb_ping = trim( $tb_ping );
            if ( ! in_array( $tb_ping$pinged, true ) ) {
                trackback( $tb_ping$post_title$excerpt$post->ID );
                $pinged[] = $tb_ping;
            }
Home | Imprint | This part of the site doesn't use cookies.