Skip to content

Instantly share code, notes, and snippets.

Avatar

Shelley Denise girlie

  • GirlieWorks, LLC
View GitHub Profile
@glueckpress
glueckpress / wp-rocket-custom.php
Created Dec 31, 2015
[WordPress][WP Rocket] Boilerplate for a custom functionality (MU) plugin.
View wp-rocket-custom.php
<?php
/**
* Plugin Name: Your Custom Functionality Plugin
* Description: Short description of your plugin here.
* Author: your name here
* License: GNU General Public License v3 or later
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
*/
// Basic security, prevents file from being loaded directly.
@justintadlock
justintadlock / register-post-type.php
Last active Nov 12, 2020
Help file when registering post types.
View register-post-type.php
<?php
# Register custom post types on the 'init' hook.
add_action( 'init', 'my_register_post_types' );
/**
* Registers post types needed by the plugin.
*
* @since 1.0.0
* @access public
@georgybu
georgybu / content-single-product.php
Created Dec 14, 2012
WooCommerce - Show next\prev products from current product category (when viewing a single product) 1. If product is last -> Next product is first 2. If product is first -> Prev product is last forked from https://gist.github.com/2176823 (This question was in http://stackoverflow.com/questions/13597687/woocommerce-get-next-previous-product/13612387
View content-single-product.php
<?php
// get next and prev products
// Author: Georgy Bunin (bunin.co.il@gmail.com)
// forked from https://gist.github.com/2176823
function ShowLinkToProduct($post_id, $categories_as_array, $label) {
// get post according post id
$query_args = array( 'post__in' => array($post_id), 'posts_per_page' => 1, 'post_status' => 'publish', 'post_type' => 'product', 'tax_query' => array(
array(
'taxonomy' => 'product_cat',
@kasparsd
kasparsd / custom-post-taxonomy-permalinks.php
Created Jun 13, 2012
Create permalink structure URLs for custom post types that include all parent terms from a custom taxonomy
View custom-post-taxonomy-permalinks.php
<?php
/*
Term Archive Pages:
- http://example.com/recipes/dinner/
- http://example.com/recipes/breakfast,brunch/
Single Recipe Pages:
- http://example.com/recipes/dinner/soup-title/
@joshuadavidnelson
joshuadavidnelson / basic-dropdown-usage.php
Last active Sep 2, 2020
Filter wp_dropdown_categories by post type.
View basic-dropdown-usage.php
<?php
/**
* Using wp_dropdown_categories with the post type filter applied.
*
* @link https://joshuadnelson.com/category-taxonomy-dropdown-filtered-by-post-type/
*/
// Taxonomy dropdown arguments
$args = array(
'taxonomy' => 'department',
@jcobb
jcobb / gist:2993853
Created Jun 26, 2012
Combine multiple WordPress queries
View gist:2993853
<?php
// An example of creating two separate WP queries, combining the results,
// sorting by date and formatting the results for us in a loop like a regular query.
// order the posts by date in descending order (should go in functions.php to keep things tidy)
function order_by_date( $a, $b )
{
return strcmp( $b->post_date, $a->post_date );
}
@cdils
cdils / change-style-load-order.php
Last active Mar 20, 2020
Change order of where Genesis child theme stylesheet is loaded on theme initialization.
View change-style-load-order.php
<?php //Remove this line
/**
* Remove Genesis child theme style sheet
* @uses genesis_meta <genesis/lib/css/load-styles.php>
*/
remove_action( 'genesis_meta', 'genesis_load_stylesheet' );
/**
* Enqueue Genesis child theme style sheet at higher priority
@jacksonfdam
jacksonfdam / gist:3000405
Created Jun 27, 2012
Master Stylesheet
View gist:3000405
/*
URL: http://www.crucialwebhost.com/blog/master-stylesheet-the-most-useful-css-technique/
One of the most common mistakes I see beginners and intermediates fall victim to when it comes to CSS is not removing the default browser styling. This leads to inconsistencies in the appearance of your design across browsers, and ultimately leaves a lot of designers blaming the browser. It is a misplaced blame, of course. Before you do anything else when coding a website, you should reset the styling.
*/
/***** Global Settings *****/
html, body {
@bgardner
bgardner / functions.php
Last active Oct 19, 2019
Load a custom style sheet on your site using the Genesis Framework.
View functions.php
<?php
//* Do NOT include the opening php tag
//* Load custom style sheet
add_action( 'wp_enqueue_scripts', 'custom_load_custom_style_sheet' );
function custom_load_custom_style_sheet() {
wp_enqueue_style( 'custom-stylesheet', CHILD_URL . '/custom.css', array(), PARENT_THEME_VERSION );
}
//* Replace default style sheet
@paaljoachim
paaljoachim / genesis-featured-image.php
Last active Sep 12, 2019
Featured image for Genesis themes. 1. Sets the featured image. 2. If no featured image get image from category. 3. If no category image then get the first post image. 4. If no post image or category image then sets a fallback image.
View genesis-featured-image.php
You can’t perform that action at this time.