Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

include attachments and add filter #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

steve1medix
Copy link

Include attachments in the export file and add a filter for others to change the list of post_ids

@hlashbrooke
Copy link
Owner

My apologies - I wasn't watching the repo so didn't get a notification about this PR. Will look into it this week - sorry for the delay.

@hlashbrooke
Copy link
Owner

@steve1medix If you're still keen for this PR to be merged could you please refresh it against the latest code in the master branch. If you're not going to work on it anymore then let me know and I'll close this PR then work on adding your updates myself.

@sc0ttkclark
Copy link
Contributor

The latest code utilizes WP_Query and query args and the loop to build the XML items. I'm thinking this as it is won't be easy to work into that as $post_ids variable is now only used for authors output at the top.

I think we could rework the WP_Query loop to use array_slice on the $post_ids to get 20 out at a time and run ->query( $args ) with post__in. This would replace the pagination it's doing with 'paged' / 'posts_per_page' and would mean the final query args for the loop itself would be simplistic and would be 'post_type' => 'any', it would only need the following:

$query_args = array(
    'post_type' => 'any',
    'post_status' => 'any',
    'post__in' => array_slice( $post_ids, 0, $posts_per_page )
);

and the post__in would get tweaked on each loop around to be:

$query_args[ 'post__in' ] = array_slice( $post_ids, ( $page - 1 ) * $posts_per_page, $posts_per_page );

I'll move forward with that and will let @steve1medix re-introduce his work via a PR against https://github.com/hlashbrooke/Export-Plus/blob/master/includes/class-export-plus.php to add post IDs to the $post_ids array via a new filter I will add in my PR:

$post_ids = apply_filters( 'export_wp_post_ids', $post_ids, $query_args, $args );

@sc0ttkclark
Copy link
Contributor

Code updated here: #4

So this PR only needs to hook into export_wp_post_ids and run it's thing. I would do it, but I'd rather @steve1medix get the GitHub contributor credit directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants