Skip to content

Instantly share code, notes, and snippets.

Chris Cook cccamuseme

View GitHub Profile
@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 / specific-cat-loop-wordpres.php
Last active Jul 11, 2018
WordPress - Show specific post category
View specific-cat-loop-wordpres.php
<?php query_posts('cat=5'); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php the_content(); ?>
<?php endwhile; endif; ?>
<?php wp_reset_query(); ?>
View dynamic-sidebar.php
/* Place where you want in your theme */
<?php dynamic_sidebar( 'new_sidebar' ); ?>
View custom-widget-area.php
/* New Sidebar */
function new_sidebar_widget_init() {
register_sidebar( array(
'name' => 'New Sidebar',
'id' => 'new_sidebar',
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => '',
) );
@cccamuseme
cccamuseme / homepage_posts.php
Created May 19, 2017
Change color of title based on category
View homepage_posts.php
<?php
// The Query
$the_query = new WP_Query( array( 'cat' => '3,4', 'posts_per_page' => 4 ) );
// The Loop
if ( $the_query->have_posts() ) {
while ( $the_query->have_posts() ) {
$the_query->the_post();
echo '<h4><a href="' . get_permalink($recent["ID"]) . '">' . get_the_title() . '</a></h4>';
You can’t perform that action at this time.