Skip to content

Instantly share code, notes, and snippets.

@wplit
wplit / snippet.php
Created January 26, 2022 22:40
Remove 'global styles inline' from WP 5.9
add_action( 'wp_enqueue_scripts', 'lit_remove_global_inline_styles' );
function lit_remove_global_inline_styles() {
wp_dequeue_style('global-styles');
};
@fedegomez
fedegomez / checkTitles.js
Last active October 26, 2024 20:44
Checks if the title of the result in the SERP matches the title of the URL
javascript: (function (doc){var changed=0; function checkTitles(){console.log('jQuery version ', $.fn.jquery, ' loaded'); var position=1; var items=[]; var results=$('#rso .kp-blk .g, #rso .g[class="g"], #rso .srg .g').not('.kno-kp .g').find('div:first').find('a:first'); $('.title-changed, #CountTitlesChanged').remove(); results.each(function (){if (!$(this).parents('.related-question-pair').length){var parent=$(this).closest('.tF2Cxc').length > 0 ? $(this).closest('.tF2Cxc') : $(this).closest('li'); items.push([ position, $(this).find('h3').text(), encodeURI($(this).attr('href')), parent]); position++;}}); var numItems=1; cors_proxies=[ 'https://api.codetabs.com/v1/proxy?quest=', 'https://jsonp.afeld.me/?url=',]; items.forEach(item=>{$.ajax({url: cors_proxies[Math.floor(Math.random() * cors_proxies.length)] + item[2], success: function (data, status, xhr){title=$(data).filter('title').text(); var html='<div class="title-changed">'; if (title !=item[1]){html +='<span style="font-weight: bold;color: #ff6961;">
@TeemuSuoranta
TeemuSuoranta / fix-acf-menu-fields-to-polylang.php
Created March 11, 2021 13:51
Fix ACF menu location rules to work on all Polylang locales
<?php
/**
* Fix ACF menu location rules to work on all Polylang locales
*
* Polylang registers localized variations to menu locations and by default
* ACF cannot hook to all of them unless they are manually all picked.
* Polylang separates location with three undescores (eaxmple: primary___en).
*
* This hook automatically applies all menu location rules to all languages.
* Works for both nav_menu and nav_menu_item related fields.
@swinggraphics
swinggraphics / oxy-save-rendered-content.php
Last active June 15, 2022 21:56
Copy compiled Oxygen page content to post_content for search
/* Copy compiled Oxygen page content to post_content for search */
function sg_save_rendered_page_content( $meta_id, $object_id, $meta_key, $meta_value ) {
// Debugging
// $debug .= preg_replace( '#(\[/[^\]]+?\])#', "$1\n", $meta_value );
// file_put_contents( plugin_dir_path( __FILE__ ) . 'debug.html', $debug );
if ( 'ct_builder_shortcodes' != $meta_key ) return;
// Don't try to render anything with inner content
if ( false !== strpos( $meta_value, '[ct_inner_content' ) ) return;
@erropix
erropix / oxy-cm-theme.scss
Created September 21, 2020 10:35
An Advanced Scripts snippet to enhance the Oxygen code editor theme
/*
Title: Oxygen Code Editor Theme
Type: CSS > Compile SCSS Code
Location: Custom Hooks
Hook name: oxygen_enqueue_ui_scripts
Priority: 10
*/
#oxygen-ui {
.cm-s-default {
@ThatGuySam
ThatGuySam / allowed-block-types.php
Last active October 31, 2023 08:06
Limit allowed Gutenberg Blocks with full list of native Wordpress Blocks
<?php
// Hook up function to allowed_block_types filter
add_filter( 'allowed_block_types', 'set_allowed_block_types' );
/**
* Set allowed gutenburg block types
* https://rudrastyh.com/gutenberg/remove-default-blocks.html
*/
@yankiara
yankiara / oxygen-repeater-dynamic-query.php
Last active July 15, 2024 15:17
Use dynamic queries with Oxygen's repeater
/* I'll put here different examples of dynamic query for Oxygen repeater :
* - Use one of the following repeater_dynamic_query definitions
* in code block just BEFORE the repeater
* - Set the repeater custom query settings : post type, number of posts, order...
* - Add the remove_action in a code block AFTER the repeater
*/
/****************************************************************************************************
* Display related posts for any CPT with taxonomy:
@lubieowoce
lubieowoce / yoast_coauthors_integration.php
Last active June 1, 2023 01:17
Integrate Yoast with CoAuthors Plus
<?php
// Written against:
// - Yoast SEO 12.3
// - Co-Authors Plus 3.4
// - Wordpress 4.9.3
// - PHP 7.1
/*
@ulziibat-n
ulziibat-n / wpseo_schema_organization.php
Created September 10, 2019 14:14 — forked from nicomollet/wpseo_schema_organization.php
Yoast SEO Organization Schema Replaced By LocalBusiness
<?php
/**
* Add LocalBusiness to schema Organization
*
* @api array $data The graph piece to filter.
*
* @return array
*/
function custom_wpseo_schema_organization($data){
@pshapiro
pshapiro / GoogleEntities.ipynb
Last active October 7, 2024 09:23
Extract Entities from Search Results using Google NLP for Keyword Research Opportunities
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.