Exclude a specific category link from archive / front page

Assuming that you are using get_categories to print the category links, there is an exclude parameter. You need to use IDs, so you will need to convert the slug with get_term_by $cid = get_term_by(‘slug’,’update’,’category’); // var_dump($cid); get_categories( array( ‘exclude’ => $cid->term_id ) );

Archive by Year

The Simple Yearly Archive Plugin does just that. This code will also do the trick: <?php // get years that have posts $years = $wpdb->get_results( “SELECT YEAR(post_date) AS year FROM wp_posts WHERE post_type=”post” AND post_status=”publish” GROUP BY year DESC” ); foreach ( $years as $year ) { // get posts for each year $posts_this_year = … Read more

Show recent posts in single-post page

The function get_posts() accepts a parameter ‘post__not_in’, which allows you to specify an array of post IDs to exclude from the query. get_posts() is just a wrapper for WP_Query, so the documentation for this parameter can be found here. When inside the loop (such as inside single-events.php) you can retrieve the current post’s ID with … Read more

How to hide the year in archive link

You could use a regexp to remove the year, though it’s a little hacky: $string = wp_get_archives(‘type=monthly&limit=20&echo=0’); $pattern = ‘ ((19|20)\d{2}(</a>))’; echo preg_replace($pattern, ‘\\3’, $string); Answer from this stackoverflow question: https://stackoverflow.com/questions/5759720/have-wp-get-archives-return-a-string-with-no-year-in-it

date.php shows only three posts’ title. how to fix it?

Use the pre_get_posts action to modify number of posts per page on date archives. This would go in your theme’s functions.php file: function wpa_date_posts_per_page( $query ) { if ( !is_admin() && $query->is_date() && $query->is_main_query() ) { $query->set( ‘posts_per_page’, -1 ); } } add_action( ‘pre_get_posts’, ‘wpa_date_posts_per_page’ );

Display future posts in archive

You need to use “OR” instead of “AND”, <?php // Get years that have posts $years = $wpdb->get_results( “SELECT YEAR(post_date) AS year FROM wp_posts WHERE post_type=”post” AND (post_status=”publish” or post_status=”future”) GROUP BY year DESC” ); // For each year, do the following foreach ( $years as $year ) { // Get all posts for the … Read more

Missing content on author archive page

Fixed. I used code: <div class=”panel callout radius”> <?php echo get_avatar( get_the_author_meta( ‘user_email’ ), ’96’ ); ?> <div class=”right”> <a href=”https://twitter.com/<?php the_author_meta( ‘twitter’ ); ?>” target=”_blank”><i class=”fi-social-twitter size-24″></i></a>&nbsp; <a href=”<?php the_author_meta( ‘facebook’ ); ?>” target=”_blank”><i class=”fi-social-facebook size-24″></i></a>&nbsp; <a href=”mailto:<?php the_author_meta( ’email’ ); ?>”><i class=”fi-mail size-24″></i></a> Then I found out this function could only be used … Read more

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