Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 );
/* Disable the menu automatically converting social links to icons */
add_filter( 'theme_social_links_icons', function( $icons ) {
return array();
} );
/**
* Add a social serveice to the team member element
*
* @param array $socials
* @return array $socials
*/
function add_team_member_social( $socials ) {
$socials[] = 'soundcloud';
/*
* 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',
@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'
/**
* 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' );
/**
* Overwrite single release buttons
*/
function overwrite_release_buttons( $html ) {
$meta = ( function_exists( 'wd_get_meta' ) ) ? wd_get_meta() : array();
$release_itunes = $meta['itunes'];
$release_google_play = $meta['google_play'];
$release_amazon = $meta['amazon'];
$release_buy = $meta['buy'];
/**
* Adjust the sticky menu scrollpoint
*
* @param int $int
* @return int
*/
function tune_overwrite_sticky_menu_scrollpoint( $int ) {
return 200; // replace by your scrollpoint value in pixels
}