• 0
Sign in to follow this  
Followers 0

Featured Source = Sticky Post

Question

Posted · Report post

I'd like the ability to set the Featured content by whether a Post (and ideally a post from a Category) is set as Sticky. That way I can feature the latest content easily in a PageLines Featured area without having to duplicate effort by creating an identical Featured custom post. Since we can already link the Featured content to a Post Category, it seems like the framework is already set up to be able to link it to Sticky status. Just not sure if the hooks exist and how to pull it off... Can anyone point me in the right direction? Thanks, Dave

Share this post


Link to post
Share on other sites

8 answers to this question

  • 0

Posted · Report post

I'm going to mark this for the devs because I'm not sure which function you'll want to filter. But, I think it should be as straightforward as modifying the query_posts() variables. ("query_posts(array('post__in'=>get_option('sticky_posts')));"). You could try using a filter on the pagelines_before_feature() function.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

The primary reason I want to do this is so I can add Featured content to the default page that is Category independent. The motivation comes from the fact that although a Post is in the Exhibit category, to make it show up in the Feature default I have also been adding it to the Featured category. The problem is that when you navigate to the post, the Breadcrumb shows that it is in the Featured category and not the Exhibit category making it confusing. Thanks, Dave

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

It looks like I need to add an option to the 'feature_source' array of 'sticky' so it can be selected as the option in the admin. So far my initial attempts here are unsuccessful... Then I need to test if the 'feature_source' is 'sticky' and build the feature content appropriately. Not sure exactly what all this is comprised of... Hmmm... Thanks, Dave

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Try something like this: [code] if(pagelines_option('feature_category')) { $query['cat'] = pagelines_option('feature_category'); $query['post__in'] = get_option( 'sticky_posts' ), } [/code] This is around line 315 of section.features.php UNTESTED ;) http://codex.wordpress.org/Class_Reference/WP_Query#Sticky_Post_Parameters

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

What if I added a test for 'sticky' just below like this... :-? [code]if($source == 'posts'){ $query['post_type'] = 'post'; if(pagelines_option('feature_category')) $query['cat'] = pagelines_option('feature_category'); }elseif($source == 'sticky'){ $query['post_type'] = 'post'; if(pagelines_option('feature_category')) { $query['post__in'] = get_option( 'sticky_posts' ), } } else { [/code] Thanks, Dave

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

ok your using elseif so you still need to include the cat [code] if(pagelines_option('feature_category')) { $query['post__in'] = get_option( 'sticky_posts' ), $query['cat'] = pagelines_option('feature_category'); } [/code]

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

What if I create an array option of 'sticky' with... [code]'feature_source' => array( 'default' => 'featureposts', 'version' => 'pro', 'type' => 'select', 'selectvalues' => array( 'featureposts' => array("name" => 'Feature Posts (custom post type)'), 'posts' => array("name" => 'Use Post Category'), 'sticky' => array("name" => 'Ust Sticky Posts'), ), 'inputlabel' => 'Select source', 'title' => 'Feature Post Source', 'shortexp' => "Use feature posts or a post category", 'exp' => "By default the feature section will use feature posts, you can also set the source for features to a blog post category or use Sticky Posts. Set the category ID in its option below.
NOTE: If set to posts, excerpts will be used as content (control length through them). Also a new option panel will be added on post creation and editing pages." ),[/code] And then test for 'sticky' and display sticky posts if this is selected in the admin... [code]if($source == 'posts'){ $query['post_type'] = 'post'; if(pagelines_option('feature_category')) $query['cat'] = pagelines_option('feature_category'); }if($source == 'sticky'){ $query['post_type'] = 'post'; if(pagelines_option('feature_category')) { $query['post__in'] = get_option( 'sticky_posts' ), } } else {[/code] It isn't working, yet. But this seems like the ability to offer the most flexibility via the admin panel. The pull down doesn't show the Sticky option currently and sticky posts aren't being displayed in the Feature area. Hmmm... Dave

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

marked for pross

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0