Plugin Directory

Changeset 1174425


Ignore:
Timestamp:
06/04/2015 12:49:14 PM (11 years ago)
Author:
lti
Message:

Removing post_save and add_meta_box hooks if news support isn't activated

Location:
lti-sitemap/trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • lti-sitemap/trunk/src/admin/admin.php

    r1174335 r1174425  
    261261     */
    262262    public function add_meta_boxes() {
    263         if ( $this->settings->get( 'content_news_support' ) == true ) {
    264             $supported_post_types = $this->get_supported_post_types();
    265             foreach ( $supported_post_types as $supported_post_type ) {
    266                 add_meta_box(
    267                     'lti-sitemap-metadata-box',
    268                     lsmint( 'admin.meta_box' ),
    269                     array( $this, 'metadata_box' ),
    270                     $supported_post_type,
    271                     'advanced',
    272                     'high'
    273                 );
    274             }
     263        $supported_post_types = $this->get_supported_post_types();
     264        foreach ( $supported_post_types as $supported_post_type ) {
     265            add_meta_box(
     266                'lti-sitemap-metadata-box',
     267                lsmint( 'admin.meta_box' ),
     268                array( $this, 'metadata_box' ),
     269                $supported_post_type,
     270                'advanced',
     271                'high'
     272            );
    275273        }
    276274    }
     
    459457            }
    460458
    461             //If the post is a news item, we set a special post meta to make sitemap queries easier.
    462             $post_variables = $this->helper->filter_var_array( $_POST['lti_sitemap_news'] );
    463             if ( ! is_null( $post_variables ) && ! empty( $post_variables ) && $post_variables !== false ) {
     459            if ( isset( $_POST['lti_sitemap_news'] ) ) {
     460                //If the post is a news item, we set a special post meta to make sitemap queries easier.
    464461                update_post_meta( $post_ID, 'lti_sitemap_post_is_news', true );
    465462            } else {
    466                 delete_post_meta( $post_ID, 'lti_sitemap_post_is_news', true );
     463                delete_post_meta( $post_ID, 'lti_sitemap_post_is_news' );
    467464            }
    468465        }
  • lti-sitemap/trunk/src/lti-sitemap.php

    r1174335 r1174425  
    135135        $this->loader->add_filter( 'plugin_action_links', $this->admin, 'plugin_action_links', 10, 2 );
    136136        $this->loader->add_filter( 'plugin_row_meta', $this->admin, 'plugin_row_meta', 10, 2 );
    137         $this->loader->add_action( 'add_meta_boxes', $this->admin, 'add_meta_boxes' );
    138         $this->loader->add_action( 'save_post', $this->admin, 'save_post', 10, 3 );
     137        if ( $this->settings->get( 'content_news_support' ) == true ) {
     138            $this->loader->add_action( 'add_meta_boxes', $this->admin, 'add_meta_boxes' );
     139            $this->loader->add_action( 'save_post', $this->admin, 'save_post', 10, 3 );
     140        }
    139141
    140142        if ( isset( $GLOBALS['pagenow'] ) ) {
Note: See TracChangeset for help on using the changeset viewer.