Advertisement
salmancreation

OptionTree Option Type Making

Nov 29th, 2014
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.68 KB | None | 0 0
  1. // OptionTree Text Option Type
  2.  
  3. // Example code when being used as a Metabox or
  4. // Exported OptionTree file to be used in Theme Mode
  5. array(
  6.     'id'          => 'spyr_demo_text',
  7.     'label'       => __( 'Text', 'text-domain' ),
  8.     'desc'        => __( 'Your description', 'text-domain' ),
  9.     'type'        => 'text',
  10.     'section'     => 'your_section',
  11. )
  12.  
  13. // Get the value saved on Theme Options Page
  14. $spyr_demo_text = ot_get_option( 'spyr_demo_text' );
  15.  
  16. // Get the value saved for a Page, Post or CPT ( Within the loop )
  17. $spyr_demo_text = get_post_meta( $post->ID, 'spyr_demo_text', true );
  18.  
  19. // Wrap the value in a P tag and echo it
  20. echo wpautop( $spyr_demo_text );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement