To be honest, I forgot about this topic ?? I haven’t figured it out but when I saw your post, I decided to give it a try on my own.
Turns out, the file that is handling Press This behaviour is located at wp-admin/press-this.php. It’s quite a long file but editing it is relatively straightforward.
Before you edit it, DUPLICATE IT. You don’t want to be downloading whole new WordPress package for a single 26KB file should anything go wrong.
First, head to lines 102-105:
if ( ! empty($selection) ) {
$selection = preg_replace('/(\r?\n|\r)/', '</p><p>', $selection);
$selection = 'ThisWillAppearBeforeSelectedText' . str_replace('<p></p>', '', $selection) . 'ThisWillAppearAfterSelectedText';
}
Here you can replace what is being placed before and after the “quoted” text (if you select some text on a site and click the Press This bookmarklet, WordPress will automatically paste it into the editor for you). Simply edit ThisWillAppearBeforeSelectedText and ThisWillAppearAfterSelectedText (‘apostrophes’ must stay as they are).
If you want to make it Markdown-style, replace the first string with ‘> ‘ and make the second string empty.
Now, to style the rest, head to lines 601-612:
$content = 'ThisWillApearBeforeAnythingElse';
if ( $selection )
$content .= $selection;
if ( $url ) {
$content .= 'ThisWillAppearBeforeTheLink';
if ( $selection )
$content .= __('ThisIsTheVIAString');
$content .= sprintf( "[%s](%s)", esc_url( $url ), esc_html( $title ) );
}
I think this is pretty self-explanatory. You can edit the way link is displayed on the last paragraph (sprintf). I’ve “Markdowninfied” it but you can edit it as you want.
If you want to wrap all of the text generated by Press This in a div, use the ThisWillApearBeforeAnythingElse string.
In general, the best way to see how it works is to play with it ??
IMPORTANT!
Because this file is located in wp-admin directory, it is probably going to be replaced with each update. Bear that in mind.
Hope it helps!
(it helped me)