Skip to content

Instantly share code, notes, and snippets.

@subrotoice
Last active December 23, 2016 13:38
Show Gist options
  • Save subrotoice/727876770536dc7e31bd54473b196c4b to your computer and use it in GitHub Desktop.
Save subrotoice/727876770536dc7e31bd54473b196c4b to your computer and use it in GitHub Desktop.
<?php
// Second call this
function example_callback( $string ) {
$new_value = $string . " NEW!";
return $new_value;
}
add_filter( 'example_filtersubroto', 'example_callback', 11 );
// First call this
function example_callback2( $string2 ) {
$new_value2 = $string2 . " NEW22!";
return $new_value2;
}
add_filter( 'example_filtersubroto', 'example_callback2', 9 );
$value = "Default Values MyValue";
echo $value = apply_filters( 'example_filtersubroto', $value );
// Expected output: Default Values MyValue NEW22! Default Values MyValue NEW!
// Real output: Default Values MyValue NEW22! NEW!
?>
// You can organize your code using this system. Keep css and js in separate
function theme_styles() {
wp_enqueue_style( 'bootstrap_css', get_template_directory_uri() . '/css/bootstrap.min.css' );
wp_enqueue_style( 'main_css', get_template_directory_uri() . '/style.css' );
}
add_action( 'wp_enqueue_scripts', 'theme_styles' );
function theme_js() {
wp_enqueue_script( 'bootstrap_js', get_template_directory_uri() . '/js/bootstrap.min.js', array('jquery'), '', true );
wp_enqueue_script( 'theme_js', get_template_directory_uri() . '/js/theme.js', array('jquery', 'bootstrap_js'), '', true );
}
add_action( 'wp_enqueue_scripts', 'theme_js' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment