0

I have a friend who is trying to control when posts get added to the RSS feed, not when they get added to the site. Is there a way to duplicate the date published section in admin, but for the RSS feed so they can be scheduled separately?

  • Can you go into detail regarding why you want to do this? – EAMann May 15 '13 at 16:03
  • All posts in the newsletter go on the site at the beginning of the month, but they want to push individual ones out onto the RSS feed at individual times rather than just when they're published to the site. – Christopher May 15 '13 at 21:16
1

Your question is pretty minimal but I will give it a shot.

  1. You would want to add a meta box for your value.
  2. On save_post save the data to $wpdb->postmeta
  3. Filter your feed using pre_get_posts and/or posts_where as needed.

A very basic code outline:

function generic_box() {
    add_meta_box(
        'generic_box', // id, used as the html id att
        __( 'Generic Title' ), // meta box title
        'generic_cb', // callback function, spits out the content
        'post', // post type or page. This adds to posts only
        'side', // context, where on the screen
        'low' // priority, where should this go in the context
    );
}
function generic_cb() {
  echo 'generic content';
}
add_action( 'add_meta_boxes', 'generic_box' );

function generic_save($post_id) {
  // use $post_id and the global $_POST variable to process information
  // use update_post_meta() to save information
}
add_action('save_post','generic_save');

function generic_pre_get_posts($qry) {
  if (is_feed()) {
    // alter your query
  }
}
add_action('pre_get_posts','generic_pre_get_posts');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.