bc-int
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: How do I sort posts by page ID in this function?Hmm, well, nothing seems to work. I really appreciate your help though, thanks so much!
I ended up email the theme designer to see if there’s a weird function somewhere that’s messing things up. I’ll try to get an answer from him.
Thanks!
Forum: Fixing WordPress
In reply to: How do I sort posts by page ID in this function?1. Does nothing, still displays only post #724
2. Can’t see anything anywhere that would indicate that.
3. Spits out all sorts of weird ping code on my homepage under the widget.
It doesn’t seem like this should be so hard to call a few simple posts lol. Thanks for all of your continued input though.
Here’s my current code:
// Tabber: Get Most Popular Posts function tj_tabs_popular( $posts = 5, $size = 48 ) { wp_reset_query(); if(empty($posts)) $posts = 5; if(empty($size)) $size = 48; $args = array(); $args['posts_per_page'] = $posts; $args['post__in'] = array(603,654,657,714,724); $args['ignore_sticky_posts'] = 1; $args['orderby'] = 'ID'; $popular = new WP_Query($args); while ($popular->have_posts()) : $popular->the_post(); ?>Forum: Fixing WordPress
In reply to: How do I sort posts by page ID in this function?Also tried all sorts of
get_postsstuff and nothing seems to work.Forum: Fixing WordPress
In reply to: How do I sort posts by page ID in this function?Lol, I appreciate your help no matter what! I’m not sure where it’s being called other than in the file that controls the widget called widget-tabs.php.
The code we’ve been working on is from functions.php, here is the code from the widget file:
<?php /** * Theme Junkie Tabs Widget */ class TJ_Widget_Tabs extends WP_Widget { function TJ_Widget_Tabs() { $widget_ops = array('classname' => 'widget_tab', 'description' => __('Display an Ajax tabber with Popular Posts, Latest Posts and Recent Comments.')); $control_ops = array('width' => 400, 'height' => 350); $this->WP_Widget('tab', __('ThemeJunkie - Tabs'), $widget_ops, $control_ops); } function widget( $args, $instance ) { extract($args); $pp_num = $instance['pp_num']; $rp_num = $instance['rp_num']; $rc_num = $instance['rc_num']; $asize = $instance['asize']; ?> <div id="tab-sidebar"> <div class="widget tab-widget" id="popular-posts"> <h3 class="widget-title"><?php _e('Popular', 'themejunkie'); ?></h3> <ul> <?php rewind_posts(); ?> <?php tj_tabs_popular($pp_num, $asize); ?> </ul> </div> <!--end #popular-posts--> <div class="widget tab-widget" id="recent-posts"> <h3 class="widget-title"><?php _e('Latest', 'themejunkie'); ?></h3> <ul> <?php tj_tabs_latest($rp_num, $asize); ?> </ul> </div> <!--end #recent-posts--> <div class="widget tab-widget" id="recent-posts"> <h3 class="widget-title"><?php _e('Featured', 'themejunkie'); ?></h3> <ul> <?php tj_tabs_extra($rc_num, $asize); ?> </ul> </div> <!--end #recent-comments--> </div><!--end #tab-sidebar--> <?php } function update( $new_instance, $old_instance ) { $instance = $old_instance; $instance['pp_num'] = $new_instance['pp_num']; $instance['rp_num'] = $new_instance['rp_num']; $instance['rc_num'] = $new_instance['rc_num']; $instance['asize'] = $new_instance['asize']; return $instance; } function form( $instance ) { $instance = wp_parse_args( (array) $instance, array( 'pp_num' => '5', 'rp_num' => '5', 'rc_num' => '5', 'asize' => '48' ) ); $pp_num = $instance['pp_num']; $rp_num = format_to_edit($instance['rp_num']); $rc_num = format_to_edit($instance['rc_num']); $asize = format_to_edit($instance['asize']); ?> <p><label for="<?php echo $this->get_field_id('pp_num'); ?>"><?php _e('Number of popular posts to show::'); ?></label> <input class="widefat" id="<?php echo $this->get_field_id('pp_num'); ?>" name="<?php echo $this->get_field_name('pp_num'); ?>" type="text" value="<?php echo $pp_num; ?>" /></p> <p><label for="<?php echo $this->get_field_id('rp_num'); ?>"><?php _e('Number of latest posts to show:'); ?></label> <input class="widefat" type="text" id="<?php echo $this->get_field_id('rp_num'); ?>" name="<?php echo $this->get_field_name('rp_num'); ?>" value="<?php echo $rp_num; ?>" /></p> <p><label for="<?php echo $this->get_field_id('rc_num'); ?>"><?php _e('Number of recent comments to show:'); ?></label> <input class="widefat" type="text" id="<?php echo $this->get_field_id('image'); ?>" name="<?php echo $this->get_field_name('rc_num'); ?>" value="<?php echo $rc_num; ?>" /></p> <p><label for="<?php echo $this->get_field_id('asize'); ?>"><?php _e('Avatar & Thumbnail size(width=height), e.g. 48'); ?></label> <input class="widefat" type="text" id="<?php echo $this->get_field_id('asize'); ?>" name="<?php echo $this->get_field_name('asize'); ?>" value="<?php echo $asize; ?>" /></p> <?php } } register_widget('TJ_Widget_Tabs');It does call
tj_tabs_popular()in the form oftj_tabs_popular($pp_num, $asize)and I tried changing it totj_tabs_popular(5)but it still only shows post ID#724!Forum: Fixing WordPress
In reply to: How do I sort posts by page ID in this function?wp_reset_query(); if(empty($posts)) $posts = 5; if(empty($size)) $size = 48; $args = array(); $args['posts_per_page'] = $posts; $args['post__in'] = array('603','654','657','714','724'); $args['ignore_sticky_posts'] = 1; $args['orderby'] = 'ID'; $popular = new WP_Query($args); while ($popular->have_posts()) : $popular->the_post(); ?>Same thing. It only shows post ID # 724 and that’s it!
Forum: Fixing WordPress
In reply to: How do I sort posts by page ID in this function?$args['post_type'] = 'post';= same thing.$args['post_type'] = 'page';= no posts are displayed, not even # 724.Thanks again lol, anything else I can try to change the order or make the rest appear?
Forum: Fixing WordPress
In reply to: How do I sort posts by page ID in this function?WELL, it seems like we made some really good progress, lol. No errors or anything, but it only shows the post with ID 724 now, not the rest. Seems like it’s almost there! :)Thanks!
Forum: Fixing WordPress
In reply to: How do I sort posts by page ID in this function?// Tabber: Get Most Popular Posts function tj_tabs_popular( $posts = 5, $size = 48 ) { wp_reset_query(); if(empty($posts)) $posts = 5; if(empty($size)) $size = 48; $args = array(); $args['posts_per_page'] = $posts; $args['post__in'] = array(603,654,657,714,724); $args['ignore_sticky_posts'] = 1; $args['orderby'] = 'ID'; $the_query = new WP_Query($args); while ($popular->have_posts()) : $popular->the_post(); ?> <li class="clear"> <?php $thumb = get_thumbnail($post->ID, get_theme_mod('thumb_key'),get_theme_mod('thumb_key')); if(!$thumb) $thumb = get_bloginfo('template_url').'/images/default-thumb.gif'; $url = get_bloginfo('template_url').'/timthumb.php?src='.$thumb.'&h='.$size.'&w='.$size.'&a=t&zc=1'; echo '<a class="entry-thumb"href="'.get_permalink().'" title=""><img width="'.$size.'" height="'.$size.'" src="'.$url.'" alt="" /></a>'; ?> <div class="info"> <a title="" href="<?php the_permalink() ?>"><?php the_title(); ?></a> </div> <!--end .info--> </li> <?php endwhile; }And I get “Fatal error: Call to a member function have_posts() on a non-object in public_html/wp-content/themes/daily/functions.php on line 401”
Hmm…I know I must have made a syntax error somewhere?
Forum: Fixing WordPress
In reply to: How do I sort posts by page ID in this function?$the_query = new WP_Query('showposts='. $posts .'&orderby=ID&include=603,654,657,714,724');…and still nothing. I really appreciate your replies though. Do I have any other options?
Forum: Fixing WordPress
In reply to: How do I sort posts by page ID in this function?Took it out, so it reads:
$the_query = new WP_Query('showposts='. $posts .'$orderby=ID&include=603,654,657,714,724');Still nothing…it’s funny that you said stickies are always posted by date, because the only function that will work, even with
caller_get_posts=1&removed ispost_date.Could there be something else in the code that’s forcing the stickies?
Forum: Fixing WordPress
In reply to: How do I sort posts by page ID in this function?Would I put something in place of that?
Forum: Fixing WordPress
In reply to: How do I sort posts by page ID in this function?Still doesn’t seem to work. It jumbles up the ascending order slightly, so that it looks like this:
1)2nd newest
2)newest
3)3rd newest
4)4th newest
5)5th newestbut it doesn’t show the posts that I want.
ID #’s 603,654,657,714,724 are WAY older than the last 5 posts on my site. Thanks again though…any other ideas?
Forum: Fixing WordPress
In reply to: How do I sort posts by page ID in this function?Thanks for the reply, but it didn’t work still. I changed it to:
$the_query = new WP_Query('caller_get_posts=1&showposts='. $posts .'$orderby=ID&include=603,654,657,714,724');…still nothing. Just ignores that code apparently and sorts by post date and ascending.
???
Forum: Fixing WordPress
In reply to: Help with PHP Date function in Artisteer themeTHAT WORKS!!
Seriously, I can’t thank you enough. It probably would have been days of trial and error before I came upon that bunch of code!
Thanks again!!!