Disable publish button when post title is empty

function disable_publish_button($post){ if(!$post){ return; } if(‘publish’ === $post->$poststatus && $post->post_title === ”) { } }; add_action( ‘post_submitbox_start’, ‘disable_publish_button’, 10 ); I’m new to WordPress theme development. I want the publish button to be disabled when the post title is empty. I had written a hook for this but I was stuck at accessing the publish…

Ajax Call: Problem with filter in Article & Articles Model in Module Context

I currently have a problem with an ajax call in my new module. the filters are not used. Here is an extract of the relevant lines: $articleid = $data_decoded->articleid; // Get an instance of the generic articles model require_once(JPATH_ADMINISTRATOR . ‘/components/com_content/models/articles.php’); $model = JModelLegacy::getInstance(‘Articles’, ‘ContentModel’, array(‘ignore_request’ => true)); $model->setState(‘filter.article_id’, $articleid); return $model->getItems(); $articleid contains the…

How can I access the Gateways services?

I have been trying to access craft\commerce\services\Gateways; from a plugin but I can’t figure out how I need to access it. I’ve used the following: $gateways = Commerce::getInstance()->commerce->getAllGateways(); $gateways = craft\commerce\services\Gateways::getAllGateways(); The first one says Getting unknown property: craft\commerce\Plugin::commerce and the second one tells me Non-static method craft\commerce\services\Gateways::getAllGateways() should not be called statically Can anyone…