$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>customization - Custom Blocks as part of a theme|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

customization - Custom Blocks as part of a theme

matteradmin9PV0评论

I'm new to wordpress, but I'm a pretty competent developer. I'm trying to nail down what my client can do to their site. My idea was to create some special 'blocks' for them, which provide the page sections they need with minimal editing requirements.

I know you can create custom blocks with a plugin, but can I create them as part of a theme? If so, can anyone provide me with a link to some helpful information about how to do it?

How would one remove the custom block when the theme is deactivated?

Thanks in advance.

I'm new to wordpress, but I'm a pretty competent developer. I'm trying to nail down what my client can do to their site. My idea was to create some special 'blocks' for them, which provide the page sections they need with minimal editing requirements.

I know you can create custom blocks with a plugin, but can I create them as part of a theme? If so, can anyone provide me with a link to some helpful information about how to do it?

How would one remove the custom block when the theme is deactivated?

Thanks in advance.

Share Improve this question asked Feb 20, 2019 at 0:32 RichardRichard 1835 bronze badges
Add a comment  | 

1 Answer 1

Reset to default -1

Since you don't explain what functionality you're trying to achieve, I assume you want to do one of these thing.

If you're going to put that block in the post content you can achieve that by using WordPress shortcode

If you're going to use that block as part of the layout, you might want to use custom widgets instead.

And both of them can be coded as a standalone plugin or coded in the theme as well. Putting it as a separate plugin means that the user needs to deactivate the plugin if he/she wants to remove the functionality, and if you put it in the theme code, the functionality will just disabled when the theme is deactivated.\

I hope that helps.

Articles related to this article

Post a comment

comment list (0)

  1. No comments so far