Skip to content

Instantly share code, notes, and snippets.

View carasmo's full-sized avatar

Christina carasmo

  • Florida
View GitHub Profile
@carasmo
carasmo / dequeue-woocommerce-js-css-on-non-woo-pages.php
Last active November 26, 2024 15:58
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 / numbered-comment-pagination-genesis.php
Last active September 9, 2024 08:59
Numbered Comment Pagination in Genesis
<?php
//don't add again
add_action( 'genesis_comments', 'your_prefix_paginate_comments', 15 );
/**
* Paginate Comment Navigation
*/
function your_prefix_paginate_comments() {
@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 / 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 / for-functions.php
Last active June 6, 2023 18:22
Force the read more link on excerpts even if the content is below the threshold and even if it's a custom excerpt.
<?php
//don't include this
/** ====================================================================================
* Force read more link to all excerpts whether or not it meets the word length criteria
* and whether or not it is a custom excerpt
==================================================================================== **/
function excerpt_more_link_all_the_time() {
@carasmo
carasmo / remove-superfish-from-either-menu.php
Last active August 29, 2022 22:47
filter the Genesis navigation classes to remove super fish from either menu.
<?php
// don't include the php tag
// this goes in your functions.php file in your child theme. Use a code editor and FTP,
// do not edit php files with the editor in the backend of WordPress.
// Use developer tools if you do developer work.
/** ====================================================================================
@carasmo
carasmo / example-cmb2-repeatable-group.txt
Last active June 21, 2022 01:42
example CMB2 repeatable group
/** ====================================================================================
* Functions file
==================================================================================== **/
function yourthemeprefix_yourcpt_metabox_register() {
$prefix = '_cmb_';
@carasmo
carasmo / check-woo-commerce-version.php
Created January 27, 2017 21:56
Check WooCommerce version using version_compare( WC_VERSION ...
<?php
//don't add this above
//change the hook and the function name
function yourprefix_woocommerce_function_does_what() {
if ( ! class_exists( 'WooCommerce' ) ) return;
@carasmo
carasmo / unregister-widgets.php
Last active March 24, 2021 13:36
Unregister WordPress, Genesis, and WooCommerce widgets Raw
<?php
//Don't copy above.
add_action('widgets_init', 'cabeymer_unregister_widgets', 10);
/**
* Unregister Various Widgets
* Clean up your widgets.php page
* Single comment out the ones you want to keep
*/
@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;