Custom menu with categories and tags

Are you familiar with the wp_nav menu? You could achieve what you are asking using the wp-nav menu, but the categories, pages, etc. would have to be organized manually via the WordPress Menu Interface in the WP-Admin screen. If you are OK with arranging them manually via drag-n-drop, let me know and I’ll instruct you … Read more

How to add meta description, keywords, custom title to a category template

for meta description of the category you can use followinf dunction //META DESCRIPTION FUNCTION function seometadescription(){ global $post, $posts; if ( is_single() || is_page() ) : $customDesc=”meta_desc”; if ( have_posts() ) : while ( have_posts() ) : the_post(); $descriere = get_post_meta($post->ID, $customDesc, true); endwhile; endif; elseif( is_category() ): $descriere = category_description(); elseif( is_front_page() ) : … Read more

Get a list of all links on a page?

it is possible to do on server side but you would have to create an output buffer and the either use Regex or Dom phrase to get all of the links. a much easier solution would be to use JavaScript or even better jQuery.

Explode() expects a string

Let’s start from the top: $current = get_the_category(); This returns an array of objects, one object for each category. $current_id= $current[0] ->cat_ID; This returns an object, the first object in the previous array $categs_list = get_category_parents($current_id); This returns a string, but only if the current category has parents; otherwise, it returns whatever was passed to … Read more

query_post problem

// Category should be ‘cat’ <?php $args = array( ‘cat’ => $cat, ‘orderby’ => ‘post_date’, ‘order’ => ‘DESC’, ‘post_type’ => ‘blog’, ‘post_status’ => ‘publish’ ); ?>

How to get sub-categories to display same look as there parents

If you have a single level of subcategories under your main categories, you can just do this: $category = get_category( $cat ); if( $category->category_parent ): $parent = get_cat_name( $category->category_parent ); echo ‘<h1>’ . $parent . ‘</h1>’; else: echo ‘<h1>’ . $category->cat_name . ‘</h1>’; endif;

Show posts from category specified using a custom field

Finally solved it! I needed to add this at the end of each loop 🙂 <?php $my_query = new WP_Query(array( ‘category_name’ => get_post_meta($post->ID, ‘featured’, true), ‘posts_per_page’ => 5, )); if ($my_query->have_posts()): ?> <?php while ($my_query->have_posts()) : $my_query->the_post(); ?> content etc goes here <?php endwhile; ?> <?php endif; ?><?php wp_reset_query(); ?> many thanks James