Warning: Attempt to read property "supported_until" on string in /home/skattf/public_html/wp-content/themes/helpdesk/core/libraries/vendors/bbpress/init.php on line 170
Home › Forums › Theme Support › Charity › Getting Blog Masonry page to show posts of just one category
Warning: range(): Argument #1 ($start) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 657
Warning: range(): Argument #2 ($end) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 657
Warning: range(): Argument #1 ($start) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 658
Warning: range(): Argument #2 ($end) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 658
- This topic has 11 replies, 2 voices, and was last updated 11 years, 7 months ago by
getmebrian.
-
AuthorPosts
-
October 29, 2014 at 9:56 pm #4235
Warning: range(): Argument #1 ($start) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 657
Warning: range(): Argument #2 ($end) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 657
Warning: range(): Argument #1 ($start) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 658
Warning: range(): Argument #2 ($end) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 658
getmebrian
Warning: Attempt to read property "supported_until" on string in /home/skattf/public_html/wp-content/themes/helpdesk/core/libraries/vendors/bbpress/init.php on line 109
Hi there,
I’m trying to only show posts of category 17 on our blog page, which uses the Blog Masonry Page Template. I’ve tried a few different things, but nothing is working. Can you help?
Thanks,
Brian
October 31, 2014 at 2:36 am #4250
Warning: range(): Argument #1 ($start) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 657
Warning: range(): Argument #2 ($end) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 657
Warning: range(): Argument #1 ($start) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 658
Warning: range(): Argument #2 ($end) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 658
skat
Warning: Attempt to read property "supported_until" on string in /home/skattf/public_html/wp-content/themes/helpdesk/core/libraries/vendors/bbpress/init.php on line 109
Hey,
Try this:
Go to the theme’s folder and edit the file named “blog-masonry.php”. On line 18, just after this:
'post_status' => 'publish',paste this:
'cat' => '17',Save. Done.
Let me know how’s going.
Cheers!
ChrisOctober 31, 2014 at 4:19 pm #4255
Warning: range(): Argument #1 ($start) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 657
Warning: range(): Argument #2 ($end) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 657
Warning: range(): Argument #1 ($start) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 658
Warning: range(): Argument #2 ($end) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 658
getmebrian
Warning: Attempt to read property "supported_until" on string in /home/skattf/public_html/wp-content/themes/helpdesk/core/libraries/vendors/bbpress/init.php on line 109
That worked, thanks. Is there a way to get the “Recent Posts” widget to also only show posts from one category? Thanks.
November 3, 2014 at 8:46 pm #4279
Warning: range(): Argument #1 ($start) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 657
Warning: range(): Argument #2 ($end) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 657
Warning: range(): Argument #1 ($start) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 658
Warning: range(): Argument #2 ($end) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 658
skat
Warning: Attempt to read property "supported_until" on string in /home/skattf/public_html/wp-content/themes/helpdesk/core/libraries/vendors/bbpress/init.php on line 109
Hey,
You’ll need to edit the file named “recent-posts.php” located in the theme’s folder > framework > inc > widgets.
At line 41, just before this: showposts= add the same line but like this:
cat=17&The whole line should look like this:
'cat=17&showposts='.$instance['postcount'].''Save. Done.
Cheers!
November 5, 2014 at 12:17 am #4308
Warning: range(): Argument #1 ($start) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 657
Warning: range(): Argument #2 ($end) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 657
Warning: range(): Argument #1 ($start) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 658
Warning: range(): Argument #2 ($end) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 658
getmebrian
Warning: Attempt to read property "supported_until" on string in /home/skattf/public_html/wp-content/themes/helpdesk/core/libraries/vendors/bbpress/init.php on line 109
Hi,
Sadly, that didn’t do it. Here is what my code looks like:
<?php
$recent_posts = new WP_Query();
$recent_posts->query(‘cat=17&showposts=’.$instance[‘postcount’].”);
while ($recent_posts->have_posts()) : $recent_posts->the_post(); ?>Any suggestions on how to just get the Recent Posts widget to only show posts from category 17? Thanks!
Brian
November 6, 2014 at 2:57 pm #4323
Warning: range(): Argument #1 ($start) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 657
Warning: range(): Argument #2 ($end) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 657
Warning: range(): Argument #1 ($start) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 658
Warning: range(): Argument #2 ($end) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 658
skat
Warning: Attempt to read property "supported_until" on string in /home/skattf/public_html/wp-content/themes/helpdesk/core/libraries/vendors/bbpress/init.php on line 109
Hey,
I’m seeing an error in your code:
βcat=17&showposts=β.$instance['postcount'].βAt the end of the line you have a double quotes instead of two single ones.
It should look like this:
'cat=17&showposts='.$instance['postcount'].''Cheers!
November 6, 2014 at 4:07 pm #4328
Warning: range(): Argument #1 ($start) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 657
Warning: range(): Argument #2 ($end) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 657
Warning: range(): Argument #1 ($start) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 658
Warning: range(): Argument #2 ($end) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 658
getmebrian
Warning: Attempt to read property "supported_until" on string in /home/skattf/public_html/wp-content/themes/helpdesk/core/libraries/vendors/bbpress/init.php on line 109
Hi,
I’ve made that fix. Still no luck. The Recent Posts widget still shows all categories of posts. Here is the full widget code (of which, I have only changed the line you recommended.) Thx.
<?php
/*
Plugin Name: Recent Posts Widget
Plugin URI: https://skat.tf/
Description: A simple widget to display the recent posts.
Version: 1.00
Author: Skat
Author URI: https://skat.tf/
*/// The widget class
class sd_recent_posts_widget extends WP_Widget {// Widget Settings
function sd_recent_posts_widget() {$widget_ops = array( ‘classname’ => ‘sd_recent_posts_widget’, ‘description’ => __(‘A widget to display the recent posts.’, ‘sd-framework’) );
$control_ops = “”;
$this->WP_Widget( ‘sd_recent_posts_widget’, __(‘Recent Posts’, ‘sd-framework’), $widget_ops, $control_ops );
}// Widget Output
function widget($args, $instance) {
extract($args);
$title = apply_filters(‘widget_title’, $instance[‘title’]);// Before the widget
echo $before_widget;// Display the widget title if one was input
if ( $title )
echo $before_title . $title . $after_title;// Display the Feedburner subscribe form
?><div class=”popular-posts”>
-
<?php
$recent_posts = new WP_Query();
$recent_posts->query(‘cat=17&showposts=’.$instance[‘postcount’].”);
while ($recent_posts->have_posts()) : $recent_posts->the_post(); ?>
<li class=”clearfix”>
<?php if ( (function_exists(‘has_post_thumbnail’)) && (has_post_thumbnail()) ) : /* if post has post thumbnail */ ?>
<div class=”popular-post-thumb”>
<figure>
<?php the_post_thumbnail(‘recent-blog’); ?>
</figure>
</div>
<!–image–>
<?php endif; ?>
<div class=”popular-posts-content”>
<h4>” title=”<?php the_title(); ?>”>
<?php the_title(); ?>
</h4>
<p><?php echo substr(get_the_excerpt(), 0, 55); ?></p>
<span class=”popular-date”> <?php echo get_the_date( get_option(‘date_format’) ); ?> </span> <span class=”popular-comments”>,
<?php comments_popup_link( ‘0 comments’, ‘1 comment’, ‘% comments’, ‘comments-link’, ‘comments closed’); ?>
</span> </div>
<!–details–><?php endwhile; ?>
<?php wp_reset_query(); ?></div>
<?php
// After the widget
echo $after_widget;
}
// Update the widget
function update( $new_instance, $old_instance ) {
$instance = $old_instance;
$instance[‘title’] = strip_tags( $new_instance[‘title’] );
$instance[‘postcount’] = strip_tags( $new_instance[‘postcount’] );return $instance;
}// Widget panel settings
function form( $instance ) {// Default widgets settings
$defaults = array(
‘title’ => ‘Recent Posts’,
‘postcount’ => ‘3’
);
$instance = wp_parse_args( (array) $instance, $defaults ); ?><!– Widget Title: Text Input –>
<p>
<label for=”<?php echo $this->get_field_id( ‘title’ ); ?>”>
<?php _e(‘Title:’, ‘sd-framework’) ?>
</label>
<input class=”widefat” type=”text” id=”<?php echo $this->get_field_id( ‘title’ ); ?>” name=”<?php echo $this->get_field_name( ‘title’ ); ?>” value=”<?php echo $instance[‘title’]; ?>” />
</p><!– Post Count: Text Input –>
<p>
<label for=”<?php echo $this->get_field_id( ‘postcount’ ); ?>”>
<?php _e(‘Post Count’, ‘sd-framework’) ?>
</label>
<input class=”widefat” type=”text” id=”<?php echo $this->get_field_id( ‘postcount’ ); ?>” name=”<?php echo $this->get_field_name( ‘postcount’ ); ?>” value=”<?php echo $instance[‘postcount’]; ?>” />
</p>
<?php
}
}
// Register and load the widget
function sd_recent_posts_widget() {
register_widget( ‘sd_recent_posts_widget’ );
}
add_action( ‘widgets_init’, ‘sd_recent_posts_widget’ );
?>November 6, 2014 at 5:01 pm #4329
Warning: range(): Argument #1 ($start) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 657
Warning: range(): Argument #2 ($end) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 657
Warning: range(): Argument #1 ($start) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 658
Warning: range(): Argument #2 ($end) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 658
skat
Warning: Attempt to read property "supported_until" on string in /home/skattf/public_html/wp-content/themes/helpdesk/core/libraries/vendors/bbpress/init.php on line 109
That’s weird. I’ve just made a test on my demo page and it’s definitely working like this.
I’ve made a version for you. Just replace the whole file name with the one inside the attached archive.
Let me know how’s going.
Cheers!
November 6, 2014 at 6:11 pm #4331
Warning: range(): Argument #1 ($start) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 657
Warning: range(): Argument #2 ($end) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 657
Warning: range(): Argument #1 ($start) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 658
Warning: range(): Argument #2 ($end) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 658
getmebrian
Warning: Attempt to read property "supported_until" on string in /home/skattf/public_html/wp-content/themes/helpdesk/core/libraries/vendors/bbpress/init.php on line 109
I replaced the old file with the one you provided… and it still is not working. Attached is a screenshot of my Recent Posts, showing category 23 posts still showing up with category 17 posts.
I then fully deleted the recent-posts.php file from the server… and did a clean upload of your new file just to make sure it wasn’t user error… and the problem persists.
November 6, 2014 at 10:50 pm #4335
Warning: range(): Argument #1 ($start) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 657
Warning: range(): Argument #2 ($end) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 657
Warning: range(): Argument #1 ($start) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 658
Warning: range(): Argument #2 ($end) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 658
skat
Warning: Attempt to read property "supported_until" on string in /home/skattf/public_html/wp-content/themes/helpdesk/core/libraries/vendors/bbpress/init.php on line 109
Are you sure that those articles are not in both categories 17 & 23?
Cheers!
November 7, 2014 at 12:01 am #4343
Warning: range(): Argument #1 ($start) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 657
Warning: range(): Argument #2 ($end) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 657
Warning: range(): Argument #1 ($start) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 658
Warning: range(): Argument #2 ($end) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 658
getmebrian
Warning: Attempt to read property "supported_until" on string in /home/skattf/public_html/wp-content/themes/helpdesk/core/libraries/vendors/bbpress/init.php on line 109
I wish it were that easy π Attached is a screenshot showing one of the posts is selected as ‘Share Your Story’ (category 23) and not selected as ‘News’ (Cat 17). Since these are the only two categories I am using, should we try code to exclude category 23 instead?
November 7, 2014 at 12:11 am #4345
Warning: range(): Argument #1 ($start) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 657
Warning: range(): Argument #2 ($end) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 657
Warning: range(): Argument #1 ($start) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 658
Warning: range(): Argument #2 ($end) must be a single byte, subsequent bytes are ignored in /home/skattf/public_html/wp-content/plugins/buddypress-first-letter-avatar/buddypress-first-letter-avatar.php on line 658
getmebrian
Warning: Attempt to read property "supported_until" on string in /home/skattf/public_html/wp-content/themes/helpdesk/core/libraries/vendors/bbpress/init.php on line 109
I figured it out. There are two Recent Posts widgets (see attached screenshot)… and I wasn’t using the one you custom configured. Once I swapped them, it works. Thanks… any chance you can take a look at my other post titles “Changing the yellow “Donate Now” button”? Thanks again!
-
AuthorPosts
You must be logged in to reply to this topic.