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 | |
$labels = [ | |
"name" => __('Services', 'text-domain'), | |
//... | |
//... | |
]; | |
$args = [ | |
"label" => __('Services', 'text-domain'), | |
"labels" => $labels, |
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 whpp_track_post_views($post_id) { | |
if (!is_single()) | |
return; | |
if (empty($post_id)) { | |
global $post; | |
$post_id = $post->ID; | |
} | |
whpp_set_post_views($post_id); |
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 | |
$args = [ | |
//... | |
'meta_key' => 'whpp_track_post_views', | |
'orderby' => 'meta_value_num', | |
'order' => 'DESC', | |
//... | |
]; | |
$query = new WP_Query($args); |
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 | |
add_action('product_cat_add_form_fields', 'wh_taxonomy_add_new_meta_field', 10, 1); | |
add_action('product_cat_edit_form_fields', 'wh_taxonomy_edit_meta_field', 10, 1); | |
//Product Cat Create page | |
function wh_taxonomy_add_new_meta_field() { | |
?> | |
<div class="form-field"> | |
<label for="wh_meta_title"><?php _e('Meta Title', 'wh'); ?></label> | |
<input type="text" name="wh_meta_title" id="wh_meta_title"> | |
<p class="description"><?php _e('Enter a meta title, <= 60 character', 'wh'); ?></p> |
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 | |
add_action('edited_product_cat', 'wh_save_taxonomy_custom_meta', 10, 1); | |
add_action('create_product_cat', 'wh_save_taxonomy_custom_meta', 10, 1); | |
// Save extra taxonomy fields callback function. | |
function wh_save_taxonomy_custom_meta($term_id) { | |
$wh_meta_title = filter_input(INPUT_POST, 'wh_meta_title'); | |
$wh_meta_desc = filter_input(INPUT_POST, 'wh_meta_desc'); |
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 | |
$productCatMetaTitle = get_term_meta($term_id, 'wh_meta_title', true); | |
$productCatMetaDesc = get_term_meta($term_id, 'wh_meta_desc', true); |
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 | |
namespace App; | |
use Illuminate\Database\Eloquent\Model; | |
class BlogPost extends Model { | |
protected $connection = 'wordpress_db_connection'; | |
protected $table = 'posts'; |
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 | |
namespace App; | |
use Illuminate\Database\Eloquent\Model; | |
class BlogPostmeta extends Model { | |
protected $connection = 'wordpress_db_connection'; | |
protected $table = 'postmeta'; |
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
#!/bin/sh | |
# Step 1: set up all the variables | |
###Set the file path where you want to store the backup file and set the name of the file. | |
FILE=/path/to/your/backup_dir/my_db_file.sql.$(date +'%Y%m%d') | |
###Database Details: | |
DBSERVER=db_host | |
DATABASE=db_name | |
USER=db_user | |
PASS=db_password |
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 | |
return [ | |
//... | |
//... | |
'default' => 'mysql_primary', | |
'connections' => [ | |
//.. | |
//Our Default Database Connection | |
'mysql_primary' => [ |
OlderNewer