Skip to content

Instantly share code, notes, and snippets.

VA79 vanaf1979

Block or report user

Report or block vanaf1979

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View noscript-to-head.php
<?php
function add_noscript_to_head() {
echo '<noscript>';
echo '<link rel="stylesheet" href="assets/css/style-fallback.css">';
echo '</noscript>';
}
View oldschool-dump.php
<?php
echo '<pre>';
print_r( $somevar );
echo '</pre>';
die();
?>
View using-d-and-dd.php
<?php
$string = "I'm a string";
$array = array( 'one' => 'test one', 'two' => 'test two');
d( $string );
dd( $array , $string );
?>
View dd-example.php
<?php
$array = array( 'one' => 'test one', 'two' => 'test two');
dd( $array );
?>
View functions-d-dd.php
<?php
/*
|--------------------------------------------------------------------------
| Helper functions
|--------------------------------------------------------------------------
*/
/**
* Dump variable.
View functions-require-autoload.php
<?php
require_once __DIR__ . '/vendor/autoload.php';
?>
View load_acf_json.php
<?php
function load_acf_json( string $file ) : array {
return json_decode( file_get_contents( get_template_directory() . $file ) , true );
}
?>
View add-field-group-with-json.php
<?php
function load_acf_json( string $file ) : array {
return json_decode( file_get_contents( get_template_directory() . $file ) , true );
}
function register_acf_field_group() : void {
View change-acf-json-directory.php
<?php
function acf_json_directory( string $path ) : string {
return get_template_directory() . '/my-custom-folder';
}
add_filter( 'acf/settings/save_json' , 'acf_json_directory' );
?>
@vanaf1979
vanaf1979 / other_values_on_wp_post.php
Last active Oct 8, 2019
Gist for my article WordPress: Access post meta fields through WP_Post. https://vanaf1979.nl/wordpress-access-post-meta-fields-through-wp-post/
View other_values_on_wp_post.php
<?php
echo $post->page_template; // The page template for this post.
print_r( $post->post_category ); // Categories associated with this post.
print_r( $post->tags_input ); // Terms associated with this post.
print_r( $post->ancestors ); // Ancestors for this this post.
You can’t perform that action at this time.