custom data model – link and populate from admin backend
custom data model – link and populate from admin backend
custom data model – link and populate from admin backend
I’m answering this question to help future WordPress developers on their quest for knowledge. The answer is YES, you can connect to an external database when using the admin_post action. Below is the corrected source… <?php class x94 { private $externalDB01; public function __construct(){ add_action( ‘admin_post_submitForm9’, array( $this, ‘formHandling’ ), 11, 1 ); add_action( ‘plugins_loaded’, … Read more
Am I right to think colorpicker is still supported and just disabled? Yes, it is still supported; however, it’s not disabled, and it’s actually loaded by default by WordPress, because the textcolor plugin (which is also loaded by default by WordPress) depends on the colorpicker plugin. I was hoping just adding the button would work. … Read more
You don’t need to create any taxonomies or use directors as taxonomy. All you need is to add director_id field to movies. So when you edit a movie, you can select it’s director. Later you can use meta queries to show all movies directed by given person.
In the loop you’ll want to get the posts terms. Then instead of echo’ing, return the output and group it into an array where the keys are the categories. Then loop through the grouped array and output your categories and related posts. Something similar to: // to hold and sort your output $categories = array(); … Read more
You could add a filter to the post publish process in site A. The filter would check for the tag/category, and if found, run a process to create a post in Site B. See https://codex.wordpress.org/Plugin_API/Action_Reference/save_post . Something like: add_action( ‘save_post’, ‘my_site_b_create_post’ ); function my_site_b_create_post($post_id) { // check for category // if category, then save content … Read more
You can use the wc_get_template filter, which allows you to override the absolute filepath to a template just before it’s included. For example, this overrides checkout/payment.php: add_filter( ‘wc_get_template’, function ( $file, $name ) { if ( $name === ‘checkout/payment.php’ ) { // $file must be an absolute filepath // e.g. path relative to current file … Read more
Adding an action doesn’t do anything except putting the callback function in the queue of the corresponding hook. It doesn’t check if the function exists, let alone load a file where the function is resident. Only when the corresponding hook is fired PHP looks for the function. If it is not loaded by then it … Read more
You can hook before the template is loaded and output page content directly: function wpd_output_json_page(){ if( is_page( ‘Page Json’ ) ){ global $post; echo $post->post_content; die; } } add_action( ‘template_redirect’, ‘wpd_output_json_page’ );
Okay, I’ve had two big projects where I’ve been in control of the server enough to namespace and rely on autoloading. First up. Autoloading is awesome. Not worrying about requires is a relatively good thing. Here’s a loader I’ve been using on a few projects. Checks to make sure the class is in the current … Read more