Skip to content

Instantly share code, notes, and snippets.

View codename065's full-sized avatar
🐢

Shahnur Alam codename065

🐢
View GitHub Profile
@codename065
codename065 / wpdmpp_as_you_pay_label.php
Last active January 8, 2023 14:46
Using filter hook "wpdmpp_as_you_pay_label" to change label "Name Your Price" in premium packages
<?php
add_filter( "wpdmpp_as_you_pay_label", function ( $str, $product_id ) {
$str = "Your custom text";
return $str;
}, 10, 2 );
@codename065
codename065 / hide category.php
Last active June 28, 2023 17:05
hide category when user does not have access
<?php
add_filter("get_terms", function ($terms, $tax, $ta, $tz){
$_terms = [];
if($tax[0] === 'wpdmcategory') {
foreach ($terms as $term) {
if(WPDM()->categories::userHasAccess($term->term_id)) {
$_terms[] = $term;
}
}
}
@codename065
codename065 / disable scripts.php
Last active July 14, 2023 12:52
Disable scripts
<?php
add_filter("wpdm_disable_scripts", function ($disabled_scripts) {
// $disabled_scripts = ['wpdm-bootstrap-js', 'wpdm-bootstrap-css', 'wpdm-font-awesome', 'wpdm-front'];
// by default $disabled_scripts = [], means all scripts are enabled,
// if you want to disable 'wpdm-bootstrap-css' push it to $disabled_scripts, like $disabled_scripts[] = 'wpdm-bootstrap-css';
// example to disable scripts on page id 123
if(get_the_ID() === 123) {
$disabled_scripts[] = 'wpdm-bootstrap-css';
$disabled_scripts[] = 'wpdm-bootstrap-js';
}