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
/** | |
* Check whether we are on this page or a sub page | |
* From WP Codex https://developer.wordpress.org/reference/functions/is_page/ | |
* | |
* @param int $pid Page ID to check against. | |
* @return bool True if we are on this page or a sub page of this page. | |
*/ | |
function wpdocs_is_tree( $pid ) { // $pid = The ID of the page we're looking for pages underneath | |
$post = get_post(); // load details about this page | |
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
/** | |
* Change comment form textarea to use placeholder | |
* | |
* @since 1.0.0 | |
* @param array $args | |
* @return array | |
*/ | |
function ea_comment_textarea_placeholder( $args ) { | |
$args['comment_field'] = str_replace( 'textarea', 'textarea placeholder="Comment"', $args['comment_field'] ); | |
return $args; |
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
/** | |
* Check if a post is a custom post type. | |
* @param mixed $post Post object or ID | |
* @return boolean | |
*/ | |
function is_custom_post_type( $post = NULL ) | |
{ | |
$all_custom_post_types = get_post_types( array ( '_builtin' => FALSE ) ); | |
// there are no custom post types |
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
//For updating displayed file name for form file upload inputs - Requires jQuery | |
$('input[type="file"]').on('change', function(e) { | |
var fileSelect = e.target, | |
fileName = e.target.value.split(/\\|\//).pop(), | |
fileNameTruncated = fileName.length > 20 ? fileName.substr(0, 20) : fileName, | |
fileNameDisplay = fileSelect.dataset.displayfilename; | |
$("."+fileNameDisplay).html(fileNameTruncated+"..."+fileName.substr(fileName.length - 4)); | |
}); |
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
var gulp = require('gulp'); | |
var gutil = require('gulp-util'); | |
var sass = require('gulp-sass'); | |
var browserSync = require('browser-sync').create(); | |
var reload = browserSync.reload; | |
gulp.task('sass', function () { | |
gulp.src('./assets/styles/**/*.scss') | |
.pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError)) |