Why is my archive.php redirecting to front-page.php?
Sorry, this is on me. My SEO plugin by default disable the archives date and redirect to homepage. Leave it on here for the people maybe get stumbled by this problem.
Sorry, this is on me. My SEO plugin by default disable the archives date and redirect to homepage. Leave it on here for the people maybe get stumbled by this problem.
This would make sense as an inclusion for the Co-Authors Plus plugin but you can’t always depend on plugin developers to anticipate all our needs. Sometimes we just have to build for ourselves! 🙂 (source: mikeschinkel.com) Co-Authors Stored as Terms of the Taxonomy ‘author’ Turns out what you want to do is not too hard. … Read more
Archives.php is usually not a page template – it is a file used to display all the archived posts (usually some sort of list …) It is usually triggered by a function that deals with archived posts like <?php wp_get_archives(‘type=monthly’); ?> Anyhow – A page template file has to have this code in the begining … Read more
In WordPress you need to start the session with if ( !session_id() ) { session_start(); } in order to use session variables. You can enter this code into wp-config See http://www.frank-verhoeven.com/using-session-in-wordpress
Have you looked at PHP’s date function? A quick example : $dates = $wpdb->get_col( /*your sql*/ ); if( $dates ) { $archive_year = “”; foreach( $dates as $date ) { $the_date = strtotime( $date ); $year = date( ‘Y’, $the_date ); //4 digit year, ex 1999 $month = date( ‘F’, $the_date ); //Full textual month, … Read more
Try adding the following above the first if statement to see what actual day is being useddisplayed: echo get_the_date(); It might also help to add the following lines to help debug exactly what the query is doing: global $wp_query; var_dump($wp_query); The code is correct – so it has to be something else affecting the display. … Read more
Because post formats are a taxonomy, WordPress handles the archive index page automatically, using the slug type as the taxonomy, and the post format type itself as the taxonomy term; e.g: www.example.com/type/quote If you want to customize the appearance of this taxonomy archive index page, you would modify the appropriate taxonomy template file, as per … Read more
You are getting the “Category name” as much times as the numbers of post are in each category because you have the code to output the “Category name” inside the loop, so the “Category name” is printed in every loop itineration. You could fix this part, for example in this way: <?php if ( have_posts() … Read more
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
If you look at wp_get_archives() you will notice that the link is generated by get_archives_link(). That function supplies a filter that will allow you to replace the parens. This is fairly crude but does work. function archive_link_wpse_183665($link) { $pat=”|\(([^)])\)</li>|”; // preg_match($pat,$link,$matches); // var_dump($matches); $link = preg_replace($pat,'[$1]’,$link); return $link; } add_filter( ‘get_archives_link’, ‘archive_link_wpse_183665’ );