Follow us on

Codestar Support Forum » WordPress Plugins » Codestar Framework

how to load content before acticve codestar

  1. Hello Sir,

    Example :

    <?php  if($stok_customizer['scroll-up'] ): ?>
    	<div class="scroll-top"><i class="fas fa-long-arrow-alt-up"></i>
    	</div>
    	<?php endif;?>CopyCopied!

    Its works well, I don't have any problems with the code. but our main problem is this code not run without the code start plugin active. I like to show the code all time after the theme is active . if someone forgets to activate the code star plugin but the code runs well .

    I know if i make code like its work well but I like to keep also code start function condition like before one, so its possible ??

    <div class="scroll-top"><i class="fas fa-long-arrow-alt-up"></i>
    	</div>CopyCopied!
    Posted 2 years ago #

  2. Codestar
    Admin

    Hi,

    Firstly, take a look again framework setup: http://codestarframework.com/documentation/#/configurations?id=admin-option-framework then see the "GET AN OPTION VALUE (ADVANCED)"

    // A Custom function for get an option
    if ( ! function_exists( 'prefix_get_option' ) ) {
      function prefix_get_option( $option = '', $default = null ) {
        $options = get_option( 'my_framework' ); // Attention: Set your unique id of the framework
        return ( isset( $options[$option] ) ) ? $options[$option] : $default;
      }
    }
    
    echo prefix_get_option( 'opt-text' );
    echo prefix_get_option( 'opt-text', 'default value' );CopyCopied!

    You must use like this for get an option. then Instead of using your style, please check the code below, and let me know if this works for you or not.

    <?php  if( prefix_get_option( 'scroll-up', true ) ): ?>
      <div class="scroll-top"><i class="fas fa-long-arrow-alt-up"></i></div>
    <?php endif;?>CopyCopied!

    In this usage, default is "true" and no need to active plugin.

    You understand ?

    Regards, Codestar

    Posted 2 years ago #