From 1a4e0783eedb13758bb60c7e4552252ee73c39b5 Mon Sep 17 00:00:00 2001 From: Theo Gainey Date: Thu, 14 Sep 2023 10:57:23 -0400 Subject: [PATCH] chore: update php/twig to match linting rules --- .../example-custom-post-type.php | 1 - src/php/inc/helpers/generic.php | 1 - src/php/inc/metaboxes/example.php | 26 +++++++++---------- .../taxonomies/example-custom-taxonomy.php | 1 - src/php/inc/theme-setup.php | 1 - src/php/views/index.twig | 4 +-- src/php/views/search.twig | 4 +-- 7 files changed, 17 insertions(+), 21 deletions(-) diff --git a/src/php/inc/custom-post-types/example-custom-post-type.php b/src/php/inc/custom-post-types/example-custom-post-type.php index b2649fc..fc1cfd6 100644 --- a/src/php/inc/custom-post-types/example-custom-post-type.php +++ b/src/php/inc/custom-post-types/example-custom-post-type.php @@ -58,6 +58,5 @@ function custom_post_type() { 'capability_type' => 'page', ); register_post_type( 'example', $args ); - } add_action( 'init', 'custom_post_type', 0 ); diff --git a/src/php/inc/helpers/generic.php b/src/php/inc/helpers/generic.php index a9e1234..57b36a8 100644 --- a/src/php/inc/helpers/generic.php +++ b/src/php/inc/helpers/generic.php @@ -137,4 +137,3 @@ function get_featured_image_url( $size = 'full' ) { $thumb_url = $thumb_url_array[0]; return $thumb_url; } - diff --git a/src/php/inc/metaboxes/example.php b/src/php/inc/metaboxes/example.php index 0c88780..efde297 100644 --- a/src/php/inc/metaboxes/example.php +++ b/src/php/inc/metaboxes/example.php @@ -15,20 +15,20 @@ function example_register_meta_boxes( $meta_boxes ) { $prefix = 'spark_example_'; - $meta_boxes[] = [ + $meta_boxes = array( 'title' => 'Example', 'id' => $prefix . 'metaboxes', - 'post_types' => [ 'page' ], // What types of post types e.g. posts, pages, custom_post_type. + 'post_types' => array( 'page' ), // What types of post types e.g. posts, pages, custom_post_type. 'context' => 'side', // Where to display on admin page. https://docs.metabox.io/creating-meta-boxes/#contexts . 'priority' => 'high', - 'fields' => [ - [ + 'fields' => array( + array( 'type' => 'checkbox', 'id' => $prefix . 'checkbox_example', 'name' => 'Checkbox', 'desc' => 'Click Yes or No!', - ], - [ + ), + array( 'type' => 'text', 'id' => $prefix . 'text_example', 'name' => 'Text', @@ -36,22 +36,22 @@ function example_register_meta_boxes( $meta_boxes ) { 'std' => 'Default Value', 'placeholder' => 'Try me out', 'clone' => true, - ], - [ + ), + array( 'type' => 'image_advanced', 'id' => $prefix . 'image_example', 'name' => 'Image Advanced', 'desc' => 'Upload an Image.', 'max_file_uploads' => 1, 'max_status' => true, - ], - [ + ), + array( 'type' => 'wysiwyg', 'id' => $prefix . 'wysiwyg_example', 'name' => 'WYSIWYG', - ], - ], - ]; + ), + ), + ); return $meta_boxes; } diff --git a/src/php/inc/taxonomies/example-custom-taxonomy.php b/src/php/inc/taxonomies/example-custom-taxonomy.php index 038d271..9733367 100644 --- a/src/php/inc/taxonomies/example-custom-taxonomy.php +++ b/src/php/inc/taxonomies/example-custom-taxonomy.php @@ -25,6 +25,5 @@ function register_custom_taxonomy() { 'show_tagcloud' => true, ); register_taxonomy( 'example_custom_tax', array( 'example' ), $args ); - } add_action( 'init', 'register_custom_taxonomy', 0 ); diff --git a/src/php/inc/theme-setup.php b/src/php/inc/theme-setup.php index b80c202..3176fc8 100644 --- a/src/php/inc/theme-setup.php +++ b/src/php/inc/theme-setup.php @@ -111,6 +111,5 @@ function custom_hide_editor() { add_filter( 'use_block_editor_for_post', '__return_false' ); remove_post_type_support( 'page', 'editor' ); } - } add_action( 'admin_init', 'custom_hide_editor' ); diff --git a/src/php/views/index.twig b/src/php/views/index.twig index 0ef3f8c..86e6bde 100644 --- a/src/php/views/index.twig +++ b/src/php/views/index.twig @@ -8,10 +8,10 @@ {% block posts_found %}

{{ title }}

{% for post in posts %} - {% include 'partials/content-single.twig' with { post: post } %} + {% include 'partials/content-single.twig' with {post: post} %} {% endfor %} - {% include 'partials/pagination.twig' with { pagination: posts.pagination({ show_all: false, mid_size: 3, end_size: 2 }) } %} + {% include 'partials/pagination.twig' with {pagination: posts.pagination({show_all: false, mid_size: 3, end_size: 2})} %} {% endblock %} {% else %} diff --git a/src/php/views/search.twig b/src/php/views/search.twig index 448f1f1..9688670 100644 --- a/src/php/views/search.twig +++ b/src/php/views/search.twig @@ -3,8 +3,8 @@ {% block posts_found %}

{{ title }}

{% for post in posts %} - {% include 'partials/content-search.twig' with { post: post} %} + {% include 'partials/content-search.twig' with {post: post} %} {% endfor %} - {% include 'partials/pagination.twig' with { pagination: posts.pagination({show_all: false, mid_size: 3, end_size: 2}) } %} + {% include 'partials/pagination.twig' with {pagination: posts.pagination({show_all: false, mid_size: 3, end_size: 2})} %} {% endblock %}