View functions.php
<?php | |
// This is useful for when you would like to get the event ID but only have the product object in WooCommerce. | |
// For example, you would like to get the event ID from an order line item. | |
$product_id = $product->get_id(); | |
$ticket_meta = get_post_meta( $product_id ); | |
$event_id = absint( $ticket_meta['_tribe_wooticket_for_event'][0] ); |
View wp directory gitignore
# This is a template .gitignore file for git-managed WordPress projects. | |
# | |
# Fact: you don't want WordPress core files, or your server-specific | |
# configuration files etc., in your project's repository. You just don't. | |
# | |
# Solution: stick this file up your repository root (which it assumes is | |
# also the WordPress root directory) and add exceptions for any plugins, | |
# themes, and other directories that should be under version control. | |
# | |
# See the comments below for more info on how to add exceptions for your |
View section-custom_post_type.php
<?php | |
// setup query | |
$args = array( | |
'post_type' => 'custom_post_type', | |
'post_status' => 'publish', | |
'orderby' => 'date', | |
'posts_per_page' => 10, | |
'no_found_rows' => true, | |
'update_post_meta_cache' => false, | |
'update_post_term_cache' => false, |
View woocommerce.php
<?php | |
/* | |
* Set Modern Tribe Event Tickets Plus custom SKU as: | |
* Title - StartDate | |
* @link https://smnr.co/2NqELpA | |
*/ | |
add_action( 'event_tickets_after_save_ticket', 'tribe_events_set_sku', 10, 4 ); | |
function tribe_events_set_sku( $event_id, $ticket, $raw_data, $classname ) { | |
if ( ! empty( $ticket ) && isset( $ticket->ID ) ) { |
View functions.php
<?php | |
/** | |
* Remove Woocommerce "The following addresses will be used on the checkout page by default." from My Account page | |
* @link https://smnr.co/woocommerce-remove-my-account-address-description | |
*/ | |
add_filter( 'woocommerce_my_account_my_address_description', '' ); |
View Add the Logo Using the WordPress Customiser (Better part 2).php
<header> | |
<?php | |
$custom_logo = wp_get_attachment_image_src( get_theme_mod( 'custom_logo' ), 'full' ); | |
?> | |
<img src="<?php echo $custom_logo[0]; ?>" alt="<?php bloginfo('name'); ?>" width="<?php echo $custom_logo[1]; ?>" height="<?php echo $custom_logo[2]; ?>"> | |
</header> |
View Add the Logo Using the WordPress Customiser (Better part 1).php
<?php | |
function my_theme_setup() { | |
/** | |
* Add support for core custom logo. | |
* | |
* @link https://codex.wordpress.org/Theme_Logo | |
*/ | |
add_theme_support( 'custom-logo', array( | |
'height' => 190, |
View Add the Logo Using the WordPress Customiser.php
<header> | |
<?php | |
$custom_logo = wp_get_attachment_image_src( get_theme_mod( 'custom_logo' ), 'full' ); | |
?> | |
<img src="<?php echo $custom_logo[0]; ?>" alt="<?php bloginfo('name'); ?>" width="128" height="19"> | |
</header> |
View Add the Logo as an Inlined SVG (better).php
<header> | |
<svg class="site-logo" xmlns="http://www.w3.org/2000/svg" viewBox="..."> | |
<path fill="#1D1D1B" d="..."/> | |
<path fill="#1D1D1B" d="..."/> | |
</svg> | |
</header> |
View Add the Logo as an Inlined SVG.php
<header> | |
<div class="site-logo"> | |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="..."> | |
<path fill="#1D1D1B" d="..."/> | |
<path fill="#1D1D1B" d="..."/> | |
</svg> | |
</div> | |
</header> |
NewerOlder