Open renintw opened 10 months ago
Some findings:
<pre class="notranslate">
in the shortcode.<pre>
tag around the %2$s
here.<pre></pre>
inside the shortcode, there'd be an extra <p>
+ <code>
as shown in the PR description.You can test with the following content in a new post.
<!-- wp:shortcode -->
[php]
<span class="pl-ent"><?php</span>
<pre class="notranslate"><span class="pl-c">// The Query.</span>
<span class="pl-s1"><span class="pl-c1">$</span>the_query</span> = <span class="pl-k">new</span> <span class="pl-v">WP_Query</span>( <span class="pl-s1"><span class="pl-c1">$</span>args</span> );
<span class="pl-c">// The Loop.</span>
<span class="pl-k">if</span> ( <span class="pl-s1"><span class="pl-c1">$</span>the_query</span>-><span class="pl-en">have_posts</span>() ) {
<span class="pl-k">echo</span> <span class="pl-s">'<ul>'</span>;
<span class="pl-k">while</span> ( <span class="pl-s1"><span class="pl-c1">$</span>the_query</span>-><span class="pl-en">have_posts</span>() ) {
<span class="pl-s1"><span class="pl-c1">$</span>the_query</span>-><span class="pl-en">the_post</span>();
<span class="pl-k">echo</span> <span class="pl-s">'<li>'</span> . esc_html( get_the_title() ) . <span class="pl-s">'</li>'</span>;
}
<span class="pl-k">echo</span> <span class="pl-s">'</ul>'</span>;
} <span class="pl-k">else</span> {
esc_html_e( <span class="pl-s">'Sorry, no posts matched your criteria.'</span> );
}
<span class="pl-c">// Restore original Post Data.</span>
wp_reset_postdata();</pre>
[/php]
<!-- /wp:shortcode -->
Before diving further into this:
<p>
tag. Is this intentional?cc @ryelle @adamwoodnz
I think all the HTML in the shortcode is legacy or maybe carried over from copy-paste, since the syntax-highlighting is done by prism.js now. I imagine the parsing that prism.js
causes the extra nested code.
Is this an issue on more than one page? Do we need a code solution, or could we just update the content in the explanation here?
Found when reviewing #447. There's a code block with unclear meaning. Example: http://localhost:8895/reference/classes/wp_query/#standard-loop