This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function archive_tax_name() { | |
$archive_tax_name = null; | |
if( is_archive() && is_category() ) { | |
$queried_object = get_queried_object(); | |
$queried_object_taxonomy = $queried_object->taxonomy; | |
$taxonomy = get_taxonomy($queried_object_taxonomy); | |
$archive_tax_name = $taxonomy->labels->singular_name; | |
} | |
return $archive_tax_name; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Sets the default categories | |
function add_the_categories() { | |
$categories = array( | |
'Case Study', | |
'Blog', | |
'Article' | |
); | |
foreach( $categories as $category ) { | |
$exists = term_exists( $category, 'category' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<span class="approval__date">{{ item.designDate.toDateString().slice(4, -5) }}</span> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{ set cats = "meowers" }} | |
{{ cats.slice(1, -1) }} | |
{# Returns: eower #} | |
{{ cats.slice(3) }} | |
{# Returns: wers #} | |
{{ set dogs = " woofers " }} | |
{{ dogs | trim }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$string = "Skateboarding, Surfing, Horseriding"; // The original comma seperated string | |
$columns = explode(", ", $string); // Turns the string into an array | |
$column_array = array(); // Sets up the outer array | |
foreach ($columns as $key => $value) { | |
// Loops through the array creating keys and values | |
$column_array[$key]['skill'] = $value; | |
// $column_array[$key]['level'] = '0'; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Add the login styles | |
function add_login_scripts() { | |
/** | |
* login_enqueue_scripts is the proper hook to use when enqueuing items that | |
* are meant to appear on the login page. | |
*/ | |
wp_enqueue_style( 'core', get_stylesheet_directory_uri() . '/assets/css/login.min.css', array('login') ); | |
} | |
add_action( 'login_enqueue_scripts', 'add_login_scripts' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Add SVG to allowed file uploads | |
function add_file_types_to_uploads($file_types){ | |
$new_filetypes = array(); | |
$new_filetypes['svg'] = 'image/svg'; | |
$file_types = array_merge($file_types, $new_filetypes ); | |
return $file_types; | |
} | |
add_action('upload_mimes', 'add_file_types_to_uploads'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$categories = get_the_category(); | |
if ( ! empty( $categories ) ) { | |
$first_category = $categories[0]; | |
$first_category_name = esc_html( $first_category->name ); | |
$first_category_link = esc_url( get_category_link( $first_category->term_id ) ); | |
} | |
?> |