Skip to content

Instantly share code, notes, and snippets.

@jameskoster
jameskoster / functions.php
Last active August 31, 2021 14:18 — forked from mikejolley/functions.php
WooCommerce - Exclude products from a particular category on the shop page
add_action( 'pre_get_posts', 'custom_pre_get_posts_query' );
function custom_pre_get_posts_query( $q ) {
if ( ! $q->is_main_query() ) return;
if ( ! $q->is_post_type_archive() ) return;
if ( ! is_admin() && is_shop() ) {
$q->set( 'tax_query', array(array(
@ericrasch
ericrasch / is_child.php
Last active October 29, 2019 16:18
WordPress conditional function to check if a page is a parent/child/ancestor. In other words, if the page is within a tree of another page, show the code. Other code I've seen either only work with IDs, only check if it's a child, or detect all subpages (even outside of the direct tree).
/* =BEGIN: Check If Page Is Child
Source: http://bavotasan.com/2011/is_child-conditional-function-for-wordpress/
---------------------------------------------------------------------------------------------------- */
function is_child( $page_id_or_slug ) { // $page_id_or_slug = The ID of the page we're looking for pages underneath
global $post; // load details about this page
if ( !is_numeric( $page_id_or_slug ) ) { // Used this code to change a slug to an ID, but had to change is_int to is_numeric for it to work.
$page = get_page_by_path( $page_id_or_slug );
$page_id_or_slug = $page->ID;
}
@jesseeproductions
jesseeproductions / tec-conditionals
Last active October 13, 2023 14:22
The Events Calendar Conditionals
/*-----------------------------------------------------------------------------------*/
/* The Events Calendar - Conditional Logic to Detect Various Event Related Views/Pages
/*-----------------------------------------------------------------------------------*/
if ( tribe_is_month() && ! is_tax() ) { // Month View Page
echo 'were on the month view page';
} elseif ( tribe_is_month() && is_tax() ) { // Month View Category Page

Advanced JavaScript Learning Resources

This is a list of advanced JavaScript learning resources from people who responded to this [Tweet][13] and this [Tweet][20].

  • [You Don't Know JS][3]

  • [Frontend Masters courses by Kyle Simpson][12]

  • [@mpjme][6]'s [YouTube videos][5]

@mrwweb
mrwweb / readme.md
Last active September 27, 2024 22:29
The Events Calendar v2 Template Reset & Customizations - Now on Github