kittywake
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Group posts by month ?I have something similar on my blog – but I don’t show the date of each post: just the title.
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <ul > <?php /**/ $years = $wpdb->get_col("SELECT DISTINCT YEAR(post_date) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_date ASC"); foreach($years as $year) : ?> <h4><li><a href="<?php echo get_year_link($year ); ?> "><?php echo $year; ?></a> <ul> <?php $months = $wpdb->get_col("SELECT DISTINCT MONTH(post_date) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' AND YEAR(post_date) = '".$year."' ORDER BY post_date ASC"); foreach($months as $month) : ?> <h4><li><a href="<?php echo get_month_link($year, $month); ?>"><?php echo date( 'F', mktime(0, 0, 0, $month) );?></a> <ul> <?php $theids = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' AND MONTH(post_date)= '".$month."' AND YEAR(post_date) = '".$year."' ORDER BY post_date ASC"); foreach ($theids as $theid): ?> <h4 style= font-style:italic;><li><a href="http://www.kittywake.us/?p=<?php echo $theid->ID; ?>"><?php echo $theid->post_title; ?></a></li></h4> <?php endforeach; ?> </ul> </li></h4> <?php endforeach;?> </ul> </li></h4> <?php endforeach; ?> </ul> </div> </div>The only problem I have with this is that if someone clicks on the month name the posts are in descending order while the listing is in ascending. You might want to change the code to all DESC so that you don’t have this happen. I’m still working on a solution.
Forum: Fixing WordPress
In reply to: Am I really that thick?I think your layout looks great. And not difficult to do. I had done rudimentary HTML once before I switched to wordpress – so I’m definitely a beginner. But it’s really easy to figure out. Just download a theme – a simple one will do like cutline 2.2. Then I went through and deleted anything that mentioned “comments”, “authors”, etc until I had a very basic version of what I wanted. (Just delete one thing at a time and then look at the results before deleting the next item !) I have added things back in but still have a “blog” that is exactly what I want. Well, almost… you can see it here
The advantage of wordpress is the support and the tons of info on the web that will help you as your ideas grow.Forum: Fixing WordPress
In reply to: how to Reverse the Post Order in an archive page??I am really inexperienced with wordpress but I modified the cutline themes archive page to show my posts by year, month, and post title in ascending order. When someone clicks on say the Oct 25 link the navigation will show the next post as Oct 29, and the previous post as Oct 24 which is correct. But if someone clicks on the month or year tab, the posts are in descending order. How do I get those to display in ascending order also?
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <ul > <?php /**/ $years = $wpdb->get_col("SELECT DISTINCT YEAR(post_date) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_date ASC"); foreach($years as $year) : ?> <h4><li><a href="<?php echo get_year_link($year); ?> "><?php echo $year; ?></a> <ul> <?php $months = $wpdb->get_col("SELECT DISTINCT MONTH(post_date) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' AND YEAR(post_date) = '".$year."' ORDER BY post_date ASC"); foreach($months as $month) : ?> <h4><li><a href="<?php echo get_month_link($year, $month); ?>"><?php echo date( 'F', mktime(0, 0, 0, $month) );?></a> <ul> <?php $theids = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' AND MONTH(post_date)= '".$month."' AND YEAR(post_date) = '".$year."' ORDER BY post_date ASC"); foreach ($theids as $theid): ?> <h4 style= font-style:italic;><li><a href="http://www.kittywake.us/?p=<?php echo $theid->ID; ?>"><?php echo $theid->post_title; ?></a></li></h4> <?php endforeach; ?> </ul> </li></h4> <?php endforeach;?> </ul> </li></h4> <?php endforeach; ?> </ul> </div>Thank you for any help. I did try Shanes suggestion and modified the general-template.php file but it didn’t change anything.
Sue