Skip to content

Instantly share code, notes, and snippets.

View carasmo's full-sized avatar

Christina carasmo

  • Florida
View GitHub Profile
@carasmo
carasmo / replace-woocommerce-lightbox-with-lightgallery.php
Last active December 16, 2023 23:15
Replace PhotoSwipe Lightbox in WooCommerce with your own, as long as your own is LightGallery (https://github.com/sachinchoolur/lightGallery). Assumes that you've registered your js. Pardon the formatting, it got weird on me.
<?php
//don't add again
// assumes that you have registered your js for the new lightbox and that you understand what a handle is.
// Gallery Support
add_theme_support( 'wc-product-gallery-zoom' );
add_theme_support( 'wc-product-gallery-slider' );
@carasmo
carasmo / dequeue-woocommerce-js-css-on-non-woo-pages.php
Last active February 15, 2024 12:20
Dequeue WooCommerce CSS and JS on non-WooCommerce pages for 3.6.4
<?php
//don't add above twice if it already exists
/**
* Check if WooCommerce Page of all kinds (not just cart and shop)
* @thanks: https://faish.al/2014/01/06/check-if-it-is-woocommerce-page/
* Checked IDS with WooCommerce Repo 1 June 2019
*/
function ca_is_really_woocommerce_page() {
@carasmo
carasmo / remove-genesis-plugin-submenu.php
Created May 11, 2019 15:07
Remove Genesis Plugin Submenu Menu from admin
<?php
//don't add this
add_action( 'admin_menu', 'christina_remove_genesis_plugins_admin_page', 99 );
//remove genesis-plugin sub menu
function christina_remove_genesis_plugins_admin_page() {
remove_submenu_page( 'genesis', 'genesis-plugins' );
}
@carasmo
carasmo / random-hero-image.css
Last active September 29, 2019 17:19
TThis has two sets of code. The first is the CSS is which is an example only. The next file is the random image php from a directory for Genesis (modifiable for any WordPress theme). Adjust as needed for your requirements. If this saved you time, and I'm sure it did, consider a donation via PayPal to me@christinacreativedesign.com
.my-hero-container {
position: relative;
height: 20vh;
min-height: 150px;
}
@media (min-width: 800px) {
.my-hero-container {
height: 45vh;
min-height: 250px;
@carasmo
carasmo / un-register-widgets.php
Created January 29, 2018 18:55
Un-register widgets and clean up the widgets page.
<?php
//Don't re-add the php tag
/*
* Comment out the ones you want to keep. You will need some, but not all, for each project.
* Also, if you un-register then you can't use the_widget();
*/
add_action( 'widgets_init', 'cab_unregister_widgets', 10 );
/**
@carasmo
carasmo / for-include-or-functions.php
Created January 29, 2018 18:08
Add Custom Post Type and Taxonomy Terms to wp_link_query. Link search function in WordPress editor add Custom Post Types and Taxonomy Terms
<?php
//don't re add the php tag above
add_filter('wp_link_query', 'cab_add_custom_post_type_archive_link', 10, 2);
/**
* Add Custom Post Type archive to WordPress search link query
* Author: https://github.com/mthchz/editor-archive-post-link/blob/master/editor-archive-post-link.php
*/
function cab_add_custom_post_type_archive_link( $results, $query ) {
@carasmo
carasmo / remove-google-fonts-add-default-fonts-beaver-builder.php
Last active April 17, 2019 17:18
How to add only the theme font choices and remove the Google fonts from Beaver Builder. See the image in the comment.
<?php
//don't add again
// Save Time? Consider a donation via PayPal @ me@christinacreativedesign.com
add_action( 'wp_head', 'childprefix_beaver_builder_modifications', 0 );
/*
* Beaver Builder Builder Enabled Modifications
@carasmo
carasmo / remove-beaver-builder-from-admin-woocommerce.php
Last active January 5, 2018 23:32
Remove Beaver Builder link and tab in Admin for WooCommerce pages
<?php
//* DON'T ADD ABOVE
/*
*
* READ ME:
* I'm using Beaver Builder for page post types and I don't want that option on
* WooCommerce store, cart, checkout, and my account pages. I don't want the client to ask why she can't change
@carasmo
carasmo / html-no-js-device-class.php
Created December 27, 2017 22:13
In Genesis add a no-js to the html tag and a touch-device or desktop-device class depending on server side detection. See comments under the gist.
<?php
///DO NOT copy above
remove_action( 'genesis_doctype', 'genesis_do_doctype' );
add_action( 'genesis_doctype', 'childthemeprefix_html5_no_js_device_doctype' );
/**
* Add Doc Type no-js default
* reference: http://alxmedia.se/code/2013/11/using-a-no-js-class-in-your-wordpress-theme/
@carasmo
carasmo / category-nice-name-body-class.php
Last active December 21, 2017 18:21
add to your functions.php or an included php file in your theme like helper functions or general
<?php
//IMPORTANT: don't add above
add_filter( 'body_class', 'yourprefix_category_slug_body_class_single' );
/**
* Add category body class to single posts any post type
*/
function yourprefix_category_slug_body_class_single( $classes ) {
if ( is_single() ) :