meta-key

I'm collecting meta key data, and I want to display it in the WordPress dashboard

我的梦境 提交于 2020-04-18 05:46:03
问题 I found, and modified this for my needs, and put it in my functions.php: add_filter( 'manage_edit-shop_order_columns', 'MY_COLUMNS_FUNCTION' ); function MY_COLUMNS_FUNCTION( $columns ) { $new_columns = ( is_array( $columns ) ) ? $columns : array(); unset( $new_columns[ 'order_actions' ] ); //edit this for your column(s) //all of your columns will be added before the actions column $new_columns['dname'] = 'Dogs Name'; $new_columns['additional_allergies'] = 'Allergies'; //stop editing $new

subtract array values from each other creating new array

偶尔善良 提交于 2019-12-25 02:27:09
问题 On my site I have the following code, which grabs values from a form and creates a text file with a list of my image paths and duration times. -- /* This is for looping through the uploaded pictures and sorting them and creating a text file. */ $vid_pix = get_post_meta($v_Id, 'vid_pix', false); $data = "ffconcat version 1.0"; $line = ''; usort( $vid_pix, function( $a, $b ){ $aPor = (int) get_post_meta( $a, 'photo_order', true ); $bPor = (int) get_post_meta( $b, 'photo_order', true ); if (

How do I query posts and use the 'orderby' attribute to order posts in loop according to date 'meta_value'?

浪尽此生 提交于 2019-12-18 09:36:33
问题 I am creating a website for a theatre company, and I am creating an index of all past, current, and future productions. I would like the index to 'orderby' the ending date of each production (ACF 'date' field type; 'ending_date'). Here is an example of my query: <?php $futureProd = array( 'post_type' => 'productions', 'posts_per_page' => -1, 'meta_key' => 'ending_date', 'orderby' => 'meta_value', 'order' => 'ASC', ); $slider_posts = new WP_Query($futureProd); $array_rev = array_reverse(

Display results of one meta key and order by a different meta key

久未见 提交于 2019-12-13 03:38:30
问题 On a used car dealership website, I have a PHP Query that displays all results for the relevant vehicle model. So if you visit the "Honda Civic" page it will display all the vehicles listed as a Civic. Currently, I'm using the following query: $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $args = array( 'post_type' => array('vehicle'), 'post_status' => 'publish', 'orderby' => 'date', 'order' => 'ASC', 'posts_per_page' => 10, 'paged' => $paged, 'meta_key' => 'model', 'meta

WP_Query - filter by multiple meta values and order by other meta values

寵の児 提交于 2019-12-08 10:47:09
问题 I'm trying to query posts using WP_Query and meta_query parameters: $args = array( 'post_type' => 'produkty', 'meta_query' => array( 'relation' => 'AND', array( 'key' => 'produkt_aktywny', 'value' => '1', 'compare' => '='), array( 'key' => 'produkt_dostepnosc', 'value' => '1', 'compare' => '=') ) ); $query = new WP_Query( $args ); What should I add to order the results by two other keys ('produkt_kategoria' and 'produkt_cena')? There's nothing about it in WP Codex, but this: "Do you know how

Vim multiple meta keys

為{幸葍}努か 提交于 2019-12-07 13:30:51
问题 Update: It turns out to be a bug in MacVim (or perhaps a feature that has yet to be implemented). I am trying Vim, coming from TextMate. TextMate has a Ruby plugin where you can type Control + Command + Shift + E , and it will find all the lines in your file that contain "# => ", and it will update them with the inspected result of that line. I have found the library they use to do this, it's called xmpfilter, and comes with rcodetools. So I can get Vim to do the same behaviour by typing

Vim multiple meta keys

妖精的绣舞 提交于 2019-12-05 19:54:43
Update: It turns out to be a bug in MacVim (or perhaps a feature that has yet to be implemented). I am trying Vim, coming from TextMate . TextMate has a Ruby plugin where you can type Control + Command + Shift + E , and it will find all the lines in your file that contain "# => ", and it will update them with the inspected result of that line. I have found the library they use to do this, it's called xmpfilter, and comes with rcodetools . So I can get Vim to do the same behaviour by typing "mzggVG:!xmpfilter -a" which will highlight the whole file, go to last line mode, and pass the contents

How to order by multiple meta keys?

拟墨画扇 提交于 2019-11-30 12:40:10
问题 I’m using a custom loop to display my events on a page, I get it fine ordering by the event start date using the below: $args = array( 'post_type' => 'event', 'order' => 'ASC', 'orderby' => 'meta_value', 'meta_key' => '_event_start_date'); $loop = new WP_Query( $args ); But the meta_key option only allows one value. How to use two values ( _event_start_date and _event_start_time )? 回答1: This is something that WordPress added support for in 4.2: https://make.wordpress.org/core/2015/03/30/query

How to update user meta for multiple meta_key in wordpress

不羁的心 提交于 2019-11-30 04:55:25
问题 I'm trying to update multiple meta_key for user in WordPress update_user_meta( $user_id, array( 'nickname' => $userFirstName, 'first_name' => $userFirstName, 'last_name' => $userLastName , 'city' => $userCityID , 'gender' => $userGenderID) ); but it is not working. How can we update multiple meta_key for user? 回答1: Try: <?php $user_id = 1234; $metas = array( 'nickname' => $userFirstName, 'first_name' => $userFirstName, 'last_name' => $userLastName , 'city' => $userCityID , 'gender' =>

How to order by multiple meta keys?

ぃ、小莉子 提交于 2019-11-30 03:16:50
I’m using a custom loop to display my events on a page, I get it fine ordering by the event start date using the below: $args = array( 'post_type' => 'event', 'order' => 'ASC', 'orderby' => 'meta_value', 'meta_key' => '_event_start_date'); $loop = new WP_Query( $args ); But the meta_key option only allows one value. How to use two values ( _event_start_date and _event_start_time )? This is something that WordPress added support for in 4.2: https://make.wordpress.org/core/2015/03/30/query-improvements-in-wp-4-2-orderby-and-meta_query/ In your case you'll probably want to do something like this: