Pagination issue in archive.php

You should not be setting the posts_per_page value in the template, nor should you be setting the object property directly after the query has run. That is going to cause the object data to become out of sync with itself. You need to alter that value with a filter on pre_get_posts. function pregp_archive_ppp_wpse_108225($qry) { if … Read more

Highlight current tag using get_tags()

Compare $tag->term_id with the value from get_queried_object_id(). You have to cast the former to integer, because it is provided as a string for no good reason. <ul id=”blog-tags”> <?php $tags = get_tags(); if ( $tags ) { foreach ( $tags as $tag ) { echo ‘<li>’; if ( (int) $tag->term_id === get_queried_object_id() ) echo “<b>$tag->name</b>”; … Read more

remove 2014 from wp_get_archives

The only filter i could find inside the wp_get_archives function is for displaying the links. Based on the get_archives_link filter, this should work, use it in your functions.php file: $archive_year = 0; add_filter(‘get_archives_link’,’wp_get_archive_grouped_by_year’,10,2); function wp_get_archive_grouped_by_year($link_html) { global $archive_year; //Get the year from the link(probably better if you change this to regexp) $year_new = explode(‘ ‘, … Read more

Using Shortcode to Grab Archive Listing, Separate by Year

I found this answer: http://www.stemlegal.com/strategyblog/2011/wordpress-wednesdays-better-archive-lists-in-wordpress/ And the final code looks something like this: function getarchives_filter($where, $args) { if (isset($args[‘year’])) { $where .= ‘ AND YEAR(post_date) = ‘ . intval($args[‘year’]); } return $where; } add_filter(‘getarchives_where’, ‘getarchives_filter’, 10, 2); function my_archives($params, $content = null) { extract(shortcode_atts(array( ‘type’ => ‘style1’ ), $params)); $currentyear = date(‘Y’); $years = range(‘2012’,$currentyear); … Read more

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