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
<IfModule mod_php5.c> | |
php_flag engine 0 | |
</IfModule> | |
<IfModule mod_php7.c> | |
php_flag engine 0 | |
</IfModule> | |
# To avoid situation when web server automatically adds extension to path | |
Options -MultiViews |
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 sure our server has the rewrite module active. | |
# (This is very standard - it almost certainly will) | |
<IfModule mod_rewrite.c> | |
# Let the system know we’re configuring redirections here | |
RewriteEngine on | |
# Now let’s list our redirections (technically these are known as “Rewrite Conditions”.) | |
RewriteCond %{HTTP_REFERER} ^http://.*referrerurlone\.com/ [NC,OR] |
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 | |
$terms = get_terms('category'); | |
if ( !empty( $terms ) && !is_wp_error( $terms ) ){ | |
foreach( get_terms( 'category', array( 'hide_empty' => false, 'parent' => 0 ) ) as $parent_term ) { | |
$term_children = get_term_children($parent_term->term_id, 'category'); ?> | |
<li class="term_item<?php echo ($term_children ? ' parent' : ''); ?>" data-hook="<?php echo $parent_term->slug; ?>"> | |
<a href="<?php echo home_url(); ?>/products/<?php echo $parent_term->slug; ?>"><?php echo $parent_term->name; ?></a> | |
</li> | |
<?php } | |
} ?> |
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
<!-- Quick solution for a question on StackExchange, | |
running through site pages, and compiling a ul of | |
pages in a category and a ul of pages that aren't. --> | |
<?php $args = array( | |
'post_type' => 'page', | |
'post_status' => 'publish', | |
'numberposts' => -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
add_filter("gform_field_validation_[FORM_ID]_[FIELD_ID]", "uk_postcode_validation", 10, 4); | |
function uk_postcode_validation($result, $value, $form, $field){ | |
//address field will pass $value as an array with each of the elements as an item within the array, the key is the field id | |
$postcode = $value["[FIELD_ID].5"]; | |
//the default regex is valid both with and without the space in the middle. | |
//to force the space, replace with the following: | |
//'#^(GIR ?0AA|[A-PR-UWYZ]([0-9]{1,2}|([A-HK-Y][0-9]([0-9ABEHMNPRV-Y])?)|[0-9][A-HJKPS-UW]) [0-9][ABD-HJLNP-UW-Z]{2})$#' |
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 print_with_pre($variable, $show=false) { | |
if($show===true) { | |
$style = ''; | |
} else { | |
$style = ' style="display: none;"'; | |
}; | |
$variable_to_show = print_r($variable, true); | |
$html = '<pre'.$style.'>'.$variable_to_show.'</pre>'; | |
echo $html; |
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
//This file is just a guide, don't include the comments in Coda. | |
//To directly add, copy the stripped down "config" file instead. | |
Host sitedev // the nickname you give the project. set Coda’s “nickname” and “server” the same | |
HostName access.b1.server.com // the SSH address provided | |
User user123 // the SSH username | |
IdentityFile ~/.ssh/id_rsa // path to your SSH key | |
Port 22 // port. usually 22 unless specified differently | |
//Coda Project settings |
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 get_term_object_from_uri($taxonomy) { | |
global $wp; | |
//get requested uri | |
$wp_request = $wp->request; | |
//split into array | |
$uri_params = explode('/', $wp_request); | |
//drop the product id as unnecessary | |
$param_total = (count($uri_params)-1); | |
unset($uri_params[$param_total]); |