Skip to content

Instantly share code, notes, and snippets.

@iftee
iftee / wp-remove-default-image-sizes.php
Last active November 12, 2022 00:21
Custom filter to remove default image sizes (WordPress and WooCommerce) from your theme.
<?php
/*
* Custom filter to remove default image sizes from WordPress.
*/
/* Add the following code in the theme's functions.php and disable any unset function as required */
function remove_default_image_sizes( $sizes ) {
/* Default WordPress */
unset( $sizes[ 'thumbnail' ]); // Remove Thumbnail (150 x 150 hard cropped)
@mattclements
mattclements / function.php
Last active April 16, 2024 17:04
Wordpress Disable Comments (add to function.php)
<?php
add_action('admin_init', function () {
// Redirect any user trying to access comments page
global $pagenow;
if ($pagenow === 'edit-comments.php') {
wp_redirect(admin_url());
exit;
}
@srikat
srikat / functions.php
Last active April 5, 2017 17:46
How to add a container above the wrap inside Header in Genesis. http://sridharkatakam.com/add-container-headers-wrap-genesis/
<?php
//* Do NOT include the opening php tag
// Remove 'header' from structural wrap
add_theme_support( 'genesis-structural-wraps', array(
'nav',
'subnav',
'site-inner',
'footer-widgets',
'footer'
@h2ospace
h2ospace / functions.php
Last active July 29, 2017 00:58
WordPress: ebnale iframe for not administrator
<?php
function content_save_pre_func($content){
global $allowedposttags;
$allowedposttags['iframe'] = array(
'class' => array () ,
'src'= > array() ,
'width' => array(),
'height' => array() ,
'frameborder' => array() ,
@srikat
srikat / functions.php
Last active May 14, 2019 19:16
Excluding categories when using Display Posts Shortcode. http://sridharkatakam.com/exclude-categories-using-display-posts-shortcode/
//* Display Posts Shortcode - Exclude Categories
add_filter( 'display_posts_shortcode_args', 'be_display_posts_shortcode_exclude_categories', 10, 2 );
function be_display_posts_shortcode_exclude_categories( $args, $atts ) {
if( isset( $atts['cat_not_in'] ) ) {
$categories = explode( ',', $atts['cat_not_in'] );
$args['category__not_in'] = $categories;
}
@spigists
spigists / new_gist_file.css
Created October 2, 2013 16:16
Bootstrap 3 styles for Gravity Forms, make sure that in Forms > Settings you have Output CSS set to No and Output HTML5 set to Yes
.gform_wrapper ul {
padding-left: 0;
list-style: none; }
.gform_wrapper li {
margin-bottom: 15px; }
.gform_wrapper form {
margin-bottom: 0; }