Skip to content

Instantly share code, notes, and snippets.

# Upgrading
Open up `composer.json` and change the two instances of the version to the version you wish to upgrade to.
Check the versions of any modules installed under the `require` section and update as required.
The modules under `require-dev` may also be out of date, so you'll need to download the version of Magento you are upgrading to and check the composer.json to see if any newer versions have been added.
Now run:
```shell
```html
html {
height: 100%;
}
body {
min-height: 100%;
}
div {
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):
```
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;
}
```php
$GLOBALS['wp_query']->request;
```
## 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
// 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 ) {
```php
session_start();
if (!isset($_SESSION['views'])) {
$_SESSION['views'] = 0;
}
$_SESSION['views'] = $_SESSION['views']+1;
if ($_SESSION['views'] == 1) {
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"'
```
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):