Link categories to last post

This could be done with a ne walker class class Childcat2LastPost extends Walker_Category { function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) { if ( 0 != $category->category_parent ) { $args = array( ‘cat’ => $category->term_id, ‘orderby’ => ‘post_date’, ‘order’ => ‘DESC’, ‘post_type’ => ‘post’, ‘post_status’ => ‘publish’, ‘post__not_in’ … Read more

Problem importing categories and sub-categories

You have error in your PHP. This array(‘parent’, $id_parent) will produce numeric array with two values – string parent and value of $id_parent. What you actually need is array( ‘parent’ => $id_parent ) which will produce correct associative array with one entry of key parent and value $id_parent.

Re writing Category Argument

The codex explains this pretty well. <?php $args = array( ‘orderby’ => ‘slug’, // or name ‘order’ => ‘ASC’, ‘taxonomy’ => ‘types’ ); $categories= get_categories( $args ); ?>

Matching usermeta at registration to categories of content

Are you looking for this? function convertInterestCategory() { $interest_categories = array( ‘interest_disaster’, ‘interest_animals’, ‘interest_women’, ‘interest_seniors’, ‘interest_hunger_health’, ‘interest_education’, ‘interest_environment’, ‘interest_arts_culture’, ‘interest_children_youth’, ‘interest_other’, ‘interest_mentoring’, ‘interest_poverty_urban’ ); $current_user = wp_get_current_user(); $user_values = get_user_meta( $current_user->ID ); foreach ( $interest_categories as $interest_category ) { if ( isset( $user_values[$interest_category][0] ) ) echo $user_values[$interest_category][0]; } }

How do i hide categories from menus which don’t yet contain posts?

It depends which function you are using for querying those categories, but all of them has hide_empty argument for example for: <?php get_terms( $taxonomies, $args ); $taxonomies = array( ‘post_tag’, ‘my_tax’, ); $args = array( ‘hide_empty’ => true, ); ?> get_terms by default, hide_empty argument is empty so check if it’s false in you code.

Custom built theme won’t filter categories

The variable $theTitle is not interpolated in a single quote string. query_posts(‘category_name=.$theTitle&orderby=rand’); Will ask for exactly that string. $theTitle will not be replaced with a title and the dot (.) will remain in the query. The result will be unpredictable. So, use a double quoted string: query_posts( “category_name={$theTitle}&orderby=rand” ); Or change the order of the … Read more

How to use Greek characters/letters in a query?

This is the loop I’ve created to display post’s matching criteria on empty page: // get results $the_query = new WP_Query( ‘meta_key=apaitei_logariasmo_facebook&meta_value=Ναι’ ); // The Loop if( $the_query->have_posts() ) while ( $the_query->have_posts() ) { $the_query->the_post(); echo ‘<h3>’; the_title(); echo ‘</h3>’; the_content(); } wp_reset_postdata(); It works. Look at the image: Note: my site’s language is English … Read more

Formating content in category.php

You might try the the_content filter with the conditional tag is_category() to append a string to the post content when viewing the category archives : add_filter( ‘the_content’, ‘custom_the_content’ ); function custom_the_content( $content ){ if( is_category() ): $metastime = get_post_meta( get_the_ID(), ‘user_submit_starttime’, true ); $metaetime = get_post_meta( get_the_ID(), ‘user_submit_endtime’ , true ); $metaloc = get_post_meta( get_the_ID(), … Read more