How to get all users by custom current user meta (array)?
This function will give you the ids of blocked users get_user_meta( $user_id, ‘_block’, true ); here $user_id is yours
This function will give you the ids of blocked users get_user_meta( $user_id, ‘_block’, true ); here $user_id is yours
not sure where the code snippet is placed, and where you are trying to access it from. A simple (but ugly) solution might simply be to set this array to be global. Something like $GLOBALS[‘leftids’] = $leftids; and then from the other code use global $leftids; echo $leftids[0];
Using shortcode to display array in array
At first glance, I would think your query isn’t correct. Are you echoing out the variables to make sure they are correct? If you are setting ‘post_per_page’ => 4 and you are getting 5 posts, then something seems a bit off. Where it is a number, I believe you can leave off the quotes around … Read more
I believe that you’re looking for the get_bookmarks() function, which returns an array of bookmark objects. You could then implement this into your code: <?php // Get RSS Feed(s) include_once(ABSPATH . WPINC . ‘/feed.php’); $bookmarks = get_bookmarks(); $rsslist = array(); foreach ( $bookmarks as $bm ) { if ( $bm->link_rss ) $rsslist[] = $bm->link_rss; } … Read more
I hate writing “you can’t do that” answers, but you can’t. That is the strict answer to your question about whether you can do this with a single WP_Query. You can’t limit post type counts individually in the same query using WP_Query (You are actually using query_posts. Please don’t. It is not the right tool … Read more
I think you are having same issue as I was having earlier. In this question. So here is the fixed code. This should work. I replaced both of these functions with get_the_date and get_the_excerpt. For the detailed explanation why/why not this work, read @kaiser’s answer in same question. <?php $args = array( ‘posts_per_page’ => 5, … Read more
Sort alphabetically by custom field
The get_theme_mod() function works the following: It fetches the get_theme_mods() function under the hood. This returns the following data $theme_slug = get_option( ‘stylesheet’ ); get_option( “theme_mods_{$theme_slug}” ); So in case you upgrade, write an upgrade function specific for that version of your plugin or theme, that uses one of the following, where the name is … Read more
Untested and semi-pseudo code obviously. The idea is that a meta query is already an array of arrays, each field in your form is another nested array. If a value exists we push it onto the array. <?php $_location = $_GET[‘location’] != ” ? $_GET[‘location’] : ”; $_status = $_GET[‘status’] != ” ? $_GET[‘status’] : … Read more