Support » Plugin: Posts in Page » Stickies to “top” (like WP default) and Filtering on ACF Data

  • Started dinking around with your plugin and love it. Got pretty much everything working. But I noticed that once I told it to stop ignoring sticky posts, they still didn’t sort as expected.

    WordPress default is (I think) is Sticky by date >> Published by date.
    That’s what I was expecting. To see sticky posts at the top of the roll chronologically, then everything else chronologically.
    Is there a way to make that happen?

    The next question might be pushing it a bit. LOL!
    Advanced Custom Fields: We use it and would like filter posts based on one ACF field. It’s a radio button with 5 or 6 possible options.

    We’d just like to be able to display all the posts in a specific category with a specific ACF field value – then have the rest of the sorting stuff still apply.

    Too much?
    Have I gone too far?
    Might be a cool add-on (paid) if this isn’t something doable currently. πŸ™‚

    Thanx for any assistance you can provide. I greatly appreciate it.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Not a programmer type, but I looked through your plugin and see that I can specify an ACF meta_value.

    protected function set_default_args() {
    		$this->args = array(
    			'post_type'      => 'post',
    			'post_status'    => 'publish',
    			'orderby'        => 'date',
    			'order'          => 'DESC',
    			'paginate'       => false,
    			'template'       => false,
    			'label_next'     => __( 'Next', 'posts-in-page' ),
    			'label_previous' => __( 'Previous', 'posts-in-page' ),
    			'meta_value'	 => '',
    			'none_found'     => '',
    		);
    	}
    

    If I specify the value I’m looking for I get the results I’m expecting but that turns your awesome plugin into a single use doodad. LOL!

    I’d prefer to also do something like,

    / Show specific ACF Post Status
    		if ( isset( $atts['meta_value'] ) ) {
    			$this->args['meta_value'] = $atts['ACF_status'];
    		}
    

    So I can use your shortcode like:
    <?php echo do_shortcode( '[ic_add_posts showposts="12" category="A thing I'm working with" ignore_sticky_posts="no" ACF_status="dead"]' ); ?>

    But I guess I’m missing something important cuz that’s not close to working. πŸ™‚

    Again, anything you can think of would be appreciated.

    Okay, so I got the ACF business working so we can take that off the table.

    Everything above was correct. I was just missing:

    // show posts based on ACF file value
    		if ( isset( $atts['ACF_status'] ) ) {
    					$this->args['meta_value'] = $atts['ACF_status'];
    		}

    So now I can use the shortcode example above and filter the results down to only posts with the status of “dead”.

    All that remains of my initial question is the lack of sticky post behavior in the generated rolls which I’d live LOVE some help with.

    Thank you again!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Stickies to “top” (like WP default) and Filtering on ACF Data’ is closed to new replies.