Get first URL from post content

I think this question might put you in the right direction. In case that link is broken, here’s the answer as provided by Jon Fabry in that thread. $post_link = get_the_permalink(); if ( preg_match(‘/<a (.+?)>/’, get_the_content(), $match) ) { $link = array(); foreach ( wp_kses_hair($match[1], array(‘http’)) as $attr) { $link[$attr[‘name’]] = $attr[‘value’]; } $post_link = … Read more

Filtering post-formats from the loop using new WP-Query();

You should be able to exclude posts with a specific format using WP_Query’s tax_query parameter. Eg. $q_args = array( ‘posts_per_page’ => 1, ‘tax_query’ => array( array( ‘taxonomy’ => ‘post_format’, ‘field’ => ‘slug’, ‘terms’ => array( ‘post-format-link’ ), ‘operator’ => ‘NOT IN’ ) ) ); $featured->query( $q_args ); Untested, but should do the trick..

Checking post format during xmlrpc_publish_post

This is because of a variable mismatch. Your function accepts $post_ID, but you don’t actually use it. You’re instead trying to reference a global $post object and doing your post format check with $post->ID. With the XML-RPC request, this won’t work. Rewrite your function to use get_post() to fetch a post object from the passed-in … Read more

How to query for posts without a post_format

You have to query post that has no post format attached: $args = array( ‘post_type’ => ‘post’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘post_format’, ‘field’ => ‘slug’, ‘operator’ => ‘NOT IN’, ‘terms’ => get_terms(‘post_format’) ) ) ); To improve performance you can hardcoding the post format instead of using get_terms to retrieve them: $args = … Read more

Query different number of posts with different formats in one go

This isn’t possible in one query. You can’t set posts per page for individual taxonomy queries. You can either query 12 status or aside posts together: array( ‘posts_per_page’ => 12, ‘tax_query’ => array( array( ‘taxonomy’ => ‘post_format’, ‘field’ => ‘slug’, ‘terms’ => array( ‘post-format-status’, ‘post-format-aside’ ), ), ), ) Or perform separate queries with get_posts() … Read more

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