How to get all post titles starting with numbers and symbols?

Hook into the posts_where filter and add your condition to the query: add_filter(‘posts_where’, function($where){ global $wpdb; return “{$where} AND {$wpdb->posts}.post_title REGEXP ‘^[0-9\$\@\!\?\%]'”; // add other symbols in the regex above ^ }); Then do your query: $my_query = new WP_Query(…); You may want to remove the filter after you get the results (make it a … Read more

Getting URL Variables with a Rewritten Page (Login Page)

If you want instead of redirect to wp-login the user redirect to login page then use the following code. It will redirect user to login page where login form is present. add_filter(‘site_url’, ‘wplogin_filter’, 10, 3); function wplogin_filter( $url, $path, $orig_scheme ){ $old = array( “/(wp-login\.php)/”); $new = array( “login/”); return preg_replace( $old, $new, $url, 1); … Read more

Custom Post Type children and grand-children in one list

When i lost track with all the crappy code, i decided to start all over 🙂 And so i found the solution: <?php // Define variables $post_type=”file”; $taxonomy = ‘file-category’; $taxonomy_terms = get_terms($taxonomy); global $current_page_id; $current_page_id = get_the_ID(); // Start if if ($taxonomy_terms) { // Start Foreach foreach ($taxonomy_terms as $taxonomy_term) { // Start arguments … Read more

Is there a way to target only images within the loop?

That depends. There is the_post_thumbnail which will echo the “featured” image and get_children can grab all attachments. Certain kinds of images aren’t attached though, so you can’t easily get those. Reference http://codex.wordpress.org/Function_Reference/the_post_thumbnail http://codex.wordpress.org/Function_Reference/get_children

Transient Loop Not working as expected

What is the code on line 3645? You didn’t specify. From what I see in your code, $transient_name should be something like “_my_post_list_transient” – a string. If $transient_name is returning a post object, then your call to this function may be the problem.

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