This file contains 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 | |
function parseBlocks($blocks, $block_id) | |
{ | |
foreach ($blocks as $block) { | |
if($block['blockName'] == $block_id) { | |
return $block['attrs']['data']; | |
} | |
if (!empty($block['innerBlocks'])) { | |
if ($data = parseBlocks($block['innerBlocks'], $block_id)) { | |
return $data; |
This file contains 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
class Walker_Add_Myterms extends Walker_Nav_Menu | |
{ | |
public function end_el(&$output, $item, $depth = 1, $args = array()) | |
{ | |
if ($item->object === 'category') { | |
$children = get_terms('category', array('child_of' => $item->object_id)); | |
if (!empty($children) && !is_wp_error($children)) { | |
$output .= '<ul class="sub-menu">'; |
This file contains 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
/** | |
* Insert post terms | |
* | |
* @param array|string $terms | |
* @param integer $post_id | |
* @return void | |
*/ | |
function _insertPostTerms($terms, $post_id, $taxonomy) | |
{ | |
$term_ids = []; |
This file contains 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
document.body.insertAdjacentHTML('beforeend', '<style>body .VideoPlayer {width: 100vw;height: calc(100vh - 91px);right: 0 !important;bottom: auto;background: #111;z-index: 21;top: 0; padding-top: 8vh; align-items: flex-start;}body .VideoPlayer .VideoPlayer__container, body .VideoPlayer .VideoPlayer__container video {width: 100%; max-width: 1200px;} body .VideoPlayer__overlay {background: none;} </style>') |
This file contains 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
" scp config | |
let g:enable_scp = 1 | |
let g:scp_server = "server_ip" | |
let g:scp_user = "server_username" | |
let g:scp_remote = "remote_path" | |
let g:scp_local = "local_path" | |
let g:scp_build_local_path = "local_build_folder" | |
let g:scp_build_remote_path = "remote_build_folder" |
This file contains 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
document.addEventListener('lazybeforeunveil', e => { | |
var img = e.target, | |
attr = img.hasAttribute('data-bgset') ? 'data-bgset' : 'data-src', | |
src = img.getAttribute(attr), | |
resize = '/images.php?max_width=' + window.innerWidth + '&imgfile=' + src | |
img.setAttribute(attr, resize) | |
}, false) |
This file contains 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 | |
/** | |
Plugin name: Disable Polylang Variation Sync | |
Plugin URI: https://designamite.co.uk | |
Version: 0.2 | |
Author: Steven Brown | |
Author uri: https://designamite.co.uk | |
Description: Removes actions that sync product variation data | |
WC requires at least: 3.0 | |
WC tested up to: 3.7 |
This file contains 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 | |
function force_pw_reset_edit_profile( $user ) { | |
// Proper authentication | |
if ( ! current_user_can( 'edit_users' ) ) return; | |
// Do not show on user's own edit screen | |
if ( get_current_user_id() == $user->ID ) return; |
This file contains 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
function get_template_page_url($template_name) { | |
$page_permalink = ""; | |
$page = get_pages( array( | |
'meta_key' => '_wp_page_template', | |
'meta_value' => $template_name | |
) ); | |
if ( ! empty( $page ) && 0 < count( $page ) ) : | |
$translate_page = get_post($page[0]->ID); | |
$page_permalink = get_permalink( $translate_page ) ; |
This file contains 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 | |
/** | |
This is used on a site where blog posts are in each english region, to avoid content duplication this method generates | |
the canonical for the main English site language | |
**/ | |
function is_blog_page () { | |
global $post; | |
$posttype = get_post_type($post ); |
NewerOlder