Example #1
0
function aacf_scripz_n_stylz()
{
    if (!is_admin() && $GLOBALS['pagenow'] != 'wp-login.php') {
        // comment out the next two lines to load the local copy of jQuery
        wp_deregister_script('cdn-src-google-prettify');
        wp_register_script('cdn-src-google-prettify', 'https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js', false, '1.11.2');
        wp_enqueue_script('cdn-src-google-prettify');
        wp_enqueue_style('style-name', aacf()->settings['dir'] . 'css/code-prettify-monokai.css');
        // wp_enqueue_script( 'script-name', aacf()->settings['path'] . '/js/example.js', array(), '1.0.0', true );
    }
}
Example #2
0
function aacf_sandbox_output($atts = array(), $contents = null)
{
    extract(shortcode_atts(array('default' => 'values', 'color' => '#222'), $atts));
    $debug_title = '<h6>aacf()->settings:</h6>';
    ob_start();
    // $contents = print_r(aacf()->settings);
    $contents = var_dump(aacf()->settings);
    // foreach (aacf()->settings as $key => $value) {
    // 	$contents .= $key.'<br>'.$value.'<hr>';
    // }
    $contents = ob_get_contents();
    ob_end_clean();
    return <<<OUTPUT
<div class="aacf-debug">
\t<pre class="prettyprint lang-php" style="color:{$color};">{$debug_title}{$contents}</pre><button class="aacfd-hide" aria-label="close aacf debug box">&times;</button>
</div>
OUTPUT;
    // [aacf-sandbox]My color should be #222[/aacf-sandbox]
}
if (!defined('ABSPATH')) {
    exit;
}
// Exit if accessed directly
if (!class_exists('aacf')) {
    class Aacf
    {
        var $settings;
        function __construct()
        {
        }
        function initialize()
        {
            $this->settings = array('name' => __('Assimilating Advanced Custom Fields', 'aacf'), 'version' => '0.1', 'basename' => plugin_basename(__FILE__), 'path' => plugin_dir_path(__FILE__), 'dir' => plugin_dir_url(__FILE__));
            include_once 'inc/shortcodes.php';
            include_once 'inc/enqueue.php';
        }
    }
    function aacf()
    {
        global $aacf;
        if (!isset($aacf)) {
            $aacf = new aacf();
            $aacf->initialize();
        }
        return $aacf;
    }
    aacf();
}
// end if aacf class exists
/*EOF*/