Recent posts in current category?

Here’s how I’d get the 20 (at most) most recent posts in the category.php page: <?php $max_posts = 20; $cat_ID = get_cat_ID ( single_cat_title( ”, false ) ); $args = array( ‘category’ => $cat_ID, ‘numberposts’ => $max_posts, ); $myposts = get_posts( $args ); foreach( $myposts as $post ) { setup_postdata( $post ); ?> <!– add … Read more

Make three menus with three category levels

wp_list_categories(); will by default give you a hierarchically nested list of all your categories. Hiding and showing that list, or parts of it, is just a matter of CSS. That sounds like what you need. For example echo ‘<ul class=”my-cats-list”>’,wp_list_categories(),'</ul>’; // style rules; put in your theme’s style.css .cat-item { padding-left:5px; } .children { display:none; … Read more

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.

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