jitpal
Forum Replies Created
-
Forum: Plugins
In reply to: [WooCommerce] Needed search boxes missing in Woocommerce 2.1?I have the same problem and posted about it here. Unfortunately, I am also waiting for a response and debating going back to 2.0.20 because I am unable to add products until this is resolved.
Forum: Fixing WordPress
In reply to: WP isn’t using Template FilesUpdate: So it looks like it forwards to my tag template but not my custom taxonomy template file. It used to work before but I’m not really sure what’s causing this problem. If anyone has any ideas, I’d greatly appreciate it. Thanks.
Forum: Fixing WordPress
In reply to: get_post_time of a specific postNevermind, I think I got it. Using the bit of code you showed before, I changed it to output the date in Unix format. Thanks for the help.
Forum: Fixing WordPress
In reply to: get_post_time of a specific postHmm, I’m not sure that code will get me to where I need to go although I could be interpreting it incorrectly. Let me give some context. I’m trying to put together a list of posts on the single post page that match a specific custom field value. Then I want to take that list and attach an icon indicating that it’s a new post. I’ll attach the important parts of code I’m using.
<?php global $wpdb; $findposts = $wpdb->get_results( "SELECT * FROM $wpdb->posts LEFT JOIN $wpdb->postmeta ON ($wpdb->posts.ID = $wpdb->postmeta.post_id) WHERE $wpdb->postmeta.meta_key = 'Serial' AND $wpdb->postmeta.meta_value = '$serial_value' AND $wpdb->posts.post_status = 'publish' AND $wpdb->posts.post_type = 'post' AND $wpdb->postmeta.post_id != $id ORDER BY $wpdb->posts.post_date ASC" ); ?> <ul> <?php $limit = 6; ?> <?php foreach ($findposts as $findpost): ?> <?php $counter_serp++; ?> <?php $fp_id = $findpost->ID; $fp_title = $findpost->post_title; $fp_url = $findpost->guid; $fp_date = $findpost->post_date; ?> <?php $mylimit=60 * 86400; $post_age = date('U') - $fp_date;?> <li class="related"> <?php if ($post_age <= $mylimit) { ?><span class="info_icon new">New</span> <?php } ?> <a href="<?php echo $fp_url; ?>" title="Permalink to <?php echo $fp_title; ?>"><?php echo $fp_title; ?></a> </li> <?php if($counter_serp >= $limit) break; ?> <?php endforeach; ?> </ul>
So basically I need to either get the post date by post ID and convert that to seconds so I can compare or convert the post_date string into seconds. Any ideas? Thanks.
Forum: Fixing WordPress
In reply to: Array Problem with Multiple Loops on the same pageNevermind. Disregard my last post. Alright I got this working. I used the alternate method of not duplicating posts. I’ll post my code here just in case someone needs to reference something like this in the future.
First Loop:
<?php $ids = array(); $sticky=get_option('sticky_posts'); $args=array( 'showposts'=>6, 'post__in' => $sticky, ); query_posts($args); while (have_posts()) : the_post(); ?> <!--DO STUFF--> <?php $ids[]= $post->ID; endwhile; wp_reset_query(); ?>
Second Loop:
<?php $sticky=get_option('sticky_posts'); $args=array( 'showposts'=>6, 'post__not_in' => $sticky, ); query_posts($args); while (have_posts()) : the_post(); ?> <?php if (!in_array($post->ID, $ids)) { ?> <!--DO STUFF--> <?php } endwhile; ?>
I think it’s working right, I’ll try and break it to see if it keeps working but I think it’s good. Even my showposts problem from before seems to be solved. Thanks for all of your help t31os.
Forum: Fixing WordPress
In reply to: Array Problem with Multiple Loops on the same pageI think something is terribly wrong. When I tell it to exclude sticky posts in the second loop, it just posts all of them in the order they were posted but it doesn’t exclude the sticky posts. Thanks
Forum: Fixing WordPress
In reply to: Array Problem with Multiple Loops on the same pageYou are right on what I want. That’s exactly it. For some reason now, the query_posts for sticky posts seems ot have no effect on the loop. If I change query posts from sticky to something else it works fine. I think I’m going to let it sit until morning and then try and figure it out. I appreciate your help today. Thanks.
Forum: Fixing WordPress
In reply to: Array Problem with Multiple Loops on the same pageAlright so I think my suspicion is correct. I tried a different query where I just told it find all posts with a specific tag. The query returned the correct results and then the 2nd loop excluded it. So now my problem is to make the first loop show only sticky posts and the second loop to show the 6 newest posts without duplicating what’s on the top. Of course the showposts not showing the right number of posts still. Thanks
Forum: Fixing WordPress
In reply to: Array Problem with Multiple Loops on the same pageSo I started playing around with this other method of avoiding duplicate posts. Alternate Method. Which doesn’t cause an error but it doesn’t show the 2nd loop. I think what happens is that my first query doesn’t only return the sticky posts(it does show the right ones though) but it returns all of them. So basically the 2nd part then filters out all of the posts. So I tried the reset query thing, which didn’t do anything.
As for functioning it looks like it does, but the problem with the showposts is still there. Thanks
Forum: Fixing WordPress
In reply to: Array Problem with Multiple Loops on the same pageThat did nothing except mess up what was already showing up when I remove the do_not_duplicate part. Maybe I put it in the wrong spot. I put it after the first and second loop directly after endwhile. Thanks.
Forum: Fixing WordPress
In reply to: Apply a Class based on how old the post isAwesome, thanks for that. It worked perfect.
Forum: Installing WordPress
In reply to: 2 Blogs 1 databaseHmm, interesting. I kind of had another thought. Is there such a plugin that would check the settings of the browser, as in resoultion, java(mostly this), and the browser itself. Then based upon that, it chose a template for the blog? As in one that is plain and simple, and another which has all the java scripts and such. -Jitpal
Forum: Your WordPress
In reply to: TalkingspoonI just checked and according to the wordpress backend it looks like you registered. What exactly goes wrong?
Forum: Themes and Templates
In reply to: How do i get a sidebar on a single post page.I have the same problem. I tried looking for an alternate class but even with changing that it doesn’t work. Any ideas?
My website is https://www.talkingspoon.comForum: Themes and Templates
In reply to: How do i get a sidebar on a single post page.I have the same problem. I tried looking for an alternate class but even with changing that it doesn’t work. Any ideas?
My website is https://www.talkingspoon.com