Get only modified posts

You can use the posts_where filter: // Add custom filter add_filter( ‘posts_where’, ‘wpse_modified’ ); // Fetch posts $query = new WP_Query( $lastupdated_args ); where you can define the filter callback as: function wpse_modified( $where ) { global $wpdb; // Run only once: remove_filter( current_filter(), __FUNCTION__ ); // Append custom SQL return $where . ” AND … Read more

Get post ID outside of the loop

here is a function that does just that: function get_lastest_post_of_category($cat){ $args = array( ‘posts_per_page’ => 1, ‘order’=> ‘DESC’, ‘orderby’ => ‘date’, ‘category__in’ => (array)$cat); $post_is = get_posts( $args ); return $post_is[0]->ID; } Usage: say my category id is 22 then: $last_post_ID = get_lastest_post_of_category(22); you can also pass an array of categories to this function.

Delete Post Link to delete post, its meta and attachments

Try using these delete links instead. Yours don’t seem to be formatted right. For delete: $delLink = wp_nonce_url( admin_url() . “post.php”, “post=” . $post->ID . “&action=delete”); For trash: $delLink = wp_nonce_url( admin_url() . “post.php”, “post=” . $post->ID . “&action=trash”); EDIT: No try this instead: $post_type = get_post_type($post); $delLink = wp_nonce_url( admin_url() . “post.php?post=” . $post->ID … Read more

Filter posts by author and category simultaneously

If you want your visitors to choose the category and author you can use the code below. If your loop in the template hasn’t been changed you should get away with adding a query to the URL like so: http://website.com/post-title/?author=1&cat=1 If you have a custom query you could do the following: $author = $_GET[‘author’]; //Get … Read more

Get current users post URL?

Well if your code is working properly and the only problem is that it displays when no one is logged in then try the code below. Because right now you are saying “Hey WP just echo out this” – so it does it. You need to change it to: “Hey WP if the user is … Read more

How do I change the gallery that is inserted in the post?

You can filter the default gallery shortcode. Here is something I’ve used in the past. add_filter( ‘post_gallery’, ‘wpse_gallery’, 10, 2 ); function wpse_gallery() { global $post; /* Orderby */ if ( isset( $attr[‘orderby’] ) ) : $attr[‘orderby’] = sanitize_sql_orderby( $attr[‘orderby’] ); if ( !$attr[‘orderby’] ) unset( $attr[‘orderby’] ); endif; /* * Extract default gallery settings … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)