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
//Must be "Select Field" in "Group Fields (ACF)" | |
add_action( 'edited_term', 'wpse_created_term', 10, 3 ); | |
add_action( 'delete_term', 'wpse_created_term', 10, 3 ); | |
add_action( 'created_term', 'wpse_created_term', 10, 3 ); | |
function wpse_created_term( $term_id, $tt_id, $taxonomy ) { | |
$postID = 4576; | |
$attribute_taxonomies = wc_get_attribute_taxonomies(); | |
$post = get_post($postID); | |
$postContent = unserialize($post->post_content); |
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_action('wp', function(){ | |
global $wpdb; | |
$seo_title = "[:uk]TEST TITLE😜[:en]TEST TITLE😜[:]"; | |
$seo_description = "[:uk]Test description 👍[:en]Test description 👍[:]"; | |
$sql = "SELECT option_value FROM wp_options WHERE option_name = 'wpseo_taxonomy_meta'"; | |
$result = $wpdb->get_results($sql); |
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
//Custom Autocomplete | |
add_action('wp_ajax_nopriv_get_listing_names', 'ajax_listings'); | |
add_action('wp_ajax_get_listing_names', 'ajax_listings'); | |
function ajax_listings() { | |
global $wpdb; //get access to the WordPress database object variable | |
//get names of all taxonomy terms | |
$name = '%'.$wpdb->esc_like(stripslashes($_GET['name'])).'%'; //escape for use in LIKE statement | |
$sql = "SELECT term.term_id as id, term.name as post_title, term.slug as guid, tax.taxonomy FROM $wpdb->term_taxonomy tax |
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 getElementByXpath(path) { | |
return document.evaluate(path, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; | |
} | |
console.log( getElementByXpath("//html[1]/body[1]/div[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
add_action('init', 'apiSynchronization_activation'); | |
function apiSynchronization_activation(){ | |
if ( !wp_next_scheduled( 'apiSynchronization' ) ) { | |
wp_schedule_event( time(), 'twicedaily', 'apiSynchronization'); | |
} | |
} | |
add_action('apiSynchronization', 'apiSync', 100); | |
function apiSync() | |
{ |
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 | |
function file_dump() { | |
ob_start(); | |
foreach (func_get_args() as $arg){ | |
var_dump($arg); | |
echo "\n"; | |
} | |
$str = ob_get_clean(); | |
$file = get_stylesheet_directory() . "/logs/logs.txt"; |
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 | |
$target = apply_filters( 'qtranslate_language_detect_redirect', $url_lang, $url_orig, $url_info ); | |
if ( $target !== false && $target != $url_orig ) { | |
//Custom code Start | |
$urlToArray = explode('/', $url_orig); | |
if(end($urlToArray) != "") | |
{ | |
$target .= '/'; | |
} | |
//Custom code End |
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: BP Add Page | |
* Plugin URI: https://webdevstudios.com | |
* Description: Example on adding a page to BuddyPress profiles | |
* Author: WebDevStudios | |
* Author URI: https://webdevstudios.com | |
* Version: 1.0.0 | |
* License: GPLv2 | |
*/ |
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('woocommerce_loop_add_to_cart_link','add_to_cart_link_revised'); | |
function add_to_cart_link_revised($link) { | |
global $product; | |
$product_id = $product->id; | |
$product_sku = $product->get_sku(); | |
$link = '<a href="'.get_permalink().'" class="button">READ MORE</a>'; | |
return $link; | |
} |
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 | |
$role = new WP_User( $userID ); | |
$role->add_cap('upload_files', true); | |
$role->add_cap('edit_published_pages', true); | |
add_filter( 'posts_where', 'devplus_attachments_wpquery_where' ); | |
function devplus_attachments_wpquery_where( $where ){ | |
global $current_user; |
NewerOlder