How to return value from sql and display it

If you need to return one value then use get_var instead of get_row. get_var will return a string. get_row will return an array or object. $spr_liczbe_wodo = $wpdb->get_var (“select liczba_wodo from wp_ow_adres where adres=”Street 12/6″”); var_dump($spr_liczbe_wodo); The problem with your code, by the way, is that $spr_liczbe_wodo is an object, but when you loop over … Read more

Divide WP_Query posts by date & post type

The post_type isn’t really a meta query – therefore, both of these post_types would at least 1 category added/queried in order to get the filter invoked – using plain SQL is still a last resort. add_filter( ‘posts_groupby’, ‘my_posts_groupby’ ); function my_posts_groupby($groupby) { global $wpdb; $groupby = “{$wpdb->posts}.post_date”; return $groupby; } According to your example (I’d … Read more

Adding page subdirectory dynamically, as like buddypress does

This should do what you want: add_action(‘generate_rewrite_rules’, ‘wpse128082_add_rewrite_rule’); function wpse128082_add_rewrite_rule($wp_rewrite) { $new_rules = array( ‘^charts/(.*)’ => ‘index.php?pagename=charts&something=’.$wp_rewrite->preg_index(1), ); $wp_rewrite->rules = $new_rules + $wp_rewrite->rules; } add_filter(‘query_vars’, ‘wpse128082_add_query_var’); function wpse128082_add_query_var($query_vars) { $query_vars[] = ‘something’; return $query_vars; } On your Charts page, you can access the new query var with get_query_var(‘something’).

meta_query dates from an array

If you store the meta as a serialized array, you should do meta query like this: $args = array( ‘post_type’ => ‘income’, ‘meta_query’ => array( array( ‘key’ => ‘income_dates’, ‘value’ => “2014-02-01”, ‘compare’ => ‘LIKE’ ), ) );

No content found on page 2 of pagination with 1 post per page

I don’t know what largo_content_nav() does but you clobber the main query here: query_posts(‘posts_per_page=1’); And then several lines later attempt to paginate (or so the function name and argument suggest): largo_content_nav( ‘nav-below’ ); If largo_content_nav uses the global variable $wp_query which I kind think it must since you don’t pass it a WP_Query object, then … Read more