Skip to content

Instantly share code, notes, and snippets.

View mrkdevelopment's full-sized avatar

Matt Knighton mrkdevelopment

View GitHub Profile
@mrkdevelopment
mrkdevelopment / functions.php
Created June 16, 2023 06:37
Remove core theme support
if ( ! function_exists( 'custom_setup' ) ) {
function custom_setup() {
// Remove core block patterns.
remove_theme_support( 'core-block-patterns' );
}
}
add_action( 'after_setup_theme', 'custom_setup' );
@mrkdevelopment
mrkdevelopment / yoast.css
Created June 15, 2023 15:15
Yoast table of Contents Styling for Kadence Blocks
.yoast-table-of-contents{
--border: 2px solid var(--global-palette1);
padding: 1rem;
background: var(--global-palette7);
border: var(--border);
box-shadow: var(--box-shadow);
border-radius: 1rem;
}
.yoast-table-of-contents ul{
padding-inline-start: 0.2em;
@mrkdevelopment
mrkdevelopment / fix.css
Last active June 6, 2023 00:52
G Translate padding fix for header
[data-id="_BZXXz"] div.gtranslate_wrapper{
position: absolute;
top: 12px;
}
[data-id="_BZXXz"] div.entry-content{
max-height: 20px;
display: block;
}
@mrkdevelopment
mrkdevelopment / functions.php
Last active July 18, 2023 01:34
Snippet to Edit a breadcrumb path inside Yoast SEO
<?php
add_filter( 'wpseo_breadcrumb_links', 'fix_care_plan_bc_path' );
/**
* Custom breadcrumb paths using Yoast SEO to fix care plan breadcrumb paths.
*
* @param [array] $links default param.
* @return [array] $links edited links path.
*/
@mrkdevelopment
mrkdevelopment / archive.css
Last active November 28, 2022 04:33
The events calendar paste gist - blocksy theme - archive page
<style>
body{
--content-vertical-spacing: 0px;
}
.tribe-events-calendar-latest-past__event-date-tag-year,
.tribe-events-calendar-latest-past__event-date-tag-month {
background: var(--buttonInitialColor) !important;
color: #ffffff !important;
font-weight: bold !important;
}
@mrkdevelopment
mrkdevelopment / functions.php
Created July 29, 2022 06:36
Display WooCommerce data for Attributes in the meta area of template
add_action('woocommerce_product_meta_start',function(){
global $product;
echo wc_display_product_attributes( $product );
});
<div id="gform_123_vars">.
<script type="module"
data-xq-forms="gfrom_123"//ID
data-xq-enc="html"
data-xq-format="raw"
data-xq-action="https://our.server.coml/t/form/encryptedmail"
data-xq-api="9-4e10b813ecc8-a9a316bc-d5694ec-a9ecd26c77c6"
data-xq-success="callbackfunction()">
</script>
<script>
@mrkdevelopment
mrkdevelopment / functions.php
Last active September 30, 2021 14:10
How to save a thumbnail ID and make sure the attached Post ID is referenced in Media Library
<?php
add_action('save_post', 'relate_post_to_thumb');
function relate_post_to_thumb($post_id) {
//does this post have a URL / thumbnail
$thumb_id = get_post_thumbnail_id($post_id);
//if thumb found relate to post
if($thumb_id){
@mrkdevelopment
mrkdevelopment / filter.php
Created September 30, 2021 06:22
Get the post array and data on wp insert post data.
add_filter( 'wp_insert_post_data' , 'filter_post_data' , '99', 2 );
function filter_post_data( $data , $postarr ) {
// Change post title
print_r($data);
print_r($postarr);
die();
}
@mrkdevelopment
mrkdevelopment / blocsky-single.php
Created June 22, 2021 07:09
Use this as a basis for a single blocksy template part in child theme
<?php
/*
* The template for displaying all single posts
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
*
* @package Blocksy
*/
if (have_posts()) {