Advertisement
arnabkumar

options_framework_use

Jun 26th, 2014
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.54 KB | None | 0 0
  1. <?php
  2.  
  3. //Download options-framework from - https://github.com/devinsays/options-framework-theme
  4.  
  5.  
  6.  
  7. //official link - http://wptheming.com/options-framework-theme/
  8.  
  9.                                   // How to include it to your theme
  10.  
  11.  
  12.                                  
  13. 1. Create a folder name it inc (you can give any name)
  14.  
  15. 2.inside inc create a another folder , name it options-framework (you can give any name)
  16.  
  17. 3.overall you need four folders (css,images,includes,js and options-framework.php  inside inc folder of options-framework-theme-master )
  18.  
  19. and another file name options.php inside options-framework-theme-master folder.
  20.  
  21.  
  22. 4. Then copy these css,images,includes,js and options-framework.php and paste in your options-framework folder.
  23.  
  24. 5. copy options.php and paste in your theme file(very important , not any other places)
  25.  
  26.  
  27.  
  28. 6.then in your functins.php add this code for Activate option framework
  29.  
  30.  // Activate option framework
  31.  
  32. define( 'OPTIONS_FRAMEWORK_DIRECTORY', get_template_directory_uri() . '/inc/options-framework/' );
  33. require_once dirname( __FILE__ ) . '/inc/options-framework/options-framework.php';
  34.  
  35.  
  36. for edit option edit options.php as your wish .
  37.  
  38. 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.
  39. Done.
  40.  
  41.  
  42.  
  43.  
  44.                             // How to call it and use in theme files.
  45.                            
  46.                                         /* type one */         
  47.  
  48.  
  49.  1. single data -    <?php echo of_get_option( 'your_id'); ?>
  50.            
  51.            
  52.                                 /* type two */
  53.  
  54. 2.Condtional Data -
  55.  
  56.  
  57.    
  58.  
  59.     <?php if ( function_exists( 'of_get_option') ) : if( of_get_option( 'your_id' ) ) : ?>    
  60.      <h1><?php echo of_get_option( 'your_id'); ?></h1>
  61.        
  62.      
  63.     <?php else : ?>
  64.      
  65.        // Your Default Data
  66.      
  67.     <?php endif; endif; ?>
  68.  
  69.  
  70.                                        /* type three */
  71.                                        
  72.                                        <!-- Another use for give any name to custom post category -->
  73.     <!-- use at frist create category in wp the put the same category name to theme option -->
  74.    
  75.        
  76.     <?php $your_variable = of_get_option( 'test_cate', 'no entry' ); ?>        
  77.            
  78.            
  79.     <?php
  80.     global $post;
  81.     $args = array( 'posts_per_page' => 4, 'post_type'=> 'portfolio-items', 'portfolio_cat' =>
  82.     $your_variable); // <!-- for call -->
  83.     $myposts = get_posts( $args );
  84.     foreach( $myposts as $post ) : setup_postdata($post); ?>
  85.    
  86.     <!-- content hare -->
  87.  
  88.     <?php endforeach; ?>
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.              
  102.  
  103. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement