Skip to content

set target _blank for original post link#1280

Merged
peterwilsoncc merged 13 commits into
10up:developfrom
gustavo-p-rossler:fix/1271
Apr 30, 2026
Merged

set target _blank for original post link#1280
peterwilsoncc merged 13 commits into
10up:developfrom
gustavo-p-rossler:fix/1271

Conversation

@gustavo-p-rossler
Copy link
Copy Markdown
Contributor

@gustavo-p-rossler gustavo-p-rossler commented Oct 8, 2024

Description of the Change

This PR updates the link for the original Post, that appears in the editor when the user is editing a pulled Post.
With the current behavior the link opens the original Post in the same window (or browser tab). With the change I made, the link opens the original Post in a new window.

Closes #1271

How to test the Change

This can be verfied by pulling and editing a Post.

Changelog Entry

Changed - Link to original Post

Credits

Props @gustavo-p-rossler, @jeffpaul, @peterwilsoncc.

Checklist:

@gustavo-p-rossler gustavo-p-rossler requested a review from a team as a code owner October 8, 2024 12:04
@gustavo-p-rossler gustavo-p-rossler requested review from peterwilsoncc and removed request for a team October 8, 2024 12:04
@jeffpaul jeffpaul added this to the 2.1.0 milestone Oct 8, 2024
@jeffpaul
Copy link
Copy Markdown
Member

jeffpaul commented Oct 8, 2024

@gustavo-p-rossler thanks for the PR on this, in order to make it more clear that it'll open in a new tab could you add the https://developer.wordpress.org/resource/dashicons/#external icon as part of that link (usually after the text with a space between the text and icon)?

@gustavo-p-rossler
Copy link
Copy Markdown
Contributor Author

gustavo-p-rossler commented Oct 8, 2024

@gustavo-p-rossler thanks for the PR on this, in order to make it more clear that it'll open in a new tab could you add the https://developer.wordpress.org/resource/dashicons/#external icon as part of that link (usually after the text with a space between the text and icon)?

Hi @jeffpaul, I've updated the PR adding the external icon as you can see in the screenshot bellow:

Screenshot 2024-10-08 at 18 05 25

@peterwilsoncc
Copy link
Copy Markdown
Collaborator

@gustavo-p-rossler Thanks for the pull request.

This tests well in the Gutenberg/Block editor but will need an equivalent change for the classic editor interface to add the icon and the targetting.

The code for the classic editor can be found in this block of code:

<span><a href="<?php echo esc_url( $original_post_url ); ?>">
<?php
printf(
/* translators: 1) Distributor post type singular name. */
esc_html__( 'View the origin %1$s.', 'distributor' ),
esc_html( strtolower( $post_type_singular ) )
);
?>
</a></span>

@dkotter dkotter modified the milestones: 2.1.0, 2.2.0 Feb 7, 2025
@dkotter dkotter modified the milestones: 2.2.0, 2.3.0 Aug 26, 2025
@sanketio
Copy link
Copy Markdown
Contributor

@peterwilsoncc I have added the equivalent change for the classic editor in 7a881cb

peterwilsoncc
peterwilsoncc previously approved these changes Apr 30, 2026
Copy link
Copy Markdown
Collaborator

@peterwilsoncc peterwilsoncc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Gustavo, this looks good to me and tests well.

I've taken the liberty of pushing some code to add dashicons as a dependency to the edited CSS files. This will ensure the file is enqueued and the font available.

I missed the need for the dependency change on my earlier review and decided to push the change so I could get this merged more quickly.

peterwilsoncc
peterwilsoncc previously approved these changes Apr 30, 2026
@peterwilsoncc peterwilsoncc merged commit 5cec75e into 10up:develop Apr 30, 2026
14 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"View the Origin Post" opens as a new tab

5 participants