Change sort order with pre_get_posts
Fires after the query variable object is created, but before the actual query is run. pre_get_posts
WooCommerce Holiday Mode
Sometimes, just like physical stores, your WooCommerce website needs to go on holiday! This snippet does the following on every WooCommerce page. disable cart disable checkout display a custom message
CSS Stop text wrapping around image
http://jsfiddle.net/vandigroup/upKGe/132/ http://www.stubbornella.org/content/2009/07/23/overflow-a-secret-benefit/ https://css-tricks.com/examples/OverflowExample/ For use in WP Show Posts
Full-Width Containers in Limited Width Parents
The idea here is:1. push the container to the exact middle of the browser window with left: 50%2. pull it back to the left edge with negative -50vw marginhttps://css-tricks.com/full-width-containers-limited-width-parents/
Animated Scroll Icon
Note: requires Font Awesome library HTML CSS
iThemes Sync Server IP
Due to the nature of the service your host or a security plugin could block the Sync IP. If this happens you may need to whitelist it. 188.8.131.52 https://help.ithemes.com/hc/en-us/articles/360015500013-Sync-Server-IP
Reset WPML Capabilities
While working on a project using WPML and user role editor, I ran into an issue where I could no longer access certain admin areas of WPML – with my administrator account. I needed a way to recreate the default WPML capabilities. Run this script as a plugin, navigate to any admin page, and then deactivate and uninstall.
Email Forwarding Is A Bad Idea
Forwarding email is re-sending mail from one mailbox to another and can be a problematic practice. Here’s why you should avoid email forwarding.
Facebook Ad Policies: Understanding Personal Attributes
After you carefully craft your amazing creative ad, it gets rejected, with no explanation why. The most likely reason… your ad probably contained “personal attributes.”
Change image sizes using filter
In a typical GeneratePress setup, the image sizes are set in the customizer and apply to all “post” type posts. Using conditional logic, this filter sets the image sizes for other areas of the site, such as custom post type archives, taxonomies, etc.
WPML support for post type switcher plugin
Post Type Switcher is an excellent plugin that allows you to easily move a post from one post type to another. However, the plugin does not work with WPML due to the way WPML stores its translations. Adding this small code snippet to the plugin’s PHP file makes it compatible. Open “Post Type Switcher” plugin PHP file It is located at wp-content/plugins/post-type-switcher/post-type-switcher.php Find lines Add this code above Source: https://www.grzegorowski.com/wordpress-wmpl-post-type-switcher-support/
Force iThemes Sync to Show in WordPress Admin
Once in a while, I need to disconnect and then reconnect iThemes Sync because of a problem. This can be a problem if the Sync dashboard shows ‘Site Down’ and you can not see the plugin in the WordPress admin because it is set to hidden. The following snippet will temporarily force the plugin to show in the WordPress admin for you to reconnect. Enter the url into your browser url bar. http://yoursite.com/wp-admin/plugins.php?ithemes-sync-force-display=1
Angled divs with SCSS
I recently worked on a project where the design called for a slanted or angled div. This was achievable using some CSS selector magic. The following scss snippet easily creates angled divs for you.
Add user instructions to featured image metabox
In this article, I’ll show you how to add custom user instructions just below the featured image metabox, to help make it easier for end-users to upload a featured image that won’t break the design.
Run code on specific custom post types in WordPress admin
Sometimes, I want to run code on specific WordPress admin screen only. It is possible using the get_current_screen() function and checking it against the actual current screen.