Skip to content

Commit 1268d58

Browse files
authored
Merge pull request #8 from level-level/wider-cc-version-support
Wider cc version support
2 parents 04d4f21 + 3beb9f9 commit 1268d58

File tree

4 files changed

+48
-5
lines changed

4 files changed

+48
-5
lines changed

clarkson-404.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,9 @@ public function settings_field() {
104104
public function options_reading_404() {
105105
echo "<label for='clarkson-page-for-404'>";
106106
printf(
107-
__( 'Page: %s' ), wp_dropdown_pages(
107+
/* translators: Page number */
108+
__( 'Page: %s' ),
109+
wp_dropdown_pages(
108110
array(
109111
'name' => 'clarkson-page-for-404',
110112
'echo' => 0,
@@ -132,7 +134,7 @@ public function field_content( $post_states, $post ) {
132134
return $post_states;
133135
}
134136

135-
if ( $post->ID === intval( $id ) ) {
137+
if ( intval( $id ) === $post->ID ) {
136138
$post_states['clarkson-page-for-404'] = __( '404', 'clarkson-404' );
137139
}
138140

@@ -152,7 +154,7 @@ public function exclude_404_from_search( WP_Query $query ): void {
152154
return;
153155
}
154156

155-
$excluded_posts = $query->get( 'post__not_in' ) ?: array();
157+
$excluded_posts = $query->get( 'post__not_in' ) ? $query->get( 'post__not_in' ) : array();
156158
array_push( $excluded_posts, $id );
157159

158160
$query->set( 'post__not_in', $excluded_posts );

composer.json

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,31 @@
11
{
22
"name": "level-level/clarkson-404",
33
"type": "wordpress-muplugin",
4+
"license": "MIT",
5+
"description": "A plugin to set a custom page as 404 for using with Clarkson.",
46
"authors": [
57
{
68
"name": "Level Level",
79
"homepage": "https://level-level.com"
810
}
911
],
12+
"require-dev": {
13+
"wp-coding-standards/wpcs": "^2.3",
14+
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.2"
15+
},
16+
"scripts": {
17+
"fix" : [
18+
"phpcbf"
19+
],
20+
"test": [
21+
"composer validate",
22+
"phpcs"
23+
],
24+
"phpunit":[
25+
"phpunit"
26+
]
27+
},
1028
"require": {
11-
"level-level/clarkson-core": "^1.0.0"
29+
"level-level/clarkson-core": "^1 | ^2"
1230
}
1331
}

phpcs.xml.dist

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="clarkson_core">
3+
<description>Level Level Clarkson Core ruleset</description>
4+
5+
<file>./clarkson-404.php</file>
6+
7+
<!--<arg name="report" value="summary"/>-->
8+
<arg name="colors"/>
9+
<arg value="sp"/>
10+
11+
<rule ref="Squiz.PHP.CommentedOutCode"/>
12+
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace"/>
13+
<rule ref="Generic.CodeAnalysis.UnusedFunctionParameter"/>
14+
<rule ref="Generic.Commenting.Todo"/>
15+
<rule ref="Generic.ControlStructures.InlineControlStructure"/>
16+
17+
<rule ref="WordPress-Core">
18+
<exclude name="WordPress.Files.FileName.InvalidClassFileName" />
19+
<exclude name="Generic.CodeAnalysis.UnusedFunctionParameter.Found" />
20+
<exclude name="WordPress.Files.FileName.NotHyphenatedLowercase" />
21+
<exclude name="Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed" />
22+
</rule>
23+
</ruleset>

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Custom 404 page for Clarkson
22

3-
A plugin to set a custom page as 404 when using [Clarkson Core](http://wp-clarkson.com/core){:target="_blank"}
3+
A plugin to set a custom page as 404 when using [Clarkson Core](https://github.com/level-level/clarkson-core)
44

55
## How to
66

0 commit comments

Comments
 (0)