Sort categories by meta value

This is no solution, just an explanation: WordPress currently doesn’t have taxonomy meta data. You could add a stand alone table to add meta data there. Anyway, it’s not recommended to add your taxonomy/category/tag meta data to the options table as this one wasn’t made to get JOINed to do meta queries by it. My … Read more

Display one result for category post type

Did you create taxonomy-{your-slug}.php template ? let’s say the slug is ‘locations‘ so, it will be something like this taxonomy-locations.php if you haven’t created yet, create one and the template codes will look like this , <?php /** * Locations taxonomy archive */ get_header(); $term = get_term_by( ‘slug’, get_query_var( ‘term’ ), get_query_var( ‘taxonomy’ ) ); … Read more

Display post from specific category

Take a look at multiple loops for examples And also look at the content.php file in the Twenty Fourteen theme <?php // The Query $category_query = new WP_Query( ‘category__in=11’ ); // The Loop if ( $category_query->have_posts() ) { echo ‘<ul>’; while ( $category_query->have_posts() ) { $category_query->the_post(); echo ‘<li>’ . get_the_title() . ‘</li>’; } echo ‘</ul>’; … Read more

Show only one category in main query, issues on tag page

If the only issue you want to correct is the output of single_tag_title, you can correct the value via a filter by grabbing the tag query var directly: function wpa90852_fix_tag_title(){ $tag = get_term_by( ‘slug’, get_query_var(‘tag’), ‘post_tag’ ); return $tag->name; } add_filter( ‘single_tag_title’, ‘wpa90852_fix_tag_title’ );

WordPress a template for subcategories fo a given category, but not for root category

I managed to solve this in a procedural way: 1 added in theme function this snippet: add_action(‘template_redirect’, ‘load_category_tree_template’); function load_category_tree_template() { if (is_category() && !is_feed()) { // replace ‘your-base-category-slug’ with the slug of root category $base_tree_cat_id = get_cat_id(‘your-base-category-slug’); // get current category id $catid = get_query_var(‘cat’); if (is_category($base_tree_cat_id) || cat_is_ancestor_of($base_tree_cat_id, $catid)) { load_template(STYLESHEETPATH . ‘/category-your-base-category-slug.php’); … Read more

Display categories and their IDs

Are you looking for a list of the current post’s categories and parents, or just a general list of categories? If the former, you can use get_category_parents(). If you’re in The Loop, for example: <?php if( have_posts() ) : while( have_posts() ) : the_post(); // Post stuff // … $cats = wp_get_post_categories( $post->ID ); foreach( … Read more

Logic for Nearby places with post and categories

Could try a plugin called Geo mash up which turns WordPress into a GeoCMS, has nearby functionality built into it and can take long and lang values or addresses from custom fields. http://wordpress.org/extend/plugins/geo-mashup/ and try https://code.google.com/p/wordpress-geo-mashup/wiki/TagReference for the references.

How to get the post of category

<?php // Get the ID of a given category $category_id = get_cat_ID( ‘Category Name’ ); // Get the URL of this category $category_link = get_category_link( $category_id ); ?> <!– Print a link to this category –> <a href=”https://wordpress.stackexchange.com/questions/94519/<?php echo esc_url( $category_link ); ?>” title=”Category Name”>Category Name</a> After you click on the Category Title link, it … Read more

How to add the sidebar in all category page

the following code will work as for per your custom post type add the following code in sidebar.php to show your custom post type category <?php //list terms in a given taxonomy using wp_list_categories (also useful as a widget) $orderby = ‘name’; $show_count = 0; // 1 for yes, 0 for no $pad_counts = 0; … Read more

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