WordPress.org

Ready to get started?Download WordPress

Forums

OptionTree
Add more fields with slider settings + rename existing fields using filter (1 post)

  1. rahul.srs
    Member
    Posted 1 year ago #

    I can see some basic fields like Title, Image, Link, Description with default Slider settings. But i would like to rename thena and also add some more textarea/text fields. It was easily possible with older version of option tree using following filter but not seems to be working with latest version:

    Option tree V1.1.8.1 code was:
    [ Moderator Note: Please post code or markup snippets between backticks or use the code button. Not blockquote. ]

    add_filter( 'image_slider_fields', 'home_slider_fields', 10, 2 );
    function home_slider_fields( $image_slider_fields, $id ) {
      if ( $id == 'home_slider' ) {
        $image_slider_fields = array(
          array(
            'name'  => 'image',
            'type'  => 'text',
            'label' => 'Slider Background Image',
            'class' => ''
          ),
          array(
            'name'  => 'slider_title',
            'type'  => 'textarea',
            'label' => 'Slider Title (HTML)',
            'class' => ''
          ),
          array(
            'name'  => 'slider_description',
            'type'  => 'textarea',
            'label' => 'Slider Description  (HTML)',
            'class' => ''
          ),
    	   array(
            'name'  => 'slider_background',
            'type'  => 'text',
            'label' => 'Slider Background color (default: "#ffffff" - WHITE)',
            'class' => ''
          ),
    
    array(
            'name'  => 'slider_position',
            'type'  => 'text',
            'label' => 'Slider Position from top,
            'class' => ''
          )
        );
      }
      return $image_slider_fields;
    }

    Please let me know how to use this code with current version of option tree.

    http://wordpress.org/extend/plugins/option-tree/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic