Skip to content

Commit 12994b6

Browse files
chore: clean up php helper functions
- remove old get_template_part, references to deleted directories/files - update comments and docblocks - remove old helpers documentation
1 parent 34db3bd commit 12994b6

File tree

5 files changed

+5
-71
lines changed

5 files changed

+5
-71
lines changed

docs/helpers.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

docs/helpers/generic.md

Lines changed: 0 additions & 59 deletions
This file was deleted.

src/php/404.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,4 @@
66
// https://timber.github.io/docs/reference/timber/#context
77
$context = Timber\Timber::context();
88
$timber_post = new Timber\Post();
9-
$context['searchform'] = get_template_part( 'template-parts/content', 'search' );
109
Timber\Timber::render( '404.twig', $context );

src/php/inc/helpers/generic.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@ function define_theme_globals() {
1515

1616
/**
1717
* Given an array of attributes, return a string of key="value" pairs separated by spaces.
18-
* Also handles escaping the attributes.
18+
* Also handles escaping the attributes. Can be helpful when creating a template with optional
19+
* parameters.
1920
*
2021
* Explaining the ('href' === $key) conditional:
2122
* - It's best practice to escape strings that will be echoed to the page, for security reasons.
2223
* - In order to correctly escape the $val string, we want to use esc_url or esc_attr respectively.
2324
*
2425
* @param array $atts - html attributes.
25-
* @param array $exclude - attributes to exclude from the output string.
26+
* @param array $exclude - attributes to exclude from the output string. Defaults to `[]`.
2627
* @return string
2728
*/
2829
function get_attribute_string( $atts, $exclude = array() ) {

src/php/inc/theme-setup.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ function sparkpress_theme_setup() {
3434
*/
3535
add_theme_support( 'post-thumbnails' );
3636

37-
// This theme uses wp_nav_menu() in one location.
3837
register_nav_menus( array( 'primary' => 'Primary' ) );
3938

4039
/*
@@ -68,7 +67,8 @@ function sparkpress_theme_setup() {
6867
function custom_hide_editor() {
6968
global $pagenow;
7069
$hidden_pages = array(
71-
'example-page.php',
70+
// specify page templates where main editor should be hidden
71+
// 'example-page-template.php',
7272
);
7373

7474
// Only on editor page.

0 commit comments

Comments
 (0)