Require featured image

I would do this by hooking into the save_post action, not by javascript. The main idea is to check if both values are there (Your Radiobutton is selected AND the post_thumbnail is present), and set the post to draft if they are not, as well as displaying an Information if the user does not fulfill … Read more

Add custom shortcode button to Editor

I found it, WordPress made changes and you can now add buttons through a simple API if( !function_exists(‘_add_my_quicktags’) ){ function _add_my_quicktags() { ?> <script type=”text/javascript”> /* Add custom Quicktag buttons to the editor WordPress ver. 3.3 and above only * * Params for this are: * string id Required. Button HTML ID * string display … Read more

How to overwrite a JavaScript core function?

You can’t. While manipulation of JS and HTML is possible, it is not adviceable as a long term strategy unless it was explicitly document as “the right way” in the codex, code comment, or some other core document. In addition to the theoretical objection, right now it is hard or almost impossible to override specific … Read more

Lightbox popup on WooCommerce add_to_cart action

The following works for me for product archive pages (these include both the main shop page as well as archive pages for product categories, for example). It will show the current cart contents in a thickbox. I chose to show this for this example just because that’s the data that one gets back through Ajax … Read more

WordPress Ajax URL for function in functions.php

//ajax call var data = { action: ‘folder_contents’, path: datafolder }; var ajaxurl = baseurl + ”; //WHAT IS THIS?!?! jQuery.post(ajaxurl, data, function(response) { alert(‘Got this from the server: ‘ + response); console.log(response); }); And your PHP in functions.php //Called by Ajax from App – list the contents of the folder so they can be … Read more