Sort by multiple columns using get_posts
$args = array( ‘post_type’ => ‘event’, ‘meta_key’ => ‘start_date’, ‘meta_type’ => ‘DATE’, ‘orderby’ => array( ‘start_date’ => ‘ASC’, ‘menu_order’ => ‘ASC’, ) ); $posts = get_posts( $args );
$args = array( ‘post_type’ => ‘event’, ‘meta_key’ => ‘start_date’, ‘meta_type’ => ‘DATE’, ‘orderby’ => array( ‘start_date’ => ‘ASC’, ‘menu_order’ => ‘ASC’, ) ); $posts = get_posts( $args );
Based on your example there are 4 fundamental steps to take. I’ve tried to use examples below, and they may not work as is, but they demonstrate the fundamental principles needed: 1. Add a query var shorty This whitelists shorty and gives the 2c from /shorty/2c somewhere to be stored function shorty_query_vars( array $qvars ) … Read more
The code below suggests one approach to handling the display of a post image count on the Post Edit List screen (edit.php). The function names provide an outline of what the code is doing. References to WordPress Documentation are below for details about the action and filter hooks used. Add the code to your plugin … Read more
You site has been infected with malware. It will take some effort to clean it up, but it can be done. Basic steps are available via searching, and are out of scope for here, but to get started: Update WP core to latest, even if it already is. Update all themes and plugins. Remove plugins … Read more
Rename your plugins folder temporarily to disable all plugins. . If necessary, also rename your active theme’s folder, then upload WP core. Then reinstall WP manually (unzip to local, then upload) – saving your wp-config.php file first That should get you access to admin. Then follow the steps here to clean up your site: https://wordpress.stackexchange.com/a/415705/29416 … Read more
The save function of blocks only saves markup to the database (along with HTML comments, which WP uses to parse the HTML back into the Editor). To use JS on the front end with your block, you will need to create a separate JS file for what needs to run there, and enqueue it so … Read more
Update: Edited code to make it work function proccess_to_all_image($file) { $file_path = $file[‘file’]; $mime_type = $file[‘type’]; $id = attachment_url_to_postid($file[‘url’]); if (preg_match(‘/^image\/[a-z\-]+$/i’, $mime_type)) { *//call to function here* } return $file; } add_filter( ‘wp_handle_upload’, ‘proccess_to_all_image’, 10, 2);
It sounds like you’ll need to create the page templates with filenames such as tpl-calculator-1.php, tpl-calculator-2.php, etc. You then make sure to put a comment at the top of each template to give it a user-friendly name that will appear in the Editor: <?php /** * Template Name: Events Thank You */ Files named this … Read more
I was able to find the problem. There was a home.php file in my themes directory in wp-content. Due to the template hierarchy of WordPress, the blogs page was reading from this home.php file, where I had some HTML. Since I was the one who had created this file, on deleting it, the Posts page … Read more
Yes, if you are asked to create a feature branch, do that. If you already have code in your IDE, you may have the main branch. Creating a branch, you’ll create a copy of the code separate from the main branch, then make your commits to that feature branch.