How to make content as required in custom post type?

the content_save_pre filter. It checks the post type of the current post and ensures that the content field is not empty. If the content field is empty, the function calls wp_die() to display an error message and stop the post from being saved. Note: Make sure to replace “custom_post_type” with the actual name of your … Read more

Full site editing templates folder vs block-templates

After some more checking, I found the issue. The repo I was setting up, was a template that will be used by other sites, so I saved it in a folder called templates (Full path: /Users/bas/git/work/templates/wp). In the wp-includes/block-template-utils.php the name/slug of the template is decided with the following code. $template_slug = substr( $template_file, // … Read more

How can I produce multiple webpages with a different output based on one entry/Page/custom Page?

Query string parameters are a helpful friend in this situation. It will allow you to keep the same single-$posttype.php file for both formats of the page. So if someone visits your page using the URL: https://yourwebsite.com/events They will see your normal webpage for visitors. But if someone uses the URL: https://yourwebsite.com/events?seminar=true They will see something … Read more

Homepage not loading correctly, only after refreshing

You can change your current theme to storefront and check whether the scripts and styles are properly enquequed. use this format to enqueque style and scripts and inspect the code for debugging class yourPluginName { public function __construct() { add_action(‘wp_enqueue_scripts’, array($this, ‘enqueue’)); } public function enqueue() { wp_enqueue_script(“jquery”); wp_enqueue_script(‘my-js’, plugins_url(‘/script.js’, __File__)); wp_enqueue_style(‘my-theme’, plugins_url(‘/style.css’, __File__)); }