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
/** | |
* WPGulp Configuration File | |
* | |
* 1. Edit the variables as per project requirements. | |
* 2. Everything else is in the gulpfile to keep it consistent across our projects. | |
*/ | |
// Define the default project configuration. | |
let projectConfig = { | |
// Local project URL of your already running WordPress site. Could be something like wpgulp.local or localhost:3000 depending upon your local WordPress setup. |
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 | |
/** | |
* Image and PDF compression resources message at upload screens. | |
*/ | |
function upload_suggestions_message() { ?> | |
<h3>Uploading Files Guide</h3> | |
<p class="upload-html-bypass hide-if-no-js">Here are a few options to reduce the size of images/files before uploading them (please always do this to help load the site faster for visitors!!).</p> | |
<ul> | |
<li><a href="https://compressor.io/" target="_blank">Compressior.io - Compress all your images with this site.</a></li> | |
<li><a href="https://smallpdf.com/" target="_blank">SmallPDF.com - Compress those PDFs as well for clients or on page display.</a></li> |
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 Primary Category | |
* | |
* Get the primary category of the post. | |
* Should be used inside the loop. | |
* | |
* @param string $att Attribute of the category that is desired (if 'all' is passed, will return whole object) | |
* @param boolean $wpseo Whether or not to use WPSEO (if it's on/installed) | |
* |
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 | |
/** | |
* Has Gallery | |
* | |
* Detect whether the page/post has a gallery. | |
* | |
* @return boolean True if page/post content has a gallery, else false. | |
*/ | |
function has_gallery() { | |
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
<?php | |
/** | |
* Removes the "featured image" from the content | |
* Google news stand/Facebook Instant Articles do not like it | |
* Even different sizes of the Featured Image throw warnings | |
* | |
* @param string $content The object/post content. | |
*/ | |
function remove_featured_image_from_content( $content ) { | |
// Get the post ID. |
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 | |
// Deep search array for key. | |
function multi_key_exists( array $arr, $key ){ | |
// is in base array? | |
if ( array_key_exists($key, $arr) ) return true; | |
// check arrays contained in this array. | |
foreach ( $arr as $element ) { | |
if ( is_array( $element ) && multi_key_exists( $element, $key ) ){ | |
return true; |