WP Archive & Category Pages not filtering

From the codex for get_posts() The category parameter needs to be the ID of the category, and not the category name. So you should either use category_name parameter with name or you could pass the ID to category. <?php $term_name = get_queried_object()->name; $args = array ( ‘category_name’ => $term_name, ‘posts_per_page’ => 5); $myposts = get_posts( … Read more

Create page like custom post type list in WordPress

One option is to set has_archive to false when you register the CPT. Then, create a Page with the same slug. So if your CPT is “mycpt” then create a Page at http://example.com/mycpt/. From there, set up a custom Page template to act like an archive, but you can also (optionally) add content in the … Read more

how to show all post with its contents

The theme determines whether to show excerpts or full content on archive pages (e.g. the cateogry listing), and since you’re on WordPress.com, you’ll probably have to change themes to one that shows the full content on archive pages. There’s a listing here, don’t know how complete it is: http://wpbtips.wordpress.com/2009/03/25/full-posts-in-archive-pages/ You might also try putting the … Read more

archive per year with monthly

To display monthly archives arranged by year, you can use this code. It checks through each month if WordPress have any post in that month and create archive. <?php global $wpdb; $limit = 0; $year_prev = null; $months = $wpdb->get_results( “SELECT DISTINCT MONTH( post_date ) AS month , YEAR( post_date ) AS year, COUNT( id … Read more

Show monthly or daily archives

Before WordPress 4.1, you can show the date archive page titles with the following code: (Taken and slightly modified from the twentyfourteen theme) if ( is_day() ) { printf( __( ‘Daily Archives: %s’, ‘twentyfourteen’ ), get_the_date() ); } elseif ( is_month() ) { printf( __( ‘Monthly Archives: %s’, ‘twentyfourteen’ ), get_the_date( _x( ‘F Y’, ‘monthly … Read more

custom sort posts in archive/taxanomy page

Put something along these lines in your functions.php: add_filter( ‘pre_get_posts’, ‘custom_get_posts’ ); function custom_get_posts( $query ) { if( is_category() || is_archive() ) { $query->query_vars[‘orderby’] = ‘name’; $query->query_vars[‘order’] = ‘ASC’; } return $query; } reference here (see the second answer)

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