View acf_get_directions.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$location = get_field('map_location'); | |
if ( !empty( $location ) ) : | |
$map_url = 'https://www.google.com/maps/dir/?api=1&destination=' . $location['lat'] . ',' . $location['lng']; | |
echo '<a href=". esc_url( $map_url ) . '" rel="nooopener">Get directions</a>'; | |
endif; | |
?> | |
<p>This should produce a link like this:</p> | |
<a href="https://www.google.com/maps/dir/?api=1&destination=51.072159,1.088130">Get directions</a> |
View licence activation.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Place this in wp-config | |
define( 'ACF_5_KEY', 'yourkeyhere' ); | |
// Set ACF 5 license key on theme activation. Stick in your functions.php or equivalent. | |
function auto_set_license_keys() { | |
if ( ! get_option( 'acf_pro_license' ) && defined( 'ACF_5_KEY' ) ) { | |
$save = array( | |
'key' => ACF_5_KEY, |
View generatepress_polylang_404.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Translate the GeneratePress 404 page title | |
* | |
* The string can be translated in Languages -> Strings translations | |
*/ | |
if ( function_exists( 'pll_register_string' ) ) { | |
function mattrad_404_text() { | |
$error_text = 'That page cannot be found'; | |
pll_register_string( '404', $error_text , 'text_domain'); | |
return pll__( $error_text ); |
View generatepress_polylang_logo.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Set GeneratePress site logo based on Polylang current language | |
* | |
* This example function allows for the default logo to be set by the English choice, and supports | |
* Polish, Dutch and German language-specific logos | |
*/ | |
if ( ! function_exists( 'generate_construct_logo' ) || ! function_exists( 'pll_current_language' ) ) { | |
// Change logo depending on the language | |
// An improvemnt to this would be to not set the array of logos, but check for a logo/language match | |
function mattrad_default_logo( $url ) { |
View generatepress_polylang_switcher.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Add Polylang language switcher before GeneratePress navigation | |
* | |
* @link https://polylang.pro/doc/function-reference/ | |
*/ | |
if ( ! function_exists( 'generate_navigation_position' ) || ! function_exists( 'pll_the_languages' )) { | |
function mattrad_add_switcher() { | |
pll_the_languages([ | |
'dropdown' => 1, | |
'hide_if_empty' => 1, |
View facetwp_load_more_and_all.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Adapted from https://gist.github.com/mgibbs189/f2469009a7039159e229efe5a01dab23 | |
function fwp_load_more() { | |
?> | |
<script> | |
(function($) { | |
$(function() { | |
if ('object' != typeof FWP) { | |
return; | |
} |
View yoast-primary-and-secondary.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Post Categories | |
* | |
* Get Primary term, if set, and other terms for a post (with Primary Term excluded) | |
* | |
* @category Theme | |
* @package MattRadford/mattradford | |
* @author Matt Radford <matt@mattrad.uk> |
View promoteCategories.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action('admin_menu', [$this, 'promoteCategories']); | |
/** | |
* Promote Categories to a top-level menu item | |
* | |
* @return void | |
*/ | |
public function promoteCategories() | |
{ | |
remove_submenu_page('edit.php', 'edit-tags.php?taxonomy=category'); |
View product_category_template.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function tend_product_listing( $original_template ) { | |
if ( is_tax( 'product_cat' ) ) { | |
$term = get_queried_object(); | |
$children = get_terms( $term->taxonomy, array( | |
'parent' => $term->term_id, | |
'hide_empty' => false, | |
) ); | |
if ( ! $children ) { | |
return wc_get_template_part( 'archive-product-listing' ); | |
} else { |
NewerOlder