slt_cf_get_posts_by_custom_first() is broken #10

Open
gyrus opened this Issue Jan 11, 2012 · 2 comments

Comments

Projects
None yet
2 participants
Owner

gyrus commented Jan 11, 2012

This function is certainly broken, returning the query object instead of just the posts.

It may even be fundamentally broken - the usort() seems to just override the sorting by custom field.

Not sure whether to fix it or remove it?

@ghost ghost assigned gyrus Jan 11, 2012

tomvdv commented Jan 13, 2012

I was just trying use this, came here to file a bug report. Obviously I vote to fix ;)

Owner

gyrus commented Feb 19, 2012

I've had a quick look at this and I think it needs re-doing to make it work. There was one obvious error in that the $slt_cf_second_orderby and $slt_cf_second_order vars weren't declared as global in the slt_cf_order_posts() helper function.

But I think the approach is flawed. Doing it the current way, the usort() will simply erase the meta sorting. I think we need something that gets the ordering parameters right into the SQL. Almost certainly doable, but it's not something that's urgent for me. I imagine it could be easily done "alongside" the plugin by hooking in the query.

I'm putting the code on GitHub now, so maybe someone else can contribute a working version of the function?

@gyrus gyrus added this to the 1.0 milestone Apr 9, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment