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_filter("wpjb_form_init_alert", "my_form_init_alert"); | |
function my_form_init_alert($form) { | |
$e = $form->create("frequency", "select"); | |
$e->addOption("1", "1", "Daily"); | |
$e->addOption("2", "2", "Weekly"); | |
$e->addClass("wpjb-widget-alert-frequency"); | |
$form->addElement($e, "alert"); |
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 | |
// Assign a filter | |
add_filter( 'wphd_file_upload', 'my_wphd_file_upload' ); | |
/** | |
* Check if uploaded file extension is valid. | |
* | |
* This function is executed using 'wphd_file_upload' filter, | |
* it stops file upload using die() if incorrect file type is sent |
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
function wpadverts_mal_save_advert( $post_ID, $post, $update ) { | |
if( !isset( $_POST ) || empty( $_POST ) ) { | |
return; | |
} | |
include_once ADVERTS_PATH . '/includes/class-form.php'; | |
$form = new Adverts_Form; | |
$form->load( Adverts::instance()->get( "form_mal" ) ); |
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_filter( "adverts_form_load", "my_adverts_form_load" ); | |
function my_adverts_form_load( $form ) { | |
if( $form['name'] != "advert" ) { | |
return $form; | |
} | |
foreach( $form["field"] as $key => $field ) { | |
if( in_array($field["name"], array("adverts_price", "adverts_location", "adverts_phone") ) ) { |
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_shortcode("current_user_id", "current_user_id"); | |
function current_user_id() { | |
$user = wp_get_current_user(); | |
if( isset( $user->ID ) ) { | |
return $user->ID; | |
} else { | |
return "0"; |
OlderNewer