Updaet settings descriptions

This commit is contained in:
Robin Cornett
2017-10-25 11:27:19 -04:00
parent 2028fc8e95
commit 78889bb8ec
3 changed files with 47 additions and 87 deletions
@@ -1,12 +1,10 @@
<?php
/**
* @package DisplayFeaturedImageGenesis
* @author Robin Cornett <hello@robincornett.com>
* @license GPL-2.0+
* @link https://robincornett.com
* @copyright 2014-2017 Robin Cornett Creative, LLC
*/
/**
* Class Display_Featured_Image_Genesis_Helper
* @package DisplayFeaturedImageGenesis
* @copyright 2017 Robin Cornett
*/
class Display_Featured_Image_Genesis_Helper extends DisplayFeaturedImageGenesisGetSetting {
/**
@@ -34,7 +32,7 @@ class Display_Featured_Image_Genesis_Helper extends DisplayFeaturedImageGenesisG
add_settings_section(
$this->page . '_' . $section['id'],
$section['title'],
array( $this, $section['id'] . '_section_description' ),
array( $this, 'section_description' ),
$this->page . '_' . $section['id']
);
}
@@ -76,12 +74,16 @@ class Display_Featured_Image_Genesis_Helper extends DisplayFeaturedImageGenesisG
/**
* Echoes out the section description.
*
* @param string $description text string for description
*
* @since 2.3.0
*
* @param $section
*/
protected function print_section_description( $description ) {
echo wp_kses_post( wpautop( $description ) );
public function section_description( $section ) {
$id = str_replace( "{$this->page}_", '', $section['id'] );
$method = "{$id}_section_description";
if ( method_exists( $this, $method ) ) {
echo wp_kses_post( wpautop( $this->$method() ) );
}
}
/**
@@ -1,32 +1,12 @@
<?php
/**
* Copyright (c) 2017 Robin Cornett
* Class Display_Featured_Image_Genesis_Settings_Define
* @package DisplayFeaturedImageGenesis
* @copyright 2017 Robin Cornett
*/
class Display_Featured_Image_Genesis_Settings_Define extends Display_Featured_Image_Genesis_Helper {
/**
* Define tabs for the settings page.
* @return array
* @since 2.6.0
*/
public function define_tabs() {
return array(
'main' => array(
'id' => 'main',
'tab' => __( 'Main', 'display-featured-image-genesis' ),
),
'style' => array(
'id' => 'style',
'tab' => __( 'Backstretch Output', 'display-featured-image-genesis' ),
),
'cpt' => array(
'id' => 'cpt',
'tab' => __( 'Content Types', 'display-featured-image-genesis' ),
),
);
}
/**
* Register plugin settings page sections
*
@@ -150,22 +130,24 @@ class Display_Featured_Image_Genesis_Settings_Define extends Display_Featured_Im
protected function define_style_fields() {
return array(
array(
'id' => 'less_header',
'title' => __( 'Height', 'display-featured-image-genesis' ),
'callback' => 'do_number',
'section' => 'style',
'label' => __( 'pixels to remove', 'display-featured-image-genesis' ),
'min' => 0,
'max' => 400,
'id' => 'less_header',
'title' => __( 'Height', 'display-featured-image-genesis' ),
'callback' => 'do_number',
'section' => 'style',
'label' => __( 'pixels to remove', 'display-featured-image-genesis' ),
'min' => 0,
'max' => 400,
'description' => __( 'Changing this number will reduce the backstretch image height by this number of pixels. Default is zero.', 'display-featured-image-genesis' ),
),
array(
'id' => 'max_height',
'title' => __( 'Maximum Height', 'display-featured-image-genesis' ),
'callback' => 'do_number',
'section' => 'style',
'label' => __( 'pixels', 'display-featured-image-genesis' ),
'min' => 100,
'max' => 1000,
'id' => 'max_height',
'title' => __( 'Maximum Height', 'display-featured-image-genesis' ),
'callback' => 'do_number',
'section' => 'style',
'label' => __( 'pixels', 'display-featured-image-genesis' ),
'min' => 100,
'max' => 1000,
'description' => __( 'Optionally, set a max-height value for the header image; it will be added to your CSS.', 'display-featured-image-genesis' ),
),
array(
'id' => 'centeredX',
@@ -1,8 +1,10 @@
<?php
/**
* Copyright (c) 2017 Robin Cornett
*/
/**
* Class Display_Featured_Image_Genesis_Settings
* @package DisplayFeaturedImageGenesis
* @copyright 2017 Robin Cornett
*/
class Display_Featured_Image_Genesis_Settings extends Display_Featured_Image_Genesis_Helper {
/**
@@ -23,12 +25,6 @@ class Display_Featured_Image_Genesis_Settings extends Display_Featured_Image_Gen
*/
protected $setting;
/**
* Public post types on the site.
* @var $post_types array
*/
protected $post_types;
/**
* The plugin settings fields.
* @var $fields array
@@ -41,9 +37,8 @@ class Display_Featured_Image_Genesis_Settings extends Display_Featured_Image_Gen
*/
public function do_submenu_page() {
$this->common = new Display_Featured_Image_Genesis_Common();
$this->setting = $this->get_display_setting();
$this->post_types = $this->get_content_types();
$this->common = new Display_Featured_Image_Genesis_Common();
$this->setting = $this->get_display_setting();
add_theme_page(
__( 'Display Featured Image for Genesis', 'display-featured-image-genesis' ),
@@ -177,16 +172,14 @@ class Display_Featured_Image_Genesis_Settings extends Display_Featured_Image_Gen
* @since 1.1.0
*/
public function main_section_description() {
$description = __( 'Use these settings to modify the plugin behavior throughout your site. Check the Help tab for more information. ', 'display-featured-image-genesis' );
$this->print_section_description( $description );
return __( 'Use these settings to modify the plugin behavior throughout your site. Check the Help tab for more information. ', 'display-featured-image-genesis' );
}
/**
* Style section description
*/
public function style_section_description() {
$description = __( 'These settings modify the output style/methods for the backstretch image.', 'display-featured-image-genesis' );
$this->print_section_description( $description );
return __( 'These settings modify the output style/methods for the backstretch image.', 'display-featured-image-genesis' );
}
/**
@@ -196,29 +189,12 @@ class Display_Featured_Image_Genesis_Settings extends Display_Featured_Image_Gen
*/
public function cpt_section_description() {
$description = __( 'Optional: set a custom image for search results and 404 (no results found) pages.', 'display-featured-image-genesis' );
if ( $this->post_types ) {
$post_types = $this->get_content_types();
unset( $post_types['post'] );
if ( $post_types ) {
$description .= __( ' Additionally, since you have custom post types with archives, you might like to set a featured image for each of them.', 'display-featured-image-genesis' );
}
$this->print_section_description( $description );
}
/**
* Description for less_header setting.
* @return string description
*
* @since 2.3.0
*/
protected function less_header_description() {
return __( 'Changing this number will reduce the backstretch image height by this number of pixels. Default is zero.', 'display-featured-image-genesis' );
}
/**
* Description for the max_height setting.
* @return string description
* @since 2.6.0
*/
protected function max_height_description() {
return __( 'Optionally, set a max-height value for the header image; it will be added to your CSS.', 'display-featured-image-genesis' );
return $description;
}
/**