Wordpress:使用页面作为“块”来调用模板

Sometimes I need to insert in the template a "block" of text (and images) that must be editable by the clients from the backend (they're obviously not able to coding). To solve I used to create a new Page in the backend and simply call it in the template with:

<?php
$block = get_page( $id ); 
echo '<h3>'. $block->post_title .'</h3>';
echo apply_filters('the_content', $block->post_content);
?>

Then, since that page is not a standard page that haven't to be displayable as single page, I set it to Visibility=Private and no index in the SEO plugin.

Is this a correct way to do what I need? Or is there a better one? Let me know, thank

As with all things Wordpress, there are different ways to do it depending on how far you want to go in customizing your clients' experience. A simple way to solve this issue is to turn that area of your template into an area that accepts widgets and then add a plugin that provides a widget that supports rich text editing. Your clients can then simply edit the text and images through the widget interface.

It sounds like you're already editing template files, so the link above takes you directly to the code you'll need in functions.php and your template file. But if you need more background, also read the docs on Child Themes.