Advertisement
arnabkumar

redux framework use

May 7th, 2014
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.06 KB | None | 0 0
  1. <?php
  2.    
  3.  
  4.     <?php
  5.     // paste this code on functions php file
  6.     // make sure that directory names are same
  7.     //redux active via theme
  8.    
  9.               //active with php conditional statement
  10.    
  11.     if ( !class_exists( 'ReduxFramework' ) && file_exists( dirname( __FILE__ ) . '/ReduxFramework/ReduxCore/framework.php' ) ) {
  12.         require_once( dirname( __FILE__ ) . '/ReduxFramework/ReduxCore/framework.php' );
  13.     }
  14.     if ( !isset( $redux_demo ) && file_exists( dirname( __FILE__ ) . '/ReduxFramework/sample/sample-config.php' ) ) {
  15.         require_once( dirname( __FILE__ ) . '/inc/theme-option.php' );
  16.     }
  17.    
  18.    
  19.    
  20.                      //active with default
  21.                      
  22.                       // Activate redux framework
  23.  include_once( 'inc/ReduxCore/framework.php' );
  24.  include_once( 'inc/theme-option.php' );
  25.      
  26.     // go to redus directory > sample > sample-config php file, and rename it to any name and call it in your functiona.php */
  27.    
  28.     // If everything is right you have successfully install the redux freamework. :)
  29.      
  30.      
  31.     /*****************************************************************/
  32.             // how to use redux in theme
  33.     /*****************************************************************/
  34.     // call redux with default
  35.      
  36.     <?php global $redux_demo; echo $redux_demo['your_option_id_here']['url'];?>
  37.      
  38.     // text field value
  39.     <?php global $redux_demo; echo $redux_demo['your_option_id_here'];?>
  40.  
  41.    
  42.     // call redux with php if else statement(php if else statement)
  43.  
  44.     <div class="header">
  45.                 <?php global $redux_demo; $your_variable = $redux_demo['your_option_id_here']['url'];?>
  46.                    
  47.                 <?php if($your_variable) :?>
  48.                  <div class="logo">
  49.                         <h1><a href="<?php bloginfo('siteurl') ; ?>"><img src="<?php echo $your_variable; ?>" alt=""/></a></h1>
  50.                 </div>
  51.                 <?php else : ?> //default data
  52.                
  53.                 <div class="logo">
  54.                    <h1><a href="<?php bloginfo('siteurl') ; ?>"><img src="<?php echo get_template_directory_uri(); ?>/images/logo.png" alt=""/></a></h1>
  55.                 </div>
  56.  
  57.                 <?php endif; ?>
  58.                 </header>
  59.    
  60.  
  61. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement