Archive pages for posts based on their taxonomy?

The Template Hierarchy Codex entry is your friend. Archive page for category hair: category-hair.php Archive page for taxonomy shampoo: taxonomy-shampoo.php Archive page for taxonomy shampoo term dry: taxonomy-shampoo-dry.php To display some cross-query between different taxonomies, such as category and a custom taxonomy, such as hair, you’ll need to do a custom query, and display it … Read more

Cache previous versions of website?

I’d say go with categories: it seems your categories are already being used for ‘back-end’ purposes, so I’d imagine they’re already hidden from the front-end users. Otherwise, go for a custom taxonomy (something like ‘issue’ taxonomy perhaps), which is a bit more work, but gives you a lot more control. Take a look at the … Read more

Customize first page of category

I don´t think you can do this within the template overwrite structure of wordpress but you can include a custom template based on the pagination number. if(get_query_var(‘paged’) == 0){ echo “Include your custom theme here”; }else{ echo “standard”; }

Change behavior depending on content length

We need two functions in the theme’s functions.php: One function checking the length of the content to adjust the title. Another one to print the formatted post content in case the first function returns TRUE. Let’s start with the first function. This is rather simple because we solved that already. 🙂 if ( ! function_exists( … Read more

How can I organize/create an archive listing by Year and month

function archive_links_custom() { global $wpdb, $wp_locale; $query = “SELECT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $wpdb->posts WHERE post_type=”post” AND post_status=”publish” GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC”; $arcresults = $wpdb->get_results($query); if ( $arcresults ) { $year = null; foreach ( (array) $arcresults as $arcresult ) { if($arcresult->year != $year) { … Read more

Arrange and separate posts

You can do some tricky thing with PHP. Here is the algorithm you could use. Query posts to get posts as alphabetical order. for/while loop starts. $t = Get first character of the title string. $temp = ” empty string. if $t != $temp echo $t. set $t = $temp. endfor/endwhile. Hope it make sense. … Read more

Archive in sidebar with dropdown list of Year – Month – Day

Year, Month and Day are all public query variables, all you need to do is create a search form with appropriately named inputs. <form method=”get” action=”<?php echo home_url( “https://wordpress.stackexchange.com/” ); ?>”> <select name=”day”> <?php foreach( range(1,31) as $day_of_month ) : ?> <option><?php echo $day_of_month; ?></option> <?php endforeach; ?> </select> <select name=”monthnum”> <?php foreach( range(1,12) as … Read more

if in_category on archive.php

If memory serves, in_category() is for use within the loop and returns true when the current post is in that particular category. You’re probably for is_category(166).

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