Last active
August 17, 2020 17:34
-
-
Save ivanmrchk/740fc3e2672106a99c46dcf6c3bfeaf9 to your computer and use it in GitHub Desktop.
scm functions from child and parent theme
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( 'wp_enqueue_scripts', 'argu_child_scripts' ); | |
/** | |
* Enqueue scripts and styles. | |
*/ | |
function argu_child_scripts() { | |
wp_enqueue_script( 'argu-child', get_stylesheet_directory_uri() . '/js/referral.js', array( 'jquery' ), false, true ); | |
} | |
date_default_timezone_set('America/Los_Angeles'); | |
// get cookie ref | |
$ref_value = $_COOKIE['ref']; | |
// echo $ref_value; | |
if(isset($_GET['canopy-totla-price'])) { | |
$canopy_name = $_GET['canopy-name']; | |
$date = date('m/d/Y h:m:s'); | |
// $array_to_post[$ref_value] = "Canopy quote submitted by $canopy_name on $date"; | |
$array_to_post = get_user_meta(2, "referral_activity", true); | |
$array_to_post[$ref_value ."#". $date] = "Canopy quote submitted by $canopy_name on $date"; | |
update_user_meta(2, "referral_activity", $array_to_post); | |
} | |
if(isset($_GET['guardrails-total-price'])){ | |
$guardrails_name = $_GET['guardrails-name']; | |
$date = date('m/d/Y h:m:s'); | |
$array_to_post = get_user_meta(2, "referral_activity", true); | |
$array_to_post[$ref_value ."#". $date] = "Guardrails quote submitted by $guardrails_name on $date"; | |
update_user_meta(2, "referral_activity", $array_to_post); | |
} | |
if(isset($_GET['balcony-total-price'])){ | |
$balcony_name = $_GET['balcony-name']; | |
$date = date('m/d/Y h:m:s'); | |
$array_to_post = get_user_meta(2, "referral_activity", true); | |
$array_to_post[$ref_value ."#". $date] = "Balcony quote submitted by $balcony_name on $date"; | |
update_user_meta(2, "referral_activity", $array_to_post); | |
} | |
if(isset($_GET['handrails-total-price'])){ | |
$handrails_name = $_GET['handrails-name']; | |
$date = date('m/d/Y h:m:s'); | |
$array_to_post = get_user_meta(2, "referral_activity", true); | |
$array_to_post[$ref_value ."#". $date] = "Handrails quote submitted by $handrails_name on $date"; | |
update_user_meta(2, "referral_activity", $array_to_post); | |
} | |
if(isset($_POST['your-name-contact-page'])){ | |
$contact_name = $_POST['your-name-contact-page']; | |
$date = date('m/d/Y h:m:s'); | |
$array_to_post = get_user_meta(2, "referral_activity", true); | |
$array_to_post[$ref_value ."#". $date] = "Contact page form submitted by $contact_name on $date"; | |
update_user_meta(2, "referral_activity", $array_to_post); | |
} | |
if(isset($_POST['your-name-appointment'])){ | |
$appointment_name = $_POST['your-name-appointment']; | |
$date = date('m/d/Y h:m:s'); | |
$array_to_post = get_user_meta(2, "referral_activity", true); | |
$array_to_post[$ref_value ."#". $date] = "Appointemnt requested by $appointment_name on $date"; | |
update_user_meta(2, "referral_activity", $array_to_post); | |
} | |
// echo '<pre>'; print_r(get_user_meta(2, "referral_activity", true )); echo '</pre>'; | |
add_action('wp_dashboard_setup', 'referral_activities'); | |
function referral_activities() { | |
global $wp_meta_boxes; | |
wp_add_dashboard_widget('custom_newsletter_moderation', 'Referrals Activities', 'referral_activities_func_dashboard'); | |
} | |
function referral_activities_func_dashboard(){ | |
$url = get_site_url(); | |
?> | |
<table style="width: 100%;"> | |
<thead> | |
<tr> | |
<td style="width: 110px;"><b>Referral ID</b></td> | |
<td><b>Message</b></td> | |
</tr> | |
</thead> | |
<tbody> | |
<?php | |
$referrals_activities_array = get_user_meta(2, "referral_activity", true); | |
foreach ($referrals_activities_array as $key => $val) { | |
$ref_id = explode("#", $key); | |
echo "<tr>"; | |
echo "<td>". $ref_id[0] . "</td>"; | |
echo "<td>$val</td>"; | |
echo "</tr>"; | |
} | |
?> | |
</tbody> | |
</table> | |
<?php if(empty($referrals_activities_array)) { | |
} else {?> | |
<a href="<?php echo get_site_url() . '/wp-admin/index.php?removerefactivity=yes' ?>" class="button button-warning" style="background: #e32636; color: #fff;text-decoration: none;text-shadow: 0 -1px 1px #006799,">Remove All </a> | |
<?php } | |
} | |
function remove_ref_activity() { | |
$empty_array = array(); | |
update_user_meta(2, "referral_activity", $empty_array); | |
} | |
if (isset($_GET['removerefactivity'])) { | |
remove_ref_activity(); | |
} | |
if ( is_admin() && isset( $_GET['resetallsinotifications'] ) ) { | |
$args = array( | |
'post_type' => SI_Notification::POST_TYPE, | |
'posts_per_page' => -1, | |
'fields' => 'ids', | |
); | |
$posts = get_posts( $args ); | |
foreach ( $posts as $post_id ) { | |
wp_delete_post( $post_id, true ); | |
} | |
SI_Notifications_Control::clear_notification_cache(); | |
} |
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 | |
load_theme_textdomain('argu', get_template_directory() . '/lang'); | |
require_once get_template_directory() . '/arguoptions/argu-config.php'; | |
require_once get_template_directory() . '/inc/up-utils.php'; | |
require_once get_template_directory() . '/inc/up-init.php'; | |
require_once get_template_directory() . '/inc/up-sidebar.php'; | |
require_once get_template_directory() . '/inc/config.php'; | |
require_once get_template_directory() . '/inc/up-cleanup.php'; | |
require_once get_template_directory() . '/inc/comments.php'; | |
require_once get_template_directory() . '/inc/up-widgets.php'; | |
require_once get_template_directory() . '/inc/up-scripts.php'; | |
require_once get_template_directory() . '/inc/up-custom.php'; | |
require_once get_template_directory() . '/inc/up-custom-woocommerce.php'; | |
require_once get_template_directory() . '/inc/activate-plugins.php'; | |
require_once get_template_directory() . '/inc/custom-css.php'; | |
if (class_exists('WPBakeryVisualComposerAbstract')) { | |
function requireVcExtend(){require_once get_template_directory() . '/vc_extend/extend-vc.php';}add_action('init', 'requireVcExtend',2);add_action( 'init', 'argu_vcSetAsTheme' );function argu_vcSetAsTheme() {vc_set_as_theme(true);}} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment