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
```sql | |
SELECT * | |
FROM db_name.wp_posts | |
WHERE db_name.wp_posts.post_type = 'product' | |
AND db_name.wp_posts.ID NOT IN | |
(SELECT db_name.wp_posts.ID | |
FROM db_name.wp_posts | |
INNER JOIN db_name.wp_term_relationships | |
ON db_name.wp_posts.ID = | |
db_name.wp_term_relationships.object_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
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): |
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 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"' | |
``` |
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 | |
session_start(); | |
if (!isset($_SESSION['views'])) { | |
$_SESSION['views'] = 0; | |
} | |
$_SESSION['views'] = $_SESSION['views']+1; | |
if ($_SESSION['views'] == 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
```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 ) { |
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
## 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' ), | |
) ); | |
} |
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 | |
$GLOBALS['wp_query']->request; | |
``` |
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( '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; | |
} |
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 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): |
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
```html | |
html { | |
height: 100%; | |
} | |
body { | |
min-height: 100%; | |
} | |
div { |