Skip to content

Instantly share code, notes, and snippets.

Step 1:
Add `languages` directory to your theme
Step 2:
Download correct `.mo` file into the `languages` directory you created
Step 3:
Generate `.po` file from the `.mo` file using PoEdit
Step 4 (if using child theme):
Change the location to the access log as required, and also change `$5` (column) to the correct one for the date.
```
cat ~/logs/AccessLog | awk '$5 >= "[1/Dec/2018:10:00:00" && $5 < "[17/Dec/2018:13:00:00"'
```
```php
session_start();
if (!isset($_SESSION['views'])) {
$_SESSION['views'] = 0;
}
$_SESSION['views'] = $_SESSION['views']+1;
if ($_SESSION['views'] == 1) {
```php
// Add Variation Settings
add_action( 'woocommerce_product_after_variable_attributes', 'variation_settings_fields', 10, 3 );
// Save Variation Settings
add_action( 'woocommerce_save_product_variation', 'save_variation_settings_fields', 10, 2 );
/**
* Create new fields for variations
*
*/
function variation_settings_fields( $loop, $variation_data, $variation ) {
## Register new sidebar
Add the following to `/functions.php`
```php
function theme_widgets_init() {
register_sidebar( array(
'name' => __( 'Support Sidebar', 'lanmaster' ),
'id' => 'support-sidebar',
'description' => __( 'Sidebar for support section.', 'lanmaster' ),
) );
}
```php
$GLOBALS['wp_query']->request;
```
```
add_filter( 'woocommerce_product_tabs', 'woo_new_product_tab' );
function woo_new_product_tab( $tabs ) {
$tabs['test_tab'] = array(
'title' => __( 'New Product Tab', 'woocommerce' ),
'priority' => 50,
'callback' => 'woo_new_product_tab_content'
);
return $tabs;
}
Add the following to your `functions.php`
```php
function vc_before_init_actions() {
require_once( get_template_directory().'/functions/shortcodes/vc-text-image.php' );
}
add_action( 'vc_before_init', 'vc_before_init_actions' );
```
And now create a file in the location specified above with the following (customise accordingly):
```html
html {
height: 100%;
}
body {
min-height: 100%;
}
div {