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 | |
/** | |
* create a file acf-import.json inside your theme main folder | |
* use this code in themes functions.php or in any custom plugin. | |
* It is one time code so it will add all fields json entry inside acf-import.json file | |
*/ | |
add_action('init', 'create_fieldjson_from_fieldphp'); | |
function create_fieldjson_from_fieldphp() { | |
$groups = acf_get_local_field_groups(); | |
$json = []; |
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_filter('show_admin_bar','codingeek_show_admin_bar'); | |
function codingeek_check_user_validation(){ | |
$current_user = wp_get_current_user(); | |
if ( in_array('subscriber', $current_user)) { | |
//have to write code for subscriber | |
show_admin_bar( false ); // for hide adminbar | |
}; |
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_filter('show_admin_bar','codingeek_show_admin_bar'); | |
function codingeek_check_user_validation(){ | |
$current_user = wp_get_current_user(); | |
if ( in_array('subscriber', $current_user)) { | |
//have to write code for subscriber | |
show_admin_bar( false ); // for hide adminbar | |
}; |
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 | |
/** | |
* Fix for Elementor template conditions not compatible with Polylang (you need to save again one of your templates to make it work, after putting this function in your plugin/theme) | |
* Needs to be priority 1, since Polylang uses the action parse_query which is fired before pre_get_posts | |
* | |
* @link https://github.com/polylang/polylang/issues/152#issuecomment-320602328 | |
* | |
* @param WP_Query $query | |
*/ | |
function polylang_elementor_library_conditions_parse_query( $query ) { |
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 | |
/** | |
* WooCommerce: Adds Brand attribute to "Product" Structured Data | |
* | |
* @param array $data | |
* | |
* @return array | |
*/ | |
function woocommerce_structured_data_product_brand ($data) { | |
global $product; |
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 | |
/** | |
* WooCommerce Scheduled Sales: everyday, sales start, cache should be emptied (WP Rocket) | |
* | |
* @since 1.0.9 | |
*/ | |
function woocommerce_scheduled_sales_empty_wprocket_cache(){ | |
// Clear WP Rocket Cache (whole site) | |
if ( function_exists( 'rocket_clean_domain' ) ) { |
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 | |
/** | |
* Elementor get polylang translation of template | |
*/ | |
add_filter( 'elementor/theme/get_location_templates/template_id', function( $post_id ) { | |
if(!is_admin()){ | |
if ( function_exists( 'pll_get_post' ) ) { |
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 | |
/** | |
* Polylang Shortcode - https://wordpress.org/plugins/polylang/ | |
* Add this code in your functions.php | |
* Put shortcode [polylang_langswitcher] to post/page for display flags | |
* | |
* @return string | |
*/ | |
function custom_polylang_langswitcher() { | |
$output = ''; |
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 | |
/** | |
* Elementor: Force posts per page number for posts widget on Category Pages | |
* | |
* @param $query | |
*/ | |
function elementor_category_posts_per_page( $query ) { | |
$category_id_or_slug = 'myslug'; |
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 | |
/** | |
* Elementor: Force posts per page number for posts widget on Category Pages | |
* | |
* @param $query | |
*/ | |
function elementor_category_posts_per_page( $query ) { | |
$category_id_or_slug = 'myslug'; |
OlderNewer