Weekly routine to clean up unused Docker Desktop resources on macOS using launchd.
- Images not referenced by any container (including untagged/dangling)
- Volumes with no associated containers
- Custom networks with no associated containers
- Build cache
| add_action('wp_footer', 'fix_elementor_popup'); | |
| function fix_elementor_popup() { | |
| ?> | |
| <script> | |
| jQuery(window).load(function () { | |
| jQuery.each(elementorFrontend.documentsManager.documents, (id, elementorDoc) => { | |
| if (elementorDoc.getModal) { | |
| elementorDoc.getModal().on('show', () => { | |
| // REQUIRED |
| (function(){ | |
| let speed = 1; | |
| function autoScroll(){ | |
| window.scrollBy(0,speed); | |
| if((window.innerHeight+window.scrollY)<document.body.offsetHeight){ | |
| requestAnimationFrame(autoScroll); | |
| } | |
| } | |
| autoScroll(); | |
| })(); |
| <?php | |
| // Disables support for comments and trackbacks on all post types | |
| function disable_comments_post_types_support() { | |
| $post_types = get_post_types(); | |
| foreach ($post_types as $post_type) { | |
| if(post_type_supports($post_type, 'comments')) { | |
| remove_post_type_support($post_type, 'comments'); | |
| remove_post_type_support($post_type, 'trackbacks'); |
The snippets below should be inserted into your WordPress theme's functions.php file or via a plugin that does this for you. I particularly like Code Snippets.
The following filter prevents CF7 from rendering multiple <p> tags in your form, improving custom styling.
add_filter('wpcf7_autop_or_not', '__return_false');| function getDeviceType() { | |
| const ua = navigator.userAgent.toLowerCase(); | |
| const tablet = /ipad|android(?!.*mobile)|tablet|playbook|silk/; | |
| const mobile = /iphone|ipod|android.*mobile|blackberry|bb10|opera mini|windows phone/; | |
| if (tablet.test(ua)) { | |
| return "tablet"; | |
| } | |
| if (mobile.test(ua)) { | |
| return "mobile"; | |
| } |
| SET @prefix = 'wp_'; -- DEFINE TABLES PREFIX | |
| SET @old_url = 'http://old-site.com'; -- DEFINE THE OLD/CURRENT URL | |
| SET @new_url = 'http://new-site.com'; -- DEFINE THE NEW URL | |
| SET @query1 = CONCAT('UPDATE ', @prefix, 'options SET option_value = REPLACE(option_value, ''', @old_url, ''', ''', @new_url, ''') WHERE option_name = ''home'' OR option_name = ''siteurl'''); | |
| PREPARE stmt1 FROM @query1; | |
| EXECUTE stmt1; | |
| DEALLOCATE PREPARE stmt1; | |
| SET @query2 = CONCAT('UPDATE ', @prefix, 'posts SET post_content = REPLACE(post_content, ''', @old_url, ''', ''', @new_url, ''')'); |
| <?php | |
| add_action( 'jet-engine/register-macros', function(){ | |
| class Related_Items_By_Sibling_Relation extends \Jet_Engine_Base_Macros { | |
| public function macros_tag() { | |
| return 'rel_get_items_by_relation'; | |
| } |
| <wpml-config> | |
| <elementor-widgets> | |
| <widget name="jet-accordion"> | |
| <fields-in-item items_of="toggles"> | |
| <field type="Classic Accordion: Title" editor_type="LINE">item_label</field> | |
| <field type="Classic Accordion: Editor Content" editor_type="VISUAL">item_editor_content</field> | |
| </fields-in-item> | |
| </widget> | |
| <widget name="jet-hotspots"> | |
| <fields-in-item items_of="hotspots"> |
| <?php | |
| /** | |
| * JetEngine CCT-related API functions to use in theme or plugin | |
| * | |
| * Theme usage - include get_theme_file_path( 'jet-engine-cct-api.php' ); | |
| * Plugin usage - include PLUGIN_PATH . 'path-to-file-inside-plugin/jet-engine-cct-api.php'; | |
| */ | |
| /** |