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 | |
/* | |
* Custom language switcher shortcode | |
*/ | |
function trpc_language_switcher($atts) | |
{ | |
ob_start(); | |
global $TRP_LANGUAGE; |
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 | |
/* | |
* Custom language switcher shortcode | |
*/ | |
function trpc_language_switcher($atts) | |
{ | |
ob_start(); | |
global $TRP_LANGUAGE; |
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
/** | |
* Automatically Enable Contact Form 7 Endpoints with Disable WP REST API Plugin | |
* Plugin URI: https://wordpress.org/plugins/disable-wp-rest-api/ | |
*/ | |
function disable_wp_rest_api_enable_contact_form7_endpoints() { | |
$active_plugins = get_option('active_plugins'); | |
// Check if the "Disable WP REST API" plugin is active | |
if (in_array('disable-wp-rest-api/disable-wp-rest-api.php', $active_plugins) | |
// Check if the "Contact Form 7" plugin is active | |
&& in_array('contact-form-7/wp-contact-form-7.php', $active_plugins) |
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 | |
// Preload the Wordpress post featured image (works both with src and srcset) | |
// ref. https://web.dev/preload-responsive-images/ | |
add_action('wp_head', function () { | |
if (has_post_thumbnail()) { | |
$thumb_id = get_post_thumbnail_id( get_the_ID() ); | |
$featured_img_src = wp_get_attachment_image_src( $thumb_id, 'large' )[0]; | |
$featured_img_srcset = wp_get_attachment_image_srcset( $thumb_id ); | |
printf('<link rel="preload" as="image" importance="high" href="%s" srcset="%s" />', $featured_img_src, $featured_img_srcset ); |
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 | |
// Enqueue all js codes combined in a single file. | |
function enqueue_theme_assets() | |
{ | |
wp_enqueue_script( | |
'trackers', | |
get_stylesheet_directory_uri() . '/js/trackers.js', | |
null, | |
null, |
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
//add_action('wp_footer', 'show_template'); | |
add_action( | |
'wp_footer', | |
function() { | |
?> | |
<script>jQuery( function( $ ) { | |
// Цепляемся за событие adding_to_cart | |
$( document.body ).on( 'adding_to_cart', function( event, button ) { | |
// Выцепляем инициатора события (ссылка/кнопка) | |
var $btn = $( button[0] ); |
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 | |
add_action('plugins_loaded','ao_defer_inline_init'); | |
function ao_defer_inline_init() { | |
if ( get_option('autoptimize_js_include_inline') != 'on' ) { | |
add_filter('autoptimize_html_after_minify','ao_defer_inline_jquery',10,1); | |
} | |
} | |
function ao_defer_inline_jquery( $in ) { |
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 | |
class MyTheme | |
{ | |
private function actionAfterSetup($function) | |
{ | |
add_action('after_setup_theme', function() use ($function) { | |
$function(); | |
}); | |
} |
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
<!-- wp:paragraph --> | |
<p><a href="https://gist.github.com/bph/335ddef358bb41efdcd159cbc76f582e">https://gist.github.com/bph/335ddef358bb41efdcd159cbc76f582e</a></p> | |
<!-- /wp:paragraph --> | |
<!-- wp:heading {"className":"eplus-oOhLNH"} --> | |
<h2 class="eplus-oOhLNH">Common Blocks / Formatting / Layout Elements / Widgets and Embeds</h2> | |
<!-- /wp:heading --> | |
<!-- wp:list {"className":"eplus-eI3gin"} --> | |
<ul class="eplus-eI3gin"><li><a href="#images">Images</a> (Single image, cover image, gallery </li><li><a href="#quotes">Pull Quote / Quote</a></li><li><a href="#verse">Verse</a></li><li><a href="#buttons">Buttons</a></li><li><a href="#socialicons" data-type="internal" data-id="#socialicons">Social Icons</a></li><li><a href="#columns">Columns </a> Text (only) columns / Columns experimental</li><li><a href="#cover" data-type="internal" data-id="#cover">Cover</a> with CAT + button</li><li><a href="#paragraphs">Paragraph</a> </li><li><a href="#audio">Audio</a> </li><li><a href="#video">Video</a></li><li><a href="#w |
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 if(is_archive() && ICL_LANGUAGE_CODE == 'ru'){ | |
echo '<meta name="description" content="Программы курсов по охране труда и обучению рабочим специальностям учебно-консультационного центра по охране труда «ПРОФИТЕХ»">'; | |
}?> | |
<?php if(is_archive() && ICL_LANGUAGE_CODE == 'uk'){ | |
echo '<meta name="description" content="Програми курсів з охорони праці та навчання робітничим спеціальностям навчально-консультаційного центру з охорони праці «ПРОФІТЕХ»">'; | |
}?> | |
<?php if($paged > 1 || is_author() || is_tag() || is_date() || is_attachment()){ | |
echo '<meta name="robots" content="noindex,follow" />'; | |
} ?> |
NewerOlder