-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with code formatting on the WP_Query docs page #838
Comments
Heads up @WordPress/docs-issues-coordinators, we have a new issue open. Time to use 'em labels. |
I will take care of this one if that is okay. |
Here is the list of suggested modifications:
<?php
// The Query.
$the_query = new WP_Query( $args );
// The Loop.
if ( $the_query->have_posts() ) {
echo '<ul>';
while ( $the_query->have_posts() ) {
$the_query->the_post();
echo '<li>' . esc_html( get_the_title() ) . '</li>';
}
echo '</ul>';
} else {
esc_html_e( 'Sorry, no posts matched your criteria.' );
}
// Restore original Post Data.
wp_reset_postdata();
<?php
// the query.
$the_query = new WP_Query( $args ); ?>
<?php if ( $the_query->have_posts() ) : ?>
<!-- pagination here -->
<!-- the loop -->
<?php
while ( $the_query->have_posts() ) :
$the_query->the_post();
?>
<h2><?php esc_html( the_title() ); ?></h2>
<?php endwhile; ?>
<!-- end of the loop -->
<!-- pagination here -->
<?php wp_reset_postdata(); ?>
<?php else : ?>
<p><?php esc_html_e( 'Sorry, no posts matched your criteria.' ); ?></p>
<?php endif; ?> |
Heads up @zzap - the "code reference" label was applied to this issue. |
Examples are fixed and props added in https://core.trac.wordpress.org/ticket/58537 Thank you @creative-andrew for working on this ❤️ |
Hello @creative-andrew there is an issue in the second example: Should be replaced with: PS: @zzap I guess you opened a Core Trac ticket to try to props people? However since there is no associated commit, I don't think it will be taken into account anywhere 😬 |
Fixed with And yes, I wanted to give props to Andrew and was looking for a ticket without the actual commit. I guess I found out why there were none 🥲 |
Thanks for the update! |
Issue Description
All the code examples are missing indentation.
URL of the Page with the Issue
https://developer.wordpress.org/reference/classes/wp_query/
Section of Page with the issue
Why is this a problem?
Makes it hard to read + understand
Suggested Fix
Add the tabbed indentation back in (and maybe figure out how it got lost - was it an automated process?)
The text was updated successfully, but these errors were encountered: