Skip to content

Instantly share code, notes, and snippets.

View danielmcclure's full-sized avatar

Daniel McClure danielmcclure

View GitHub Profile
@danielmcclure
danielmcclure / sf-pro-filter-input-object.php
Created February 6, 2024 23:01 — forked from rmorse/sf-pro-filter-input-object.php
Search & Filter Pro - Filter Input Object
<?php
function filter_input_object($input_object, $sfid)
{
//ensure we are only filtering the correct field name - in this case the field we want to filter has the name `_sfm_colours`
//we also want to make sure its a `select` input type we're filtering
if(($input_object['name']!='_sfm_colours')||($input_object['type']!='select'))
{
return $input_object;
}
@danielmcclure
danielmcclure / learndash-code-in-answer.php
Created July 13, 2020 03:45 — forked from tradesouthwest/learndash-code-in-answer.php
LearnDash cloze answer accept case sensitive
<?php
/**
* LearnDash filter to prevent converting answer values to lowercase
*
* @possibly use ld_adv_quiz_pro_ajax()
* @uses stripslashes( strtolower( trim( $userResponse ) ) ) Default
* @since 1.0
* @from WpProQuiz_View_FrontQuiz.php
* post_type=sfwd-quiz
*/
@danielmcclure
danielmcclure / remove-custom-post-type-slug-from-permalinks.php
Last active May 23, 2020 02:03 — forked from kellenmace/remove-custom-post-type-slug-from-permalinks.php
Remove custom post type slug from permalinks in WordPress
<?php
// Safely Remove CPT slugs from your CPT permalinks.
// Note: Replace CPT_NAME with your CPT name.
/**
* Remove the slug from published post permalinks. Only affect our custom post type, though.
*/
function m3_remove_cpt_slug( $post_link, $post ) {
if ( 'CPT_NAME' === $post->post_type && 'publish' === $post->post_status ) {
/**
* Remove the "nofollow" attribute from all comments author's links
* except for a specific author.
*/
function dofollow_blog_author_comment( $return, $author ) {
if ( $author === 'Your Name' ) {
$return = str_replace( "rel='external nofollow ugc'", '', $return );
}
return $return;
<?php
$args = array(
'label' => '', // Text in Label
'class' => '',
'style' => '',
'wrapper_class' => '',
'value' => '', // if empty, retrieved from post meta where id is the meta_key
'id' => '', // required
'name' => '', //name will set from id if empty
@danielmcclure
danielmcclure / style.scss
Created May 22, 2019 02:39 — forked from seothemes/style.scss
Gravity Forms SCSS
/* ## Gravity Forms
--------------------------------------------- */
.gform_heading,
.gform_body,
.gform_footer {
clear: both;
}
.gform_heading {
// Remove WooCommerce Theme Support admin message
add_theme_support( 'woocommerce' );
@danielmcclure
danielmcclure / background-video.css
Created January 24, 2019 01:31 — forked from mwhiteley16/background-video.css
Background Video PHP
/* ---------- 6.1 Hero Video ---------- */
.home .page-header {
padding: 24rem 0 7rem;
height: 75vh;
overflow: hidden;
}
#bgvid {
position: absolute;
top: 0;
left: 0;
@danielmcclure
danielmcclure / functions.php
Created June 25, 2018 02:27 — forked from srikat/functions.php
Adding a cart icon with number of items and total cost in nav menu when using WooCommerce. http://sridharkatakam.com/adding-cart-icon-number-items-total-cost-nav-menu-using-woocommerce/
//* Make Font Awesome available
add_action( 'wp_enqueue_scripts', 'enqueue_font_awesome' );
function enqueue_font_awesome() {
wp_enqueue_style( 'font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css' );
}
/**
* Place a cart icon with number of items and total cost in the menu bar.
@danielmcclure
danielmcclure / wc-change-number-of-related-products.php
Created June 21, 2018 22:39 — forked from woogists/wc-change-number-of-related-products.php
[Theming Snippets] Change number of related products output