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 | |
// The issue: | |
// You want to use WP Bakery for your WooCommerce shop page. | |
// You can enable WP Bakery for that page, but custom Design Options are not showing. | |
// The explanation: | |
// WP Bakery keeps those custom design changes as a CSS string, stored as post meta on the page you are using for your shop page. | |
// Unfortunately that CSS is not being output by your theme, hence your custom design changes are not working. |
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 | |
/* | |
Plugin Name: WP All Import - Redirection AddOn | |
Description: Add a redirect for each post imported. | |
*/ | |
// If this file is called directly, abort. | |
if ( ! defined( 'WPINC' ) ) { | |
die; | |
} |
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 | |
// Auto fill Title and Slug for 'companies' CPT | |
function acf_title_companies( $value, $post_id, $field ) { | |
if ( get_post_type( $post_id ) == 'companies' ) { | |
$new_title = get_field( 'company_name', $post_id ) . ' ' . $value; | |
$new_slug = sanitize_title( $new_title ); | |
wp_update_post( array( |
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 | |
/** some types of product attributes for woocommerce (those that are not taxonomies or used for variations | |
** are saved only in the _product_attributes custom field as an array | |
** select "_product_attributes" as the datasource in the facet and use facetwp_index_row to find and index | |
** the correct attributes | |
**/ | |
add_filter( 'facetwp_index_row', function( $params, $class ) { | |
if ( 'attributes' == $params['facet_name'] ) { //change 'attributes' to name of your facet | |
$values = maybe_unserialize( $params['facet_value'] ); |
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 | |
/** | |
* Plugin Name: Allow localhost http requests. | |
* Plugin URI: https://gist.github.com/saas786/a567363477df7e28b0c1df6295cadf75/ | |
* Description: Note: Please don't use it on live website. If you are working locally, sometimes you get errors such as "A valid URL was not provided" or such, specially when you are interacting with website which is also hosted locally, so it becomes annoying at times to find the cause, and most of the time its wp_safe_remote_request, wp_safe_remote_get or wp_safe_remote_post functions who are the culprit. So this plugin is a quick fix. | |
* Author: saas786 | |
* Version: 0.1 | |
*/ | |
add_filter( 'http_request_host_is_external', 'wplr_http_request_host_is_external' ); | |
function wplr_http_request_host_is_external(){ |
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 | |
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/ | |
/* Change the canonical link for the shop page | |
* Credit: Scott Weiss of somethumb.com | |
* Yoast Doc: https://developer.yoast.com/features/seo-tags/canonical-urls/api/ | |
* Last Tested: Jan 25 2017 using Yoast SEO 6.0 on WordPress 4.9.1 | |
*/ | |
add_filter( 'wpseo_canonical', 'yoast_seo_canonical_change_woocom_shop', 10, 1 ); |
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 | |
/** | |
* Add async boolean attribute to script tag | |
* @param string $tag Default script tag | |
* @return string Modified script tag | |
*/ | |
function omm_add_async_loading( $tag ) { | |
return str_replace( '<script', '<script async', $tag ); | |
} | |
add_filter( 'script_loader_tag', 'omm_add_async_loading' ); |
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 | |
/** | |
* Plugin Name: Convert ACF PHP to JSON | |
* Description: Convert Advanced Custom Fields Pro configuration from PHP to JSON. | |
*/ | |
namespace ConvertAcfPhpToJson; | |
/** | |
* Add submenu item under 'Custom Fields' |
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 | |
// has been taken from a class, globals are just a quick and dirty workarround | |
// This Wrapper is one example for a simple use of cached filemtime version strings, in this case for the parent theme. | |
// Needs small changes to work for childtheme, javascript, plugins or register | |
function local_enqueue_style( $handle, $src, $deps = array(), $media = 'all' ) { | |
wp_enqueue_style( $handle, get_template_directory_uri() . $src, $deps, local_get_version( get_template_directory() . $src ), $media ); | |
} |
NewerOlder