Skip to content

Instantly share code, notes, and snippets.

Avatar

Matt Knighton mrkdevelopment

View GitHub Profile
@mrkdevelopment
mrkdevelopment / functions.php
Created Jul 29, 2022
Display WooCommerce data for Attributes in the meta area of template
View functions.php
add_action('woocommerce_product_meta_start',function(){
global $product;
echo wc_display_product_attributes( $product );
});
View gist:e9f0a048b707839fb927325b87755ebf
<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 Sep 30, 2021
How to save a thumbnail ID and make sure the attached Post ID is referenced in Media Library
View functions.php
<?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 Sep 30, 2021
Get the post array and data on wp insert post data.
View filter.php
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 Jun 22, 2021
Use this as a basis for a single blocksy template part in child theme
View blocsky-single.php
<?php
/*
* The template for displaying all single posts
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
*
* @package Blocksy
*/
if (have_posts()) {
@mrkdevelopment
mrkdevelopment / footer.css
Created Apr 6, 2021
color the description field on a gravity form
View footer.css
@mrkdevelopment
mrkdevelopment / Filter
Created Oct 25, 2020
Hook to stop Divi Check in Gravity Forms Styler for Divi Plugin
View Filter
function setNoDiviCheck(){
return false;
}
add_filter( 'mrkwp_gfwp_test_divi', 'setNoDiviCheck' );
@mrkdevelopment
mrkdevelopment / css
Created Aug 5, 2020
Style your paceholder
View css
::placeholder {
color: red;
}
View css snippet
.ez-toc-list-level-5{
display:none;
}
@mrkdevelopment
mrkdevelopment / css-notifiy-bar
Last active Jul 3, 2021
Alert Bar with Icon
View css-notifiy-bar
<style>
#notify-bar .alert-wrapper{
padding:5px;
}
#notify-bar .icon-wrap{
height: 25px;
display: inline-flex;
width: 20px;
margin: 5px 20px 0 0;
}