This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Template for displaying a map on the locations post-type archive page. | |
* | |
* @package Twenty_Twelve | |
* @subpackage Local SEO for WordPress Archive page template | |
* @author Joost de Valk | |
*/ | |
get_header(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Делаем alt для Превью поста | |
* Функция автозаполнения alt должна быть отключена в плагинах типа | |
* Webcraftic Clearfy или любом другом, который устанавливает alt автоматически, так как там всегда генерирует на основе заголовка | |
* В некоторых темах, например OceanWP alt прописан как заголовок статьи в самой теме, и там нужно дополнительно кодить | |
* в Astra всё нормально работает | |
*/ | |
add_filter( 'wp_get_attachment_image_attributes', 'add_best_alt_attachment_image', 90, 2 ); | |
function add_best_alt_attachment_image( $attr, $attachment ) { | |
//проверяем не заполнен ли уже alt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Change wp_ to your database prefix | |
-- Change domain.com to your domain | |
-- Change string to the text you want to search for | |
SELECT | |
ID as 'Post ID', | |
post_title as 'Title', | |
CONCAT('http://www.domain.com/',post_name) as 'URL' | |
FROM `wp_posts` | |
WHERE post_type = 'post' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// There seems to be a few algorithms floating around for brightness/luminance detection. | |
// One uses NTSC `(299*R + 587*G + 114*B)` which is incorrect for web colors (sRGB) see | |
// `rgbLuminance` for "better" coefficients (seems subjective but agreed apon). To be more | |
// accurate you need to also convert RGB from sRGB color space (which gives more spectrum to lighter colors) | |
// to linear rgb which normalizes colors across the spectrum - better for processing. | |
// see https://stackoverflow.com/questions/596216/formula-to-determine-perceived-brightness-of-rgb-color | |
// convert sRGB to linear RGB values | |
// - channel ** 2.218 same as Math.pow((channel + 0.055) / 1.055, 2.4) | |
// - i've seen this simplified to be just `(channel / 255) ** 2.21` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For Yoast SEO Plugin Version: 14.1+ add to your Wordpress Theme's functions.php... | |
// Remove All Yoast HTML Comments | |
// https://gist.github.com/paulcollett/4c81c4f6eb85334ba076 | |
// Credit @devendrabhandari (https://gist.github.com/paulcollett/4c81c4f6eb85334ba076#gistcomment-3303423) | |
add_filter( 'wpseo_debug_markers', '__return_false' ); | |
// For Yoast SEO Plugin Version: < 14.1 add to your Wordpress Theme's functions.php... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Remove Yoast HTML Comments | |
//https://gist.github.com/robwent/f36e97fdd648a40775379a86bd97b332 | |
function go_yoast() { | |
if (defined('WPSEO_VERSION')){ | |
add_action('get_header',function (){ ob_start(function ($o){ | |
return preg_replace('/\n?<.*?Yoast SEO plugin.*?>/mi','',$o); }); }); | |
add_action('wp_head',function (){ ob_end_flush(); }, 999); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Change min password strength. | |
* | |
* @author James Kemp (Iconic) | |
* @link http://iconicwp.com/decrease-strength-required-woocommerce-passwords/ | |
* @param int $strength | |
* @return int | |
*/ | |
function myclass_min_password_strength( $strength ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include ("classes/Schema_Event.php"); | |
add_filter( 'wpseo_schema_graph_pieces', 'PREFIX_add_graph_pieces', 11, 2 ); | |
/** | |
* Adds Schema pieces to our output. | |
* | |
* @param array $pieces Graph pieces to output. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use \Yoast\WP\SEO\Generators\Schema\Abstract_Schema_Piece; | |
class Schema_Event extends Abstract_Schema_Piece { | |
/** | |
* Determines whether or not a piece should be added to the graph. | |
* | |
* @return bool |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
if (window.jQuery) { | |
jQuery(document).ready(function() { | |
jQuery(document).on('submit_success', '.elementor-form', function(event) { | |
// Push the event to the dataLayer for Google Tag Manager | |
window.dataLayer = window.dataLayer || []; | |
window.dataLayer.push({ | |
event: 'elementor_form_submission', | |
formName: event.target.getAttribute('name') || | |
(event.target.querySelector('[name="form_id"]') ? event.target.querySelector('[name="form_id"]').value : 'unknown') || |