Support » Plugin: Flexible Posts Widget » Fixed order of posts

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author DaveE

    (@dpe415)

    Hi cinus, I don’t understand your question. Each widget has settings for the order of posts, yes. I don’t understand what you mean by “fixed.” Can you clarify?

    For example: I want to show post id 78 on the first place, post id 23 on the second and post id 221 as last one.

    Plugin Author DaveE

    (@dpe415)

    Yes, this is possible using the ID tab to select the posts you’d like to show, in the order you’d like them to appear. Cheers!

    What should I select in the order form?

    Plugin Author DaveE

    (@dpe415)

    Ah, you are right. Ordering is still applied when you get posts by ID, but there is no option to show them in the order you specific on the ID tab. So the current, correct answer to your original question is actually, no, you can’t set a “custom” order within the widget.

    Sorry, I I’ve never even considered this scenario until you brought it up today. Right now you could filter the FPW query args (using the dpe_fpw_args filter) and set the orderby to post__in per the Codex.

    The difficultly with this is you’d only want to filter the one instance of the widget that is using the get posts by ID tab. It would look something like this (not tested):

    function dpe_filter_fpw_pid_ordering( $args ) {
    	if( isset( $args['post__in'] ) ) {
    		$args['orderby'] = 'post__in';
    	}
    	return $args;
    }
    add_filter( 'dpe_fpw_args', 'dpe_filter_fpw_pid_ordering' );

    I’ll add this functionality to the next release of the plugin. Thanks for point it out!

    Yes, that’s it! Thanks a lot 🙂 It’s nice functionality.

    Plugin Author DaveE

    (@dpe415)

    Hi Cinus,

    Just a heads up that version 3.9 includes an option to sort by Post ID Order natively. You can set your widget instances to use this option and safely remove the custom filter.

    Cheers!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Fixed order of posts’ is closed to new replies.