How to add template colors to custom block options in WordPress Gutenberg editor sidebar?

How can I add template colors (i.e., those black and pastel shades) to ColorPalette (“Input border color”)? In Gutenberg, you can get the block color palette in two ways: Use getSettings() in the block editor’s data (core/block-editor). E.g. import { select } from ‘@wordpress/data’; const colorPalette = select( ‘core/block-editor’ ).getSettings().colors; // PS: You can also … Read more

How to create templates for a custom module to show on the front end within my theme?

Templates in wordpress just needs to be valid PHP files. You need to place your template inside theme ( or child theme directory ). Have you placed the template in plugin directory ? if yes it won’t work. https://gist.github.com/gmazzap/1efe17a8cb573e19c086 Template file set via setTemplate must be in theme (or child theme) folder. For more details … Read more

How to call a function using a shortcode [closed]

Step 1 Define your shortcode callback function. You can find some examples for generating the output here. function your_shortcode_callback( $atts ) { // if attributes as used with shortcode, then do something with $atts // get data $enrolled_course = tutor_utils()->get_enrolled_courses_by_user(); // do something to turn the data into html string $output_html=””; // callback should return … Read more

Plugins and caching

Well this is the whole point of cache plugins. Caching plugins let the page load normally, with all plugins, and then saves the result as a static HTML page. Future requests for a specified period of time, or until the cache is emptied, will be sent directly to that HTML file. This allows the page … Read more

Will I get an error if I try unscheduling a WP Cron scheduled task that wasn’t scheduled?

So yeah, it does give errors for trying to unschedule something that isn’t scheduled, but the answer is pretty easy and simple: $timestamp = wp_next_scheduled( ‘scheduled_hook’ ); if ($timestamp) wp_unschedule_event( $timestamp, ‘scheduled_hook’ ); Since wp_next_scheduled will return false for unscheduled hooks, a simple if in front of the call to wp_unschedule_event will prevent it from … Read more

Associate multiple email addresses with the same user account, so they can log in with either

If you create them programmatically, you could set it up so that all of the usernames are one type of email address (business or personal) and the WP email address field contains the other type. It’s not clear if this would fit your particular use case, but one other login possibility is to integrate single … Read more