This file contains hidden or 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 | |
/* This file is taken directly from a clients site so it contains strings and conditions not necessarily useful to anyone else. | |
However it does show how one can use these filters to modify the meta information for the different filtered results */ | |
/* CHANGE META DESCRIPTION ON KLINIK FILTER PAGES */ | |
add_filter('wpseo_metadesc', 'custom_metadesc', 10, 1); | |
function custom_metadesc($desc){ | |
if(is_tax(array('omrade', 'yrkeskategori', 'specialisering', 'betalningsmedel', 'forsakringsbolag'))){ | |
global $wp_query; | |
$termID = $wp_query->queried_object->term_id; |
This file contains hidden or 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
/* Change this | |
* =============================== | |
*/ | |
// sub fields | |
foreach( $selector as $s ) { | |
if( is_numeric($s) ) { | |
$row_i = intval($s) - 1; | |
This file contains hidden or 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
{ | |
"repositories": [ | |
{ | |
"type": "composer", | |
"url": "http://wpackagist.org" | |
}, | |
{ | |
"type": "package", | |
"package": { | |
"name": "advanced-custom-fields/advanced-custom-fields-pro", |
This file contains hidden or 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
/* | |
* Modify ACF fields to account for translations if available | |
* | |
* This solution requires the use of Polylang for WP translations. | |
* Use this by duplicating the field groups for user meta and append _languageslug to each field in the duplicated group. | |
* So for a site with a swedish translation an example field would be named "user_phonenumber" | |
* in english (default) and in the swedish translation group "user_phonenumber_sv" | |
*/ | |
function load_translated_value_if_exists( $value, $post_id, $field ){ |
This file contains hidden or 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 has_grandchildren( $post_id ){ | |
$children = get_children(array( | |
'post_parent' => $post_id | |
)); | |
if( $children ){ | |
foreach( $children as $child ){ | |
$grandchildren = get_children(array( | |
'post_parent' => $child->ID |
This file contains hidden or 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 ugly_search($query) { | |
if( is_search() ) { | |
$org_s = $query->query_vars["s"]; | |
$query->set('s', $org_s . ' extra sträng'); | |
} | |
} | |
add_action('pre_get_posts', 'ugly_search'); |
This file contains hidden or 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
// make a note of the change | |
$order->add_order_note( | |
sprintf( __( 'Pickup location changed to %s', 'woocommerce-shipping-local-pickup-plus' ), | |
$this->get_formatted_address_helper( $pickup_location, true ) | |
), false, true | |
); |
This file contains hidden or 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 | |
/** | |
* Reads all files of a specific file type in a folder and returns them as an array. | |
* | |
*/ | |
public function read_files() { | |
$uploads_directory = trailingslashit( plugin_dir_path( dirname( __FILE__ ) ) ) . 'uploads/'; | |
$files = array_values( array_filter( scandir( $dir ), function( $file ) { | |
return ( pathinfo( $file, PATHINFO_EXTENSION ) != 'txt' ? false : true ); | |
} ) ); |
This file contains hidden or 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 | |
global $post; | |
if ( function_exists( 'acf_add_local_field_group' ) ) : | |
acf_add_local_field_group(array( | |
'key' => 'group_58bff7f25c321', | |
'title' => 'Garderobsbyggaren', | |
'fields' => array(), | |
'location' => array( | |
array( |
OlderNewer