Echo a list of all subscriber’s user IDs
Check out get_users(): $subscriber_ids = get_users( array( ‘fields’ => ‘ids’, ‘role’ => ‘subscriber’, ) ); foreach ( $subscriber_ids as $id ) echo “$id<br />”;
Check out get_users(): $subscriber_ids = get_users( array( ‘fields’ => ‘ids’, ‘role’ => ‘subscriber’, ) ); foreach ( $subscriber_ids as $id ) echo “$id<br />”;
html mark up for navigation will look like this <ul id=”menu-res” class=”main-menu”><li id=”menu-item-72″ class=”menu-item menu-item-type-custom menu-item-object-custom menu-item-72″><a href=”#home”>Home</a></li> <li id=”menu-item-238″ class=”menu-item menu-item-type-custom menu-item-object-custom menu-item-238″><a href=”#services”>Services</a></li> <li id=”menu-item-73″ class=”menu-item menu-item-type-custom menu-item-object-custom menu-item-73″><a href=”#about”>About</a></li> <li id=”menu-item-75″ class=”menu-item menu-item-type-custom menu-item-object-custom menu-item-75″><a href=”#skills”>Skills</a></li> <li id=”menu-item-346″ class=”menu-item menu-item-type-post_type menu-item-object-page menu-item-346″><a href=”http://www.yourstorepick.com/pro-site/”>Pro Site</a></li> <li id=”menu-item-347″ class=”menu-item menu-item-type-custom menu-item-object-custom menu-item-347″><a href=”http://www.yourstorepick.com/wp-signup.php?pro-site=1″>Sign up</a></li> … Read more
1st query: $exclude_post_top_stories=””; // WP_Query arguments $args = array ( ‘post_status’ => array( ‘publish’ ), ‘posts_per_page’ => ‘-1’, ‘order’ => ‘DESC’, ‘orderby’ => ‘date’, ); // The Query $exclude_query = new WP_Query( $args ); // The Loop if ( $exclude_query->have_posts() ) { while ( $exclude_query->have_posts() ) { $exclude_query->the_post(); // do something $exclude_post_top_stories[] = get_the_id(); } … Read more
On an author archive page (assuming the plugin uses the core archives) get_queried_object() will return the WP_User object for the author. Something like: $author = get_queried_object(); if (is_a($author, ‘WP_User’)) { var_dump($author->data); } You should see the login, nicename, and display name in there. Use what you need.
Use the following before $post->ID in your code: global $post
It may seem like WordPress is intelligently redirecting old URLs, but what it’s doing is just guessing, and mostly getting it right due to the nature of your posts and URL structure being unique enough for it to guess correctly. There are cases where it’ll get this guess wrong. You can see where it does … Read more
The WP_Query class can match IDs as well as search terms. An idea would be to use the pre_get_posts action to detect if the search term is numeric and, if it is, set the query to work with attachments while passing the search as the ID. function wpse223307_allow_search_by_attachment_id( $query ) { //Only alter the query … Read more
No, you cannot (easily) choose what tag ID is assigned. It’s not random – it’s the next ID available after the last one that was created in the database. If you really want to control tag IDs, you’ll need to clear your database and start fresh, and create each tag in the order you want … Read more
I believe the hook you’re looking for is body_class or post_class filter. These filter will allow you to remove or push classes into an array which will in turn display them on the body tag or post tag respectively. To add the post slug we could do something like this: /** * Add, Remove, and … Read more
On a seperate note, ‘caller_get_posts’ was deprecated in version 3.1 – use ‘ignore_sticky_posts’ with a boolean argument instead. ‘exclude’ is not a query argument so WordPress ignores it. Post exclusion via query is done using the key ‘post__not_in’ with a single post ID or array of IDs instead. However as @vancoder points out, the argument … Read more