Skip to content

Instantly share code, notes, and snippets.

View jonahcoyote's full-sized avatar

Jonah C West jonahcoyote

View GitHub Profile
@djrmom
djrmom / custom-hooks.php
Last active April 9, 2020 15:07
facetwp add span to labels
<?php
/** adds a span to checkbox labels for styling **/
add_filter( 'facetwp_facet_html', function( $html, $args ) {
if ( 'checkboxes' == $args['facet']['type']) {
$pattern = '/<div class="facetwp-checkbox[^"]*" data-value="[^"]*">([^<]*) <span/';
preg_match_all( $pattern, $html, $matches );
@jesseeproductions
jesseeproductions / tribe-event-list-target-today.php
Created January 27, 2016 15:54
The Events Calendar - Target a Specific Event List Widget to Only Show Todays Events
/**
* The Events Calendar - Target a Specific Event List Widget to Only Show Todays Events
*
* modify tribe-events-adv-list-widget-2 to id of widget
*/
function tribe_modify_list_widget_args_for_today( $args ) {
$start_date_init = date ( 'Y-m-d' );
$start_date_end = $start_date_init . ' 23:59:59';
@CoachBirgit
CoachBirgit / divi-lightbox-snippet-for-functions.php
Last active January 19, 2022 06:33
DIVI: add lightbox to regular content images
/* --- DEPRECATED --- */
/* add .et_pb_lightbox_image clss to content images */
add_filter('the_content', 'divi_add_lightbox');
function divi_add_lightbox($content) {
global $post;
$pattern ="/<a(.*?)href=('|\")(.*?).(bmp|gif|jpeg|jpg|png)('|\")(.*?)>/i";
$replacement = '<a$1href=$2$3.$4$5 class="et_pb_lightbox_image" title="'.$post->post_title.'"$6>';
$content = preg_replace($pattern, $replacement, $content);
return $content;
}
@gfscott
gfscott / wordpress-embed-soundcloud-mini-player.php
Last active February 14, 2023 14:21
Wordpress function to switch auto-embed Soundcloud player from large "visual" version to "mini"
<?php
/////////////////////////////////////////////////////////////////////////////////////
// Ask Wordpress to Embed Soundcloud’s Mini Player Instead of the Large Visual Player
/////////////////////////////////////////////////////////////////////////////////////
// Add function to theme’s functions.php file
// Relevant documentation:
// https://wordpress.org/support/topic/hookfilter-for-auto-embed-function-of-wp
// https://wordpress.org/support/topic/filter-hook-for-built-in-oembed-providers-eg-youtube
// https://developers.soundcloud.com/docs/oembed
@bekarice
bekarice / edit-woocommerce-checkout-template.php
Last active March 27, 2023 23:12
Add content and notices to the WooCommerce checkout - sample code
/**
* Each of these samples can be used - note that you should pick one rather than add them all.
*
* How to use WC notices: https://github.com/woothemes/woocommerce/blob/master/includes/wc-notice-functions.php#L96
* Tutorial: http://www.skyverge.com/blog/edit-woocommerce-templates/
**/
/**
* Add a content block after all notices, such as the login and coupon notices.
*
@supercleanse
supercleanse / mp_custom_account_nav.php
Created January 28, 2014 03:30
Add custom tabs to the MemberPress Account Page
<?php
add_action('mepr_account_nav', 'custom_account_nav', 10, 1);
function custom_account_nav($user) {
$mepr_options = MeprOptions::fetch();
$whaa_url = $mepr_options->account_page_url('action=whaa');
?>
<span class="mepr-nav-item custom-whaa">
<a href="<?php echo $whaa_url; ?>" id="mepr-account-whaa"><?php _e('Whaa', 'memberpress'); ?></a>
</span>
@robinnorth
robinnorth / wordpress_export-post-data.php
Created April 26, 2013 11:44
WordPress: Simple, configurable script to export post data to a CSV file
<?php
/**
* Export WordPress post data to CSV
* Based on <http://stackoverflow.com/a/3474698> and <http://ran.ge/2009/10/27/howto-create-stream-csv-php/>
*/
/**
*********************************************************************
* Configuration
*********************************************************************
@jonahcoyote
jonahcoyote / add-date-to-rss-feed.php
Last active December 14, 2015 04:49
The Events Calendar - Add Event Date to RSS Feed
<?php
// Add Tribe Event Namespace
add_filter( 'rss2_ns', 'events_rss2_namespace' );
function events_rss2_namespace() {
echo 'xmlns:ev="http://purl.org/rss/2.0/modules/event/"';
}
// Add Event Date to RSS Feeds
add_action('rss_item','tribe_rss_feed_add_eventdate');
@skoskie
skoskie / acf-metabox-hack.html
Last active January 12, 2019 19:42
This is a temporary work-around for the Advanced Custom Fields Wordpress plugin's lack of support for blank meta boxes. A feature request for this capability was made on the plugin's Github page: https://github.com/elliotcondon/acf/issues/19. #wordpress #acf
<p>Here you may add a new row for every new question and answer set you wish to display.</p>
<div class="postbox">
<h3>Tips</h3>
<div class="inside">
<ul style="list-style-type:disc; list-style-position:inside; margin-left:30px;">
<li>Hover your cursor over the <span id="highlight-left-margin" style="text-decoration:underline; font-weight:bold; cursor:pointer;">left margin</span> and click to drag our FAQ items into a different order.</li>
<li>Hover over the <span id="highlight-right-margin" style="text-decoration:underline; font-weight:bold; cursor:pointer;">right margin</span> and click on the <i>plus<i> to add a new FAQ item. Click on the <i>minus</i> to delete an tem.</li>
<li>Some fields allow you to use basic <abbr title="Hypertext Markup anguage." style="border-bottom:1px dotted;">HTML</abbr> tags, like &lt;b&gt;<b>bold</b>&lt;/b&gt; and &lt;i&gt;<i>italic</i>&lt;/i&gt;.</i>
</ul>
</div>
@simonlk
simonlk / Woocommerce - output product variations in tab
Last active February 21, 2022 20:27
Output Woocommerce product variations as a table within a tab on the single product page
// Add to functions.php
/*===================================================
Created by sk from Renegade Empire with help
from these sources:
http://docs.woothemes.com/document/editing-product-data-tabs/
http://www.sean-barton.co.uk/2013/03/remove-woocommerce-20-reviews-tab/#.UYnWe7XfB6N
http://www.sean-barton.co.uk/2013/03/sb-add-woocommerce-tabs-wordpress-plugin/#.UYrYL7XfB6M