Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //Download options-framework from - https://github.com/devinsays/options-framework-theme
- //official link - http://wptheming.com/options-framework-theme/
- // How to include it to your theme
- 1. Create a folder name it inc (you can give any name)
- 2.inside inc create a another folder , name it options-framework (you can give any name)
- 3.overall you need four folders (css,images,includes,js and options-framework.php inside inc folder of options-framework-theme-master )
- and another file name options.php inside options-framework-theme-master folder.
- 4. Then copy these css,images,includes,js and options-framework.php and paste in your options-framework folder.
- 5. copy options.php and paste in your theme file(very important , not any other places)
- 6.then in your functins.php add this code for Activate option framework
- // Activate option framework
- define( 'OPTIONS_FRAMEWORK_DIRECTORY', get_template_directory_uri() . '/inc/options-framework/' );
- require_once dirname( __FILE__ ) . '/inc/options-framework/options-framework.php';
- for edit option edit options.php as your wish .
- options.php is a blueprint for how to work with options. It includes an example of every option available in the panel and sample output in the theme.
- Done.
- // How to call it and use in theme files.
- /* type one */
- 1. single data - <?php echo of_get_option( 'your_id'); ?>
- /* type two */
- 2.Condtional Data -
- <?php if ( function_exists( 'of_get_option') ) : if( of_get_option( 'your_id' ) ) : ?>
- <h1><?php echo of_get_option( 'your_id'); ?></h1>
- <?php else : ?>
- // Your Default Data
- <?php endif; endif; ?>
- /* type three */
- <!-- Another use for give any name to custom post category -->
- <!-- use at frist create category in wp the put the same category name to theme option -->
- <?php $your_variable = of_get_option( 'test_cate', 'no entry' ); ?>
- <?php
- global $post;
- $args = array( 'posts_per_page' => 4, 'post_type'=> 'portfolio-items', 'portfolio_cat' =>
- $your_variable); // <!-- for call -->
- $myposts = get_posts( $args );
- foreach( $myposts as $post ) : setup_postdata($post); ?>
- <!-- content hare -->
- <?php endforeach; ?>
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement