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

How can I get this code to only output one link?

You need to break both foreach loops not just one, so add break 2; after the echo. $mycats = array(106, 107); foreach (get_the_category() as $childcat) { foreach ($mycats as $mycat) { if (cat_is_ancestor_of($mycat, $childcat)) { echo ‘<a href=”‘.get_category_link($childcat->cat_ID).'”>’ . $childcat->cat_name . ‘</a>’; break 2; } } }

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