paa1605
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Help needed with queryJust realised that i should have been using the
<?php posts_nav_link(); ?>
rather than the next_post_link given that this is a category page. Unfortunately though the problem still persists. It’s still creating a page 2 showing the same 2 posts.Forum: Fixing WordPress
In reply to: Help needed with queryThanks Josh,
I’ve put your code in and it works!! However, there seems to be a slight problem.
I removed the argument line that states ’10 posts per page’ as my wordpress settings has it currently showing just 3 which is fine as i’m building the site on my testing server. There are only 2 posts which meet the arguments criteria (ie. in the current category and not in 46), and although these are now the only ones that are showing, the next_post_link is displaying and linking to a page 2 which again shows the same 2 posts!?
This is strange as there shouldn’t be a page 2 because there are only 2 posts meeting the argument and the settings are set to 3 posts per page. Do you know why it would duplicate the same posts and put them on a second page?
Thanks. The full code is as follows…
<?php $args=array( 'category__in' => $ps_catid, // Taken from your example above 'category__not_in' => '46' // Taken from your example above ); $my_query = null; $my_query = new WP_Query($args); if( $my_query->have_posts() ) { while ($my_query->have_posts()) : $my_query->the_post(); ?> <div class="trends_panel"> <div class="trends_header"> <div class="trends_date"> <?php the_time('F jS, Y') ?> </div> <div class="trends_title"> <h1><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?> </a> </h1> </div> <?php $image = get_post_meta($post->ID, 'category image', true); if($image) : ?> <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"> <img src="<?php echo $image; ?>" border="0" class="resize" /> </a> <?php endif; ?> <div class="trends_excerpt"> <?php the_excerpt(); ?> </div> <div class="trends_more"> <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">Read More </a> </div> </div> </div> <?php endwhile; } wp_reset_query(); // Restore global post data stomped by the_post(). ?> <div class="clear"> </div> <?php previous_posts_link('« More Recent Posts') ?> <?php next_posts_link('Older Posts »') ?>
Forum: Fixing WordPress
In reply to: Problem with post dropdown archive boxThanks for the help guys.
After taking what you said onboard it turns out it was indeed a problem with the ‘disable date-based archives’ in the seo plug-in. All fixed now and working perfectly. Thanks!
Forum: Fixing WordPress
In reply to: Twitter feed suddenly not showing!Thanks Shane, seems to be working perfectly now!
Many thanks
Forum: Fixing WordPress
In reply to: Twitter feed suddenly not showing!No plugin, just the code i’ve mentioned in the original post. The theme is one that i made myself.
Forum: Hacks
In reply to: Collapsing Category in Post Write ScreenThis works perfectly for what you’re trying to achieve…
https://www.ads-software.com/extend/plugins/intuitive-category-checklist/screenshots/
Forum: Fixing WordPress
In reply to: Question about the_excerpt tagThankyou both for your help. Got it to work perfectly!
Forum: Fixing WordPress
In reply to: Help needed with if/while statement please?Thanks everyone for all the help. I managed to get both problems sorted so many thanks!
Patrick
Forum: Fixing WordPress
In reply to: Help needed with if/while statement please?Thanks Andrew, that works perfectly!!
Any ideas about making the query category specific?
And if the h2 has a class applied to it how is that written?
Thanks for your time, much appreciated.
Forum: Fixing WordPress
In reply to: Help needed with if/while statement please?Oh sorry, the last two lines.
Forum: Fixing WordPress
In reply to: Custom field help needed please!For anyone thats interested, i think i’ve cracked it…
<?php $original_id = get_post_meta($post->ID, 'price', true); $sale_id = get_post_meta($post->ID, 'sale price', true); if ($sale_id != $original_id) { ?> <div>Was £<?php echo get_post_meta($post->ID, 'price', true); ?></div> <div class="salebox">Now £<?php echo get_post_meta($post->ID, 'sale price', true); ?></div> <?php } else { ?> £<?php echo get_post_meta($post->ID, 'price', true); ?> <?php } ?>
Forum: Fixing WordPress
In reply to: Custom field help needed please!Brilliant, many thanks. That seems to work.
Could i just ask how do i echo the ‘£’ symbol before the new price and also add a ‘was’ and ‘now’. So for example it would say..
Was £10 Now £8
Forum: Fixing WordPress
In reply to: How to format the date in post admin??Thanks vtxyzzy, worked perfectly!!!
All the best!
Forum: Fixing WordPress
In reply to: How to format the date in post admin??this is the code i have in my functions file
// Register the column function revised_column_register( $columns ) { $columns['revised'] = 'Revised'; return $columns; } add_filter( 'manage_edit-post_columns', 'revised_column_register' ); // Display the column content function revised_column_display( $column_name, $id ) { if ('revised' == $column_name) echo get_post_field('post_modified', $id); } add_action( 'manage_posts_custom_column', 'revised_column_display', 10, 2 ); // Register the column as sortable function revised_column_register_sortable( $columns ) { $columns['revised'] = 'modified'; return $columns; } add_filter( 'manage_edit-post_sortable_columns', 'revised_column_register_sortable' ); function revised_column_orderby( $vars ) { if ( isset( $vars['orderby'] ) && 'revised' == $vars['orderby'] ) { $vars = array_merge( $vars, array( 'orderby' => 'revised' ) ); } return $vars; } add_filter( 'request', 'revised_column_orderby' );
I got it from an article i found here
I can’t seem to see where the code is that controls the date format though. Thanks for taking the time to reply, much appreciated.
Forum: Fixing WordPress
In reply to: How to automatically change the category assigned to a post?Fantastic WillxD!!! That works perfectly. A massive thanks.
Can i just ask something else. If i have a post assigned to several categories such as ‘golf’, ‘nike’, ‘new this week’ and ‘new this month’ is it possible to add something to the code you provided so that it automatically removes itself from the category of ‘new this week’ after 7 days, and also removes itself from the category of ‘new this month’ after 30 days??
If you could get the code to do this it would be a perfect solution to my problem.
Thanks again for all your kind work so far. Very much appreciated.
Regards,
Patrick