Skip to content

Instantly share code, notes, and snippets.

/**
* Overwrite "Buy Ticket" text in wolf-tour-dates.php
*
* @param string $string
* @return string $string
*/
function overwrite_buy_ticket_text( $string ) {
return 'More Info';
}
add_filter( 'wolf_buy_ticket_text', 'overwrite_buy_ticket_text' );
@wolfthemes
wolfthemes / overwrite-photo-slug.php
Created October 5, 2017 11:00
Overwrite photo slug for photo themes using Wolf Photos plugin
/**
* Rewrite single attachment URL
*
* Replace "pic" by your slug
*/
function add_custom_photo_rewrite_rule() {
add_rewrite_rule(
'pic/([a-z0-9-_]+)/?', // ([^/]+)
'index.php?attachment=$matches[1]',
'top'
/*
* Re-add disabled element
* http://stackoverflow.com/questions/7225070/php-array-delete-by-value-not-key
*
* List of diabled elements:
* 'vc_section',
* 'vc_tour', // deprecated
* 'vc_btn', // deprecated
* 'vc_tta_accordion',
* 'vc_tta_tabs',
/**
* Add a social serveice to the team member element
*
* @param array $socials
* @return array $socials
*/
function add_team_member_social( $socials ) {
$socials[] = 'soundcloud';
/* Disable the menu automatically converting social links to icons */
add_filter( 'theme_social_links_icons', function( $icons ) {
return array();
} );
@wolfthemes
wolfthemes / rewrite-band-taxonomy-slug.php
Last active July 25, 2018 12:14
Rewrite band taxonomy slug
/**
* Rewrite band taxonomy slug
*/
function theme_change_band_taxonomies_slug( $args, $taxonomy ) {
if ( 'band' === $taxonomy ) {
$args['rewrite']['slug'] = 'artist-releases';
}
return $args;
}
add_filter( 'register_taxonomy_args', 'theme_change_band_taxonomies_slug', 10, 2 );
@wolfthemes
wolfthemes / filter-copyright-text.php
Last active December 11, 2017 19:37
Copy this function in your child theme functions.php file to overwrite the copyright text and allow HTML.
@wolfthemes
wolfthemes / add-wvc-social-networks.php
Created December 12, 2017 10:08
Add social network to Wolf WPBakery Page Builder extension
/**
* Add social networks
*/
function add_social_networks( $socials ) {
$socials[] = 'wechat';
$socials[] = 'weibo';
return $socials;
}
@wolfthemes
wolfthemes / overwrite-post-type-taxonomy-slug.php
Last active February 5, 2018 15:09
Overwrite custom post type taxonomy slug
<?php
/**
* Overwrite custom post type taxonomy slug
*
* @param array $args
* @param string $taxonomy
* @return array $args
*
*/
function overwrite_post_type_taxonomy_slug( $args, $taxonomy ) {
/**
* Disable menu icons
*/
function disable_menu_icons() {
remove_filter( 'walker_nav_menu_start_el', 'theme_nav_menu_social_icons' ); // replace "theme" by your theme slug (e.g "tune")
}
add_action( 'init', 'disable_menu_icons', 100 );