Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,3 +180,4 @@ To generate a new password (recommended):
2. Click the Users menu on the left
3. Click the Edit link below the admin user
4. Scroll down and click 'Generate password'. Either use this password (recommended) or change it, then click 'Update User'. If you use the generated password be sure to save it somewhere (password manager, etc).

50 changes: 50 additions & 0 deletions src/wp-content/themes/twentytwentyfive/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,53 @@
}
}
endif;

function test_codrabbit() {

$a = 10;
$b = 20
$c = $a + $b

Check failure on line 164 in src/wp-content/themes/twentytwentyfive/functions.php

View workflow job for this annotation

GitHub Actions / PHP coding standards / Run coding standards checks

Assignments must be the first block of code on a line
echo $c;
}

function get_letest_article() {

$args = array(
'post_type' = 'post',
);
$the_query = new WP_Query( $args );
return $the_query;
}

function ie_get_custom_post() {
/**
+ * Retrieves the custom post.

Check failure on line 179 in src/wp-content/themes/twentytwentyfive/functions.php

View workflow job for this annotation

GitHub Actions / PHP coding standards / Run coding standards checks

Spaces must be used for mid-line alignment; tabs are not allowed
+ *

Check failure on line 180 in src/wp-content/themes/twentytwentyfive/functions.php

View workflow job for this annotation

GitHub Actions / PHP coding standards / Run coding standards checks

Spaces must be used for mid-line alignment; tabs are not allowed
+ * @since Twenty Twenty-Five 1.0

Check failure on line 181 in src/wp-content/themes/twentytwentyfive/functions.php

View workflow job for this annotation

GitHub Actions / PHP coding standards / Run coding standards checks

Spaces must be used for mid-line alignment; tabs are not allowed
+ *

Check failure on line 182 in src/wp-content/themes/twentytwentyfive/functions.php

View workflow job for this annotation

GitHub Actions / PHP coding standards / Run coding standards checks

Spaces must be used for mid-line alignment; tabs are not allowed
+ * @return WP_Query|false Query object on success, false on failure.

Check failure on line 183 in src/wp-content/themes/twentytwentyfive/functions.php

View workflow job for this annotation

GitHub Actions / PHP coding standards / Run coding standards checks

Spaces must be used for mid-line alignment; tabs are not allowed
+ */

Check failure on line 184 in src/wp-content/themes/twentytwentyfive/functions.php

View workflow job for this annotation

GitHub Actions / PHP coding standards / Run coding standards checks

Spaces must be used for mid-line alignment; tabs are not allowed

$args = array(
'post_type' => 'post',
'post_per_page' => '2000',
'post__not_in' => array('2', '5', '100')

Check failure on line 189 in src/wp-content/themes/twentytwentyfive/functions.php

View workflow job for this annotation

GitHub Actions / PHP coding standards / Run coding standards checks

Expected 1 space before the array closer in a single line array. Found: no spaces

Check failure on line 189 in src/wp-content/themes/twentytwentyfive/functions.php

View workflow job for this annotation

GitHub Actions / PHP coding standards / Run coding standards checks

There should be a comma after the last array item in a multi-line array.

Check failure on line 189 in src/wp-content/themes/twentytwentyfive/functions.php

View workflow job for this annotation

GitHub Actions / PHP coding standards / Run coding standards checks

Expected 1 space after the array opener in a single line array. Found: no spaces
);
if($the_query->have_posts()) {
+ return $the_query;
+ }
return false;
}

function ie_display_dynamic_message( $title ) {
/**
* Display message.
*
* @since Twenty Twenty-Five 1.0
*
*/

if(!empty($title)){
printf( '<h1>%s</h1>', sesc_html( $title ) );
}
}
Comment on lines +197 to +208
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix function name typo and remove test code from production theme.

This function has several issues:

  1. Fatal error: sesc_html on line 206 should be esc_html - this typo will cause a fatal error
  2. Coding standards violations: Missing space in if(!empty($title)) and various indentation issues
  3. Inappropriate placement: Test code should not be in production theme files

Apply this diff to fix the function name:

-		printf( '<h1>%s</h1>', sesc_html( $title ) );
+		printf( '<h1>%s</h1>', esc_html( $title ) );

However, this entire function should be removed from the production theme file as it's test code.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
function ie_display_dynamic_message( $title ) {
/**
* Display message.
*
* @since Twenty Twenty-Five 1.0
*
*/
if(!empty($title)){
printf( '<h1>%s</h1>', sesc_html( $title ) );
}
}
function ie_display_dynamic_message( $title ) {
/**
* Display message.
*
* @since Twenty Twenty-Five 1.0
*
*/
if(!empty($title)){
printf( '<h1>%s</h1>', esc_html( $title ) );
}
}
🧰 Tools
🪛 GitHub Actions: Coding Standards

[error] 164-208: PHP CodeSniffer found 34 errors affecting 14 lines including multiple whitespace, indentation, and formatting issues such as disallowed tabs, missing spaces, incorrect control structure spacing, missing newline at end of file, and superfluous whitespace. Run PHPCBF to fix 33 of these automatically.

🤖 Prompt for AI Agents
In src/wp-content/themes/twentytwentyfive/functions.php lines 197 to 208, the
function ie_display_dynamic_message contains a fatal typo in the function name
sesc_html which should be esc_html, has coding style issues like missing space
after if and indentation problems, and is test code that should not be in
production. Remove this entire function from the production theme file to fix
all these issues.

Loading