Remove admin menu links for multiple users by email
Correct usage: $arr = array(‘[email protected]’,’[email protected]’); in_array($user->user_email, $arr)
Correct usage: $arr = array(‘[email protected]’,’[email protected]’); in_array($user->user_email, $arr)
OK, I have no idea how and why your code should work… It has nothing in common with correct PHP syntax… But it’s pretty good pseudo-code, so I think I can guess, what you wanted to achieve… $tax_query = array(); if ( have_rows(‘category_taxonomies’) ) { while ( have_rows(‘category_taxonomies’) ) { the_row(); $tax_query[] = array( ‘taxonomy’ … Read more
Try this code: function cf_description_to_content($post_ID){ $data = get_post_meta( $post_ID, ‘wiloke_listgo_my_custom_fields’, true ); // Put whatver description you want assign to the description field $data[‘description’] = $_POST[‘wiloke_listgo_my_custom_fields’]; update_post_meta( $post_ID, ‘wiloke_listgo_my_custom_fields’, $data ); } add_action(‘save_post’, ‘cf_description_to_content’, 100, 1);
Looking at the orderby parameter on WP_Query, I don’t see any way to do this. You could (as Peter HvD suggests in his answer) convert your face cards to numbers; but if you want to keep the K|Q|J values, I’d recommend using a usort() callback: // Assuming that $cartas->posts contains your posts usort( $carta->posts, ‘wpse313015_sort_cartas’ … Read more
I was able to answer my question thanks to : https://wpquestions.com/Remove_duplicates_from_ACF_query/12685 <?php $posts = get_posts(array( ‘numberposts’ => -1, ‘post_type’ => ‘page’, ‘orderby’ => ‘meta_value’, ‘order’ => ‘ASC’, )); if($posts) { /* FIRST, get all the post data */ foreach($posts as $post) { /* SECOND, one-by-one, add each data row for the specific field into an … Read more
In is_page you are passing an array with one element that is also an array. Since $result is already an array, you should do if ( is_page( $result ) ){
You are using get_the_id() template tag without proper loop. Your code should be something like this <?php // Get any existing copy of our transient data $suggest = get_transient(‘suggest’); if ( false === ( $suggest = get_transient( ‘suggest’ ) ) ) { // It wasn’t there, so regenerate the data and save the transient $suggest … Read more
This seems more like a PHP programming question, but yes as you guessed in PHP if you want the value of a variable you just need $var. echo $var outputs it and will cause a syntax error how you’ve used it. Otherwise everything else looks ok, although obviously I can’t say if that data structure … Read more
Solved issue of dynamic function name by using $shortcode var as function name foreach ($shortcodes as $shortcode) { add_shortcode($shortcode, function ($atts) use ($shortcode) { $filepath = str_replace(‘_’, ‘-‘, $shortcode); ob_start(); require_once(get_stylesheet_directory() . ‘/template-parts/’ . $filepath . ‘.php’); return ob_get_clean(); }); }
According to the documentation, you would have to use post_parent => 0 So your code would look like this: <div class=”owl-carousel owl-theme”> <?php $c = 0; $q2 = new WP_Query( array( ‘post_type’ => array( ‘post’, ‘book’ ), ‘post_status’ => ‘publish’, ‘post_parent’ => 0, //add this here ‘orderby’ => ‘modified’, ‘order’ => ‘desc’ ) ); while … Read more