• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
WordPress a2z

WordPress a2z

WordPress Dynamic API Reference

  • Home
  • Plugins
  • Themes
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / twentytwenty_edit_post_link() – Filters the edit post link to add an icon and use the post meta structure.

You appear to be a bot. Output may be restricted

Description

Filters the edit post link to add an icon and use the post meta structure.

Usage

twentytwenty_edit_post_link( $link, $post_id, $text );

Parameters

$link
( string ) required – Anchor tag for the edit link.
$post_id
( int ) required – Post ID.
$text
( string ) required – Anchor text.

Returns

void

Source

File name: twentytwenty/inc/template-tags.php
Lines:

1 to 27 of 27
function twentytwenty_edit_post_link( $link, $post_id, $text ) {
  if ( is_admin() ) {
    return $link;
  }

  $edit_url = get_edit_post_link( $post_id );

  if ( ! $edit_url ) {
    return;
  }

  $text = sprintf(
    wp_kses(
      /* translators: %s: Post title. Only visible to screen readers. */
      __( 'Edit <span class="screen-reader-text">%s</span>', 'twentytwenty' ),
      array(
        'span' => array(
          'class' => array(),
        ),
      )
    ),
    get_the_title( $post_id )
  );

  return '<div class="post-meta-wrapper post-meta-edit-link-wrapper"><ul class="post-meta"><li class="post-edit meta-wrapper"><span class="meta-icon">' . twentytwenty_get_theme_svg( 'edit' ) . '</span><span class="meta-text"><a href="' . esc_url( $edit_url ) . '">' . $text . '</a></span></li></ul><!-- .post-meta --></div><!-- .post-meta-wrapper -->';

}
 

 View on GitHub View on Trac

Published: 25th November 2019 | Last updated: 25th November 2019

Primary Sidebar

Information

Function name: twentytwenty_edit_post_link
Plugin ref: Twenty Twenty
Version: 2.1
Sourcefile: inc/template-tags.php
File ref: inc/template-tags.php
Deprecated?: No
API Letters: E,L,P,T

Footer

WordPress a2z
WordPress a2z
WordPress Dynamic API Reference
WordPress 6.1.1. PHP: 8.0.28
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  wp-a2z.org
© Copyright WordPress a2z 2014-2023. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites