Skip to content

Instantly share code, notes, and snippets.

Chris Cook cccamuseme

Block or report user

Report or block cccamuseme

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@cccamuseme
cccamuseme / custom_shortcode.php
Last active Oct 8, 2019
Create a custom WordPress shortcode that gets a file
View custom_shortcode.php
function my_custom_shortcode() {
ob_start();
get_template_part('custom_shortcode'); // get file custom_shortcode.php in your theme
return ob_get_clean();
}
add_shortcode( 'my_custom_shortcode', 'my_custom_shortcode' );
// shortcode to use [my_custom_shortcode]
@cccamuseme
cccamuseme / wc_redirect.php
Created Aug 22, 2019
woocommerce checkout redirect
View wc_redirect.php
add_action( 'template_redirect', 'woo_custom_redirect_after_purchase' );
function woo_custom_redirect_after_purchase() {
global $wp;
if ( is_checkout() && !empty( $wp->query_vars['order-received'] ) ) {
wp_redirect( 'https://escatech.us/new-order-thankyou/' );
exit;
}
}
@cccamuseme
cccamuseme / enable_payment_method_from_user_profile_acf.php
Last active Jun 20, 2019
Enable or disable woocommerce payment gateway by ACF radio buttons in user profile.
View enable_payment_method_from_user_profile_acf.php
<?php
/*
* Enable COD for account holder
*/
function enable_cod_payment( $available_gateways ) {
global $woocommerce;
$user = wp_get_current_user();
$user_status = get_field('account_holder', $user );
@cccamuseme
cccamuseme / shipping_options.js
Last active Oct 1, 2018
Woocommerce shipping dropdown options. additional fields .show .hide based on selection.
View shipping_options.js
jQuery(function ($) {
$("#additional_Shipping_Method").change(function() {
var val = $(this).val();
if (val === "third-party") {
$("#additional_Carrier_Name_field").show();
$("#additional_Carrier_Account_Number_field").show();
}
else if (val === "collect") {
$("#additional_Carrier_Name_field").show();
@cccamuseme
cccamuseme / woocommerce_cart_links_login_logout.php
Last active Jul 11, 2018
Woocommerce links for login, logout, email as account link, and cart links showing quantity and total.
View woocommerce_cart_links_login_logout.php
@cccamuseme
cccamuseme / cpt-wp-query.php
Created May 21, 2018
Custom Post Type Query
View cpt-wp-query.php
<?php
$slider = new WP_Query(array( 'post_type' => 'project' ) );
if( $slider->have_posts() ) :
while($slider->have_posts()) :
$slider->the_post();
?>
<style type="text/css">
.project-box {
background-image: url('<?php the_field('featured_image') ?>');
@cccamuseme
cccamuseme / acf-slick-carousel-content-slider.php
Last active Jul 11, 2018
WordPress Advanced Custom Fields content slider
View acf-slick-carousel-content-slider.php
@cccamuseme
cccamuseme / wordpress-featured-img-bg-fallback-img.php
Last active Mar 8, 2018
WordPress featured image as background with fallback image
View wordpress-featured-img-bg-fallback-img.php
@cccamuseme
cccamuseme / dynamic-sidebar.php
Last active Jun 20, 2019
Call dynamic sidebar
View dynamic-sidebar.php
<?php
/* Place where you want in your theme */
<?php dynamic_sidebar( 'new_sidebar' ); ?>
?>
You can’t perform that action at this time.