Skip to content

Instantly share code, notes, and snippets.

@bewho
bewho / SEO Checklist.md
Created December 18, 2018 10:12 — forked from ericrasch/SEO Checklist.md
SEO Checklist
@bewho
bewho / create_deferred_image_tag.php
Created December 19, 2018 03:38 — forked from bpb54321/create_deferred_image_tag.php
Outputs HTML for image tags that load a WordPress medium size image on initial load, then a separte javascript file (image_deferred.js) loads in the srcset and sizes attributes.
/**
* Helper function for getting the widths and url's of all the available crops of an image.
* @param Number $id : The id of the image that you need the info for
* @param Array $image_sizes_to_exclude An array of strings with the names of image sizes to exclude from the output
* @return Array An indexed array, where at each index there is an associative array with array["width"] containing an image width and array["url"] containing the corresponding image url.
* Example: Array(
* [0] => Array(
* [width] => 300
* [url] => http://placehold.it/50x50
* ),
@bewho
bewho / wp-functions.php
Created December 19, 2018 12:34 — forked from mohsinr/wp-functions.php
WordPress Common Custom Codes for Functions.php
<?php
//* Add new image sizes
add_image_size( 'logo-thumb', 270, 180, TRUE );
//* Change the number of portfolio items to be displayed (props Bill Erickson)
add_action( 'pre_get_posts', 'minimum_portfolio_items' );
function minimum_portfolio_items( $query ) {
if ( $query->is_main_query() && !is_admin() && is_post_type_archive( 'portfolio' ) ) {
$query->set( 'posts_per_page', '6' );
@bewho
bewho / functions.php
Created December 20, 2018 09:58 — forked from sebastienserre/functions.php
Snippet for WP functions.php
<?php
// add a favicon
function favicon_link() {
echo '<link rel="shortcut icon" type="image/x-icon" href="http://www.thivinfo.com/wp-content/themes/thivinfo_v3/favicon.ico" />' . "\n";
}
add_action( 'wp_head', 'favicon_link' );
@bewho
bewho / functions.php
Created December 20, 2018 09:58 — forked from fernandiez/functions.php
Shortcode Placeholder Image dummyimage_shortcode_function
// Añadir Shortcode
function dummyimage_shortcode_function( $atts ) {
// Atributos
$atts = shortcode_atts(
array(
'width' => '600',
'height' => '300',
'background' => 'eeeeee',
'text' => 'ffffff',
@bewho
bewho / remove-woocommerce-styles-scripts.php
Created January 2, 2019 10:38 — forked from gregrickaby/remove-woocommerce-styles-scripts.php
Remove WooCommerce styles and scripts.
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below into functions.php
/**
* Manage WooCommerce styles and scripts.
*/
function grd_woocommerce_script_cleaner() {
// Remove the generator tag
remove_action( 'wp_head', array( $GLOBALS['woocommerce'], 'generator' ) );
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below into functions.php
/**
* Remove all WooCommerce scripts and styles! Forever!
*
* @author WP Smith
* @since 1.0.0
*/
function grd_remove_woocommerce_styles_scripts() {
<?php
/**
* Set Yoast SEO metabox priority to low.
*/
function wds_client_move_yoastseo_metabox() {
return 'low';
}
add_filter( 'wpseo_metabox_prio', 'wds_client_move_yoastseo_metabox' );
@bewho
bewho / wp-config.php
Created January 2, 2019 10:41 — forked from gregrickaby/wp-config.php
WP DEBUG
<?php // do not include leading php tag
/**
* For developers: WordPress debugging mode.
*
* Change this to true to enable the display of notices during development.
* It is strongly recommended that plugin and theme developers use WP_DEBUG
* in their development environments.
*/
define('WP_DEBUG', true);
@bewho
bewho / recent-post-with-images.php
Created January 2, 2019 10:42 — forked from gregrickaby/recent-post-with-images.php
Recent Posts with Images
<?php
/*
Plugin Name: Recent Posts with Images
Plugin URI: http://webdevstudios.com
Description: Display recent posts with images filterable by category or post type in a widget area.
Version: 1.0.0
Author: WebDevStudios
Author URI: http://webdevstudios.com
License: GPLv2
Text Domain: textdomain