Forum Replies Created

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • in reply to: Need easy way to sort post lists by meta key #136357
    GalileeCentre
    Participant

    IF we were to use a custom theme, how would one go about using the drag and drop creator within it? or is this not possible?

    in reply to: Need easy way to sort post lists by meta key #125379
    GalileeCentre
    Participant

    To clarify my question:

    right now the code seems to do something like this:

    ADD POST LIST TO EMAIL
    1) -> add a title, set font size and whether you want the images, set query data(select categories, select number of posts
    2) -> send query data to get_posts or pre_get_posts
    3) -> get_posts or pre_get_posts receives query
    —post type
    —category
    —number of posts to get
    4) -> function returns post data, sorted by date posted in either ascending or descending order
    5) -> post data is run through a loop and formatted post-by-post, and added to the list

    I want to intercept the get_posts or pre_get_posts call that your plugin makes so that my sorting requirements get added to the query.
    Unless I misunderstand how your plugin is doing things, I should be able to pass the whole query from the ADD POST LIST TO EMAIL dialog through the function, which should add the following items to the query before it gets passed to get_posts:
    – order by: meta_value
    – meta_key: <our custom meta key>
    – order: asc

    in reply to: Need easy way to sort post lists by meta key #125374
    GalileeCentre
    Participant

    Firstly, to Protasia:
    I am not sorting newsletters, but rather a lists of posts that is embedded within them by the newsletter plugin. If you are referring to a list of posts on your site itself, perhaps on a page, that is quite easy and I can help you with that.

    secondly, to Stefano (or any of the NewsLetter Plugin staff)
    Your plugin uses it’s own query via get_posts() to pull the list of posts for use. Can I simply override your function by using an action/filter of my own? Where in your code is this and what is it’s function name?

    I have a custom code plugin that I use to add all of my custom code to. In it, I have modified the main query via pre_get_posts to properly sort any and all posts that are not pages (and have the meta key).

    Unless your plugin changes the information being passed to and from get_posts() in a significant way, it should be a relatively simple matter to add a filter to catch calls to your custom query function and pass them through my own instead, thus keeping the category and post number filters, but adding the sort data, then returning the results.

    Please get back to me as soon as you can.

Viewing 3 posts - 1 through 3 (of 3 total)