This file contains 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 | |
/** | |
* Reorder date string | |
* | |
* @param string $input | |
* @param string $currentFormat | |
* @param string $newFormat | |
* @return string | |
*/ | |
function reorder_date( $input, $currentFormat, $newFormat ) |
This file contains 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 | |
/** | |
* Formatted var_dump() | |
* | |
* @param variable $var | |
* @param string $title | |
* @return void | |
*/ | |
function pre_var_dump( $var, $title = NULL ) | |
{ |
This file contains 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 | |
/** | |
* Using get_posts() function | |
*/ | |
$custom_posts = get_posts( array( | |
'post_type' => 'post_type_name', | |
) ); | |
$tmp_post = $post; foreach ( $custom_posts as $post ) : setup_postdata( $post ); | |
// loop |
This file contains 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 | |
/** | |
* Truncates a string | |
* | |
* @param string text | |
* @param int limit | |
* @return string | |
*/ | |
function truncate( $text, $limit ) | |
{ |
This file contains 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 | |
/** | |
* Get post thumbnail URL | |
* | |
* @param string $size | |
* @return string | |
*/ | |
function get_thumbnail_url( $size = 'thumbnail' ) | |
{ | |
global $post; |
This file contains 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
/** | |
* Generic flexbox class | |
*/ | |
.flex { | |
display: flex; | |
align-items: stretch; | |
justify-content: center; | |
} | |
@media (max-width: 750px) { .flex { display: inherit; } } |
This file contains 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 | |
/** | |
* Download a file | |
* | |
* @param string $file | |
* @return void | |
*/ | |
function download_file( $file ) | |
{ | |
if ( file_exists($file) && $file != $_SERVER['DOCUMENT_ROOT'] ) { |
This file contains 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 | |
/** | |
* Assign custom post type labels quickly | |
* | |
* @param string $singular | |
* @param string $plural | |
* @return array | |
*/ | |
function register_post_type_labels( $singular, $plural = NULL ) | |
{ |
This file contains 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
@mixin transition($transition-property, $transition-time: 0.3s, $method: ease-in-out) { | |
-webkit-transition: $transition-property $transition-time $method; | |
-moz-transition: $transition-property $transition-time $method; | |
-ms-transition: $transition-property $transition-time $method; | |
-o-transition: $transition-property $transition-time $method; | |
transition: $transition-property $transition-time $method; | |
} |
This file contains 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
/** | |
* jQuery Ajax Form Submission | |
*/ | |
jQuery( document ).ready(function( $ ) { | |
$( document ).on( 'click', 'input[type="submit"]', function() { | |
var form = $( this ).closet( 'form' ); | |
$.post( form.attr( 'action' ), form.serialize(), function( data ) { | |
// Success | |
OlderNewer