Making WordPress.org

Changeset 1907


Ignore:
Timestamp:
09/22/2015 07:46:57 PM (9 years ago)
Author:
coffee2code
Message:

jobs.wordpress.net: Add jobs to feed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/jobs.wordpress.net/public_html/wp-content/plugins/jobswp/jobswp.php

    r1904 r1907  
    110110        add_action( 'admin_action_close-job',         array( $this, 'handle_close_job' ) );
    111111        add_action( 'post_row_actions',               array( $this, 'post_row_actions' ), 10, 2 );
     112
     113        add_action( 'pre_get_posts',                  array( $this, 'add_jobs_to_feed' ) );
    112114
    113115        // For enabling admin job post type searches to also search custom fields.
     
    511513
    512514    /**
     515     * Adds job postings to the feed.
     516     *
     517     * @param WP_Query $query The query object.
     518     */
     519    public function add_jobs_to_feed( $query ) {
     520        if ( $query->is_feed() ) {
     521            $query->set( 'post_type', array( 'post', 'job' ) );
     522        }
     523    }
     524
     525    /**
    513526     * Inserts the post-a-job form into the body of the post-a-job page.
    514527     *
Note: See TracChangeset for help on using the changeset viewer.