0

I want to make a website with an editable front page for a client with no coding knowledge, the client should be able to edit the front page in the site editor like a regular page, but should be able to use pre-made template parts I made in the theme, so the client would be able to use those pre-made template parts in the page, and choose if to add them, change their location in the page, and pass pre-made parameters for the template parts settings (all from the page editor, like the new Gutenberg blocks, but with template parts).

Is their a built in way / plugin to do it?

Or should I tell the client to add special keywords in the page content and then parse manually the the_content() value and replace the keywords with get_template_part();?

Is there a better Wordpress mechanism of doing that?

Thanks.

7
  • 1
    Everything you asked for is a core feature of block themes and the block editor aka template parts. It's already possible in the default theme twentytwentytwo/three without writing a single line of code. There are also block patterns for when you want to give the user editable sets of blocks, and you can lock them in place so the user can't break their layout. Nevermind the block patterns feature or the reusable blocks feature. None of these features are available in the classic editor though, so you're severely limiting your options.
    – Tom J Nowell
    Commented Jan 9, 2023 at 12:41
  • @TomJNowell sorry for the silly questions, I'm new to Wordpress. How was it traditionally done before the block themes? and in case I will use blocks, as far as I understand I cant use php in the blocks, so how would I use all the wp functions?
    – ATP
    Commented Jan 9, 2023 at 12:52
  • in the strictest of sense, it wasn't, those features are new. You might have equivalent features inside page builder plugins, and there are alternatives that require the use of code, but no direct equivalent to what block themes do exists. The closest is possibly shortcodes, but keep in mind, these are not the answers, this is just a comment, and I cannot explain how in a comment. Also that is not true, you can write blocks that display using PHP, but usually using PHP for that is actually a mistake as the dev doesn't realise composing multiple locked blocks is a superior strategy
    – Tom J Nowell
    Commented Jan 9, 2023 at 13:17
  • I will reiterate though, by keeping strictly to the classic editor, especially as someone new to WordPress, you're playing on extra hard difficulty. Classic editor users normally have additional plugin frameworks and page builders that have their own unique solutions and strategies. The classic editor is also not receiving new features or support for new features, and hasn't for several years now. If you are doing this because you are under the impression you have to in order to use PHP, that is incorrect. Block themes and templates can use PHP, and classic themes can use block templates
    – Tom J Nowell
    Commented Jan 9, 2023 at 13:22
  • @TomJNowell thanks for your replies, seems like shortcodes are what I'm searching for. about your second comment, how can I integrate php in blocks? all the information I saw online is about creating static blocks, (one of my blocks should look for data in the DB for example, how should it be done with blocks?)
    – ATP
    Commented Jan 9, 2023 at 13:30

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.