Skip to content

Instantly share code, notes, and snippets.

Avatar

Matt Knighton mrkdevelopment

View GitHub Profile
@mrkdevelopment
mrkdevelopment / business-directory-post-type-arg-filter.php
Last active Apr 9, 2019
Business Directory Post Type Arg Filter
View business-directory-post-type-arg-filter.php
<?php
// Add this to your child theme's function.php file.
// Make sure you flush the rewrite rules.
// On wp cli you can 'wp rewrite flush'
// Or goto WordPress Admin > Settings > Permalink and save the settings which will flush the rules.
add_filter('business_directory_post_type_args', function($args){
$args['rewrite'] = [
'slug' => '/business-location',
];
return $args;
@mrkdevelopment
mrkdevelopment / functions.php
Created Aug 26, 2018
Breadcrumb Update for Yoast Breadcrumbs Path in Custom Post
View functions.php
add_filter( 'wpseo_breadcrumb_links', 'wpse_100012_override_yoast_breadcrumb_trail' );
function wpse_100012_override_yoast_breadcrumb_trail( $links ) {
global $post;
if (is_tax( 'df_product_category' )) {
$breadcrumb[] = array(
'url' => get_post_type_archive_link( 'df_wordpress_product' ),
'text' => 'Products',
@mrkdevelopment
mrkdevelopment / funtions.php
Created Aug 26, 2018
Learndash Yoast Breadcrumbs
View funtions.php
add_filter( 'wpseo_breadcrumb_links', 'wpse_100012_override_yoast_breadcrumb_trail' );
function wpse_100012_override_yoast_breadcrumb_trail( $links ) {
global $post;
if ( is_singular( 'sfwd-lessons' ) ) {
$course_id = learndash_get_course_id($id);
$course_title = get_the_title($course_id);
@mrkdevelopment
mrkdevelopment / shortcode
Created Aug 26, 2018
[\yoast-breadcrumb-df]
View shortcode
[yoast-breadcrumb-df][/yoast-breadcrumb-df]
@mrkdevelopment
mrkdevelopment / functions.php
Created Aug 6, 2018
remove divi cpt style action
View functions.php
/**
* Disable new divi crazy crap code for CPT
**/
function disable_cptdivi()
{
remove_action( 'wp_enqueue_scripts', 'et_divi_replace_stylesheet', 99999998 );
}
add_action('init', 'disable_cptdivi');
@mrkdevelopment
mrkdevelopment / divi_open_social_icons_new_tab.js
Created Aug 3, 2018
Open existing divi social icons in new tab
View divi_open_social_icons_new_tab.js
jQuery(document).ready(function(){
jQuery('.et-social-icon .icon').each(function(){
jQuery(this).attr('target', '_blank');
});
});
View update_social_icons.php
<?php
add_filter( 'df_update_social_icons', function($brands){
$brands['fa-amazon'] = 'Amazon';
return $brands;
});
@mrkdevelopment
mrkdevelopment / conf for prefetch
Created Jul 10, 2018
My values for my WP Rocket Prefetch Domains
View conf for prefetch
//fonts.googleapis.com
//fonts.gstatic.com
//www.googletagmanager.com
View valid-restaurant-menu-item.html
<div class="df-menu-item ">
<h5>
<span class="menu-title">Garlic King Prawns</span>
</h5>
<div class="right">$ 15.50</div>
<small>Five luscious plump King prawns sautéed in a creamy garlic sauce</small>
</div>
@mrkdevelopment
mrkdevelopment / invalid-restaurant-menu-item.html
Created Jun 1, 2018
Semantically invalid restaurant menu item
View invalid-restaurant-menu-item.html
<div class="df-menu-item ">
<h5>
<div class="left">
<span class="menu-title">Cheese &amp; Sausage Platter</span>
<small>Salami, summer sausage, deli ham rolls, cheddar cheese curds, cubed Parmesan &amp; asiago cheeses, Dusse/dorf mustard, assorted olives &amp; crackers</small>
</div>
<div class="right">$ 10.95</div>
</h5>
</div>