mortuzahossain
6/17/2017 - 7:06 PM

All About Redux Framework And Single Page template.md

Todo

  1. Chose a HTML template
  2. Make the theme live at wordpress
  3. Including Redux Framework
  4. Make Part by part of the template to work easyer

                        Demo Code

1. Including Redux Framework & Removing Redux Framework From tools

// Including Redux Framework
if ( !class_exists( 'ReduxFramework' ) && file_exists( dirname( __FILE__ ) . '/inc/redux-framework/ReduxCore/framework.php' ) ) {
    require_once( dirname( __FILE__ ) . '/inc/redux-framework/ReduxCore/framework.php' );
}
if ( !isset( $redux_demo ) && file_exists( dirname( __FILE__ ) . '/inc/tust-options.php' ) ) {
    require_once( dirname( __FILE__ ) . '/inc/tust-options.php' );
}
// The value must be over 10
add_action( 'admin_menu', 'remove_redux_menu',12 );
    function remove_redux_menu() {
    remove_submenu_page('tools.php','redux-about');
}

2. Removing Slide Items From Redux Framework

USING CSS

#ID_OF_MENU .upload_button_div {
  display: none;
}
#ID_OF_MENU .redux_slides_add_remove {
  display: none;
}

USING Array Attribute

'show' => array(
     'title' => true,
     'description' => true,
     'url' => false              // <<========= that is what was asked at the top.
),

3. For Admin Bar Icon

https://developer.wordpress.org/resource/dashicons/#admin-multisite

4.For redux Icon

http://elusiveicons.com/icons/

5. Slide Item Data Retrive

<?php 
    if (isset($tust['contuct-social']) && !empty($tust['contuct-social'])) {
        foreach ($tust['contuct-social'] as $single_social) {
            ?>
                # The dynamic code
            <?php
            if ($single_social['sort'] == 7) break;//When we want to break the loop
        }
    } else {
?>

     # fall back data

<?php } ?>

6. Write js in footer using functions.php

<?php

function add_this_script_footer(){ ?>
<script type="text/javascript">
    jQuery(document).ready(function ($) {
    
    });
</script>
<?php } 

add_action('wp_footer', 'add_this_script_footer'); ?>

7. Write js in footer using functions.php

<?php

function add_this_script_header(){ ?>
<script type="text/javascript">
    jQuery(document).ready(function ($) {
    
    });
</script>
<?php } 

add_action('wp_head', 'add_this_script_header'); ?>

8. Including template part in index.php

  • Create TEMPLATE_NAME-parts Folder
  • Create All the template part by TEMPLATE_NAME-PARTS_NAME.php
For including in index file use this code
    get_template_part( 'TEMPLATE_NAME-parts/TEMPLATE_NAME', 'PARTS_NAME' );
If use sorter for nav-item then use this code
global $GLOBAL_VERIABLE_REDUX_FRAMEWORK;
$layout = $GLOBAL_VERIABLE_REDUX_FRAMEWORK['ID']['enabled'];
if ($layout) {
    foreach ($layout as $key => $value) {
        switch ($key) {
            case 'PARTS_NAME':
                get_template_part( 'TEMPLATE_NAME-parts/TEMPLATE_NAME', 'PARTS_NAME' );
                break;
        }
    }
} else {
    # Fall Back Data
}