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
1. Redirect All Web Traffic | |
If you have existing code in your .htaccess, add the following: | |
RewriteEngine On | |
RewriteCond %{SERVER_PORT} 80 | |
RewriteRule ^(.*)$ https://www.yourdomain.com/$1 [R,L] | |
2. Redirect Only a Specific Domain | |
For redirecting a specific domain to use HTTPS, add the following: | |
RewriteEngine On |
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
// mailto function | |
$('a[href^="mailto:"]').click(function(){ | |
var emaillink=jQuery(this).attr('href'); | |
gtag('event', 'contact', { 'event_category' : 'Email Enquiry', 'event_action' : 'Mailto Click', 'event_label' : emaillink}); | |
return true; | |
}); | |
// tel: function | |
$('a[href^="tel:"]').click(function(){ |
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 add_theme_scripts() { | |
wp_enqueue_style( 'style', get_stylesheet_uri() ); | |
wp_enqueue_style( 'slider', get_template_directory_uri() . '/css/slider.css', array(), '1.1', 'all'); | |
wp_enqueue_script( 'script', get_template_directory_uri() . '/js/script.js', array ( 'jquery' ), 1.1, true); | |
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { | |
wp_enqueue_script( 'comment-reply' ); | |
} |
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('manage_<POSTTYPE>_posts_columns', function ($columns) { | |
return array_merge($columns, ['verified' => __('Verified', 'textdomain')]); | |
}); | |
add_action('manage_<POSTTYPE>_posts_custom_column', function ($column_key, $post_id) { | |
if ($column_key == 'verified') { | |
$verified = get_post_meta($post_id, 'verified', true); | |
if ($verified) { | |
echo '<span style="color:green;">'; | |
_e('Yes', 'textdomain'); |
We can't make this file beautiful and searchable because it's too large.
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
Title,Link,Price | |
4:00 PM,https://store.steampowered.com/app/281840/4PM/?snr=1_7_7_230_150_447,£1.99 | |
3.04,https://store.steampowered.com/app/952950/0304/?snr=1_7_7_230_150_223,£3.99 | |
5,https://store.steampowered.com/app/1132070/50/?snr=1_7_7_230_150_161,£0.79£0.39 | |
6,https://store.steampowered.com/app/1165860/60/?snr=1_7_7_230_150_159,£0.79£0.39 | |
16,https://store.steampowered.com/bundle/20256/16/?snr=1_7_7_230_150_308,£3.20 | |
21,https://store.steampowered.com/app/938520/21/?snr=1_7_7_230_150_564,£3.99£0.39 | |
50.05,https://store.steampowered.com/app/688810/5005/?snr=1_7_7_230_150_781,Free | |
50.05,https://store.steampowered.com/app/688810/5005/?snr=1_7_7_230_150_837,Free | |
64,https://store.steampowered.com/app/578850/640/?snr=1_7_7_230_150_76,£1.99 |
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 a custom product data tab | |
*/ | |
add_filter('woocommerce_product_tabs', 'woo_new_product_tab'); | |
function woo_new_product_tab($tabs) | |
{ | |
// Adds the new tab | |
$tabs['test_tab'] = 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
add_action('restrict_manage_posts', 'tsm_filter_post_type_by_taxonomy'); | |
function tsm_filter_post_type_by_taxonomy() { | |
global $typenow; | |
$post_type = 'property'; // change to your post type | |
$taxonomy = 'section'; // change to your taxonomy | |
if ($typenow == $post_type) { | |
$selected = isset($_GET[$taxonomy]) ? $_GET[$taxonomy] : ''; | |
$info_taxonomy = get_taxonomy($taxonomy); | |
wp_dropdown_categories(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
function wpb_custom_new_menu() { | |
register_nav_menus( | |
array( | |
'my-custom-menu' => __( 'My Custom Menu' ), | |
'extra-menu' => __( 'Extra Menu' ) | |
) | |
); | |
} | |
add_action( 'init', 'wpb_custom_new_menu' ); |
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 wpb_widgets_init() { | |
register_sidebar( array( | |
'name' => __( 'Main Sidebar', 'wpb' ), | |
'id' => 'sidebar-1', | |
'description' => __( 'The main sidebar appears on the right on each page except the front page template', 'wpb' ), | |
'before_widget' => '<aside id="%1$s" class="widget %2$s">', | |
'after_widget' => '</aside>', | |
'before_title' => '<h3 class="widget-title">', |
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
1. | |
add_filter('request', function( $vars ) { | |
global $wpdb; | |
if( ! empty( $vars['pagename'] ) || ! empty( $vars['category_name'] ) || ! empty( $vars['name'] ) || ! empty( $vars['attachment'] ) ) { | |
$slug = ! empty( $vars['pagename'] ) ? $vars['pagename'] : ( ! empty( $vars['name'] ) ? $vars['name'] : ( !empty( $vars['category_name'] ) ? $vars['category_name'] : $vars['attachment'] ) ); | |
$exists = $wpdb->get_var( $wpdb->prepare( "SELECT t.term_id FROM $wpdb->terms t LEFT JOIN $wpdb->term_taxonomy tt ON tt.term_id = t.term_id WHERE tt.taxonomy = 'product_cat' AND t.slug = %s" ,array( $slug ))); | |
if( $exists ){ | |
$old_vars = $vars; | |
$vars = array('product_cat' => $slug ); | |
if ( !empty( $old_vars['paged'] ) || !empty( $old_vars['page'] ) ) |