Skip to content

Commit ef40ace

Browse files
committed
Update public.php
1 parent 383fdbe commit ef40ace

File tree

1 file changed

+0
-40
lines changed

1 file changed

+0
-40
lines changed

includes/public/public.php

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -123,46 +123,6 @@ function wzkb_archive_template( $template ) {
123123
}
124124
add_filter( 'template_include', 'wzkb_archive_template' );
125125

126-
127-
/**
128-
* Helper function to build a WP_Block_Template object.
129-
*
130-
* @param string $theme The source of the template (plugin name in this case).
131-
* @param string $template_slug Template slug for the block template.
132-
* @param string $template_file Path to the template file.
133-
* @param string $template_type Template type (either 'wp_template' or 'wp_template_part').
134-
*
135-
* @return WP_Block_Template|WP_Error The block template object or WP_Error on failure.
136-
*/
137-
function wzkb_build_block_template_result( $theme, $template_slug, $template_file, $template_type ) {
138-
// Use wp_remote_get to retrieve the content of the template file.
139-
$response = wp_remote_get( $template_file );
140-
141-
// Check for errors in the response.
142-
if ( is_wp_error( $response ) ) {
143-
return $response; // Return the error if there's an issue.
144-
}
145-
146-
$content = wp_remote_retrieve_body( $response ); // Get the body content of the response.
147-
148-
// Create a new WP_Block_Template object.
149-
$template = new WP_Block_Template();
150-
$template->id = $theme . '//' . $template_slug;
151-
$template->theme = $theme;
152-
$template->content = $content;
153-
$template->slug = $template_slug;
154-
$template->source = 'plugin';
155-
$template->type = $template_type;
156-
$template->title = ucfirst( str_replace( '-', ' ', $template_slug ) );
157-
$template->status = 'publish';
158-
$template->has_theme_file = true;
159-
$template->is_custom = true;
160-
$template->modified = null; // Adjust as necessary.
161-
162-
return $template;
163-
}
164-
165-
166126
/**
167127
* For knowledge base search results, set posts_per_page 10.
168128
*

0 commit comments

Comments
 (0)