Display new posts categories in separated divs

You should first make a query to retrieve all your categories. This can be done using: $categories = get_categories(array(‘hide_empty’=> 0,)); Now that you have a list of your categories as object, you have to run a foreach to output their content: foreach ($categories as $category) { $params = array( ‘posts_per_page’ => -1, ‘post_type’ => ‘product’, … Read more

WP_Query extended with AJAX

this is my geo_query extension of wp_query: add_filter( ‘posts_fields’, ‘willy_geo_fields’, 10, 2 ); function willy_geo_fields( $fields, $q ) { if ( isset( $q->query_vars[‘geo_query’][‘latfrom’], $q->query_vars[‘geo_query’][‘lngfrom’], $q->query_vars[‘geo_query’][‘latto’], $q->query_vars[‘geo_query’][‘lngto’], $q->query_vars[‘geo_query’][‘distancefrom’], $q->query_vars[‘geo_query’][‘distanceto’] ) ) { global $wpdb; $fields .= $wpdb->prepare(“, ( 6371 * acos( cos( radians( %f ) ) * cos( radians( metalatfrom.meta_value ) ) * cos( radians( metalngfrom.meta_value … Read more

Post by Email – Shortcode for Language? [closed]

I haven’t found a way to get Jetpack and Polylang to properly work together when it comes to pushing posts by mail into the desired language category. But, i have found a plugin that offers that called Postie. The Polylang addon costs 29$. http://postieplugin.com/

Get Categories & Posts With Type Article

I solved this with following code: $currentCategoryId = wp_get_object_terms($post->ID, ‘article-category’, array(‘fields’ => ‘ids’)); if (is_array($currentCategoryId) && !empty($currentCategoryId[0])) { $currentCategoryId = (int)$currentCategoryId[0]; } $cat_args = array( ‘taxonomy’ => ‘article-category’, ‘orderby’ => ‘menu_order’, ‘order’ => ‘ASC’, ‘hierarchical’ => true, ‘parent’ => 0, ‘hide_empty’ => true, ‘child_of’ => 0 ); $get_categories = get_categories( $cat_args ); $categories = array(); … Read more

Set featured image on creating new post

Ok, it’s my fault. I’ve installed a “blank”-theme to have a blank frontend (because I only use the API) – but I didn’t realize that a theme changes something in the Admin Frontend. By adding this to the functions.php I re-enabled the box: add_theme_support(‘post-thumbnails’);