← All changes
|
frameworks/codestar-framework/views/quickstart.php
+67
-67
2.3.4
→
2.4.0
View file →
| @@ -1,67 +1,67 @@ | ||
| 1 | -<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly. ?> | |
| 2 | - | |
| 3 | -<p><strong>Let's quick start it.</strong></p> | |
| 4 | -<p>Open your current theme <code>functions.php</code> file and paste this code.</p> | |
| 5 | - | |
| 6 | -<div class="csf-code-block"> | |
| 7 | -<pre> | |
| 8 | -<span>// Control core classes for avoid errors</span> | |
| 9 | -if ( class_exists( 'CSF' ) ) { | |
| 10 | - | |
| 11 | - <span>//</span> | |
| 12 | - <span>// Set a unique slug-like ID</span> | |
| 13 | - $prefix = 'my_framework'; | |
| 14 | - | |
| 15 | - <span>//</span> | |
| 16 | - <span>// Create options</span> | |
| 17 | - CSF::createOptions( $prefix, array( | |
| 18 | - 'menu_title' => 'My Framework', | |
| 19 | - 'menu_slug' => 'my-framework', | |
| 20 | - ) ); | |
| 21 | - | |
| 22 | - <span>//</span> | |
| 23 | - <span>// Create a section</span> | |
| 24 | - CSF::createSection( $prefix, array( | |
| 25 | - 'title' => 'Tab Title 1', | |
| 26 | - 'fields' => array( | |
| 27 | - | |
| 28 | - <span>//</span> | |
| 29 | - <span>// A text field</span> | |
| 30 | - array( | |
| 31 | - 'id' => 'opt-text', | |
| 32 | - 'type' => 'text', | |
| 33 | - 'title' => 'Simple Text', | |
| 34 | - ), | |
| 35 | - | |
| 36 | - ) | |
| 37 | - ) ); | |
| 38 | - | |
| 39 | - CSF::createSection( $prefix, array( | |
| 40 | - 'title' => 'Tab Title 2', | |
| 41 | - 'fields' => array( | |
| 42 | - | |
| 43 | - array( | |
| 44 | - 'id' => 'opt-textarea', | |
| 45 | - 'type' => 'textarea', | |
| 46 | - 'title' => 'Simple Textarea', | |
| 47 | - ), | |
| 48 | - | |
| 49 | - ) | |
| 50 | - ) ); | |
| 51 | - | |
| 52 | -} | |
| 53 | -</pre> | |
| 54 | -</div> | |
| 55 | - | |
| 56 | -<p><strong>How to get option value ?</strong></p> | |
| 57 | - | |
| 58 | -<div class="csf-code-block"> | |
| 59 | -<pre> | |
| 60 | -$options = get_option( 'my_framework' ); <span>// // unique id of the framework</span> | |
| 61 | - | |
| 62 | -echo $options['opt-text']; <span>// id of field</span> | |
| 63 | -echo $options['opt-textarea']; <span>// id of field</span> | |
| 64 | -</pre> | |
| 65 | -</div> | |
| 66 | - | |
| 67 | -<p><a href="http://codestarframework.com/documentation/" class="button" target="_blank" rel="nofollow"><i class="fas fa-book"></i> Online Documentation</a></p> | |
| 1 | +<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly. ?> | |
| 2 | + | |
| 3 | +<p><strong>Let's quick start it.</strong></p> | |
| 4 | +<p>Open your current theme <code>functions.php</code> file and paste this code.</p> | |
| 5 | + | |
| 6 | +<div class="csf-code-block"> | |
| 7 | +<pre> | |
| 8 | +<span>// Control core classes for avoid errors</span> | |
| 9 | +if ( class_exists( 'CSF' ) ) { | |
| 10 | + | |
| 11 | + <span>//</span> | |
| 12 | + <span>// Set a unique slug-like ID</span> | |
| 13 | + $prefix = 'my_framework'; | |
| 14 | + | |
| 15 | + <span>//</span> | |
| 16 | + <span>// Create options</span> | |
| 17 | + CSF::createOptions( $prefix, array( | |
| 18 | + 'menu_title' => 'My Framework', | |
| 19 | + 'menu_slug' => 'my-framework', | |
| 20 | + ) ); | |
| 21 | + | |
| 22 | + <span>//</span> | |
| 23 | + <span>// Create a section</span> | |
| 24 | + CSF::createSection( $prefix, array( | |
| 25 | + 'title' => 'Tab Title 1', | |
| 26 | + 'fields' => array( | |
| 27 | + | |
| 28 | + <span>//</span> | |
| 29 | + <span>// A text field</span> | |
| 30 | + array( | |
| 31 | + 'id' => 'opt-text', | |
| 32 | + 'type' => 'text', | |
| 33 | + 'title' => 'Simple Text', | |
| 34 | + ), | |
| 35 | + | |
| 36 | + ) | |
| 37 | + ) ); | |
| 38 | + | |
| 39 | + CSF::createSection( $prefix, array( | |
| 40 | + 'title' => 'Tab Title 2', | |
| 41 | + 'fields' => array( | |
| 42 | + | |
| 43 | + array( | |
| 44 | + 'id' => 'opt-textarea', | |
| 45 | + 'type' => 'textarea', | |
| 46 | + 'title' => 'Simple Textarea', | |
| 47 | + ), | |
| 48 | + | |
| 49 | + ) | |
| 50 | + ) ); | |
| 51 | + | |
| 52 | +} | |
| 53 | +</pre> | |
| 54 | +</div> | |
| 55 | + | |
| 56 | +<p><strong>How to get option value ?</strong></p> | |
| 57 | + | |
| 58 | +<div class="csf-code-block"> | |
| 59 | +<pre> | |
| 60 | +$options = get_option( 'my_framework' ); <span>// // unique id of the framework</span> | |
| 61 | + | |
| 62 | +echo $options['opt-text']; <span>// id of field</span> | |
| 63 | +echo $options['opt-textarea']; <span>// id of field</span> | |
| 64 | +</pre> | |
| 65 | +</div> | |
| 66 | + | |
| 67 | +<p><a href="http://codestarframework.com/documentation/" class="button" target="_blank" rel="nofollow"><i class="fas fa-book"></i> Online Documentation</a></p> | |