Created
September 13, 2016 02:24
-
-
Save leordev/b0fd560a17b862deae1b664c4b856303 to your computer and use it in GitHub Desktop.
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_action('add_meta_boxes', 'maximize_lead_mb_add'); | |
function maximize_lead_mb_add() { | |
add_meta_box( | |
'maximize_lead-id', | |
'Maximize Lead Page', | |
'maximize_lead_cb', | |
'page', | |
'side' | |
); | |
} | |
function maximize_lead_cb() { | |
global $post; | |
global $wpdb; | |
$table = $wpdb->prefix . "maximize_lead"; | |
$pages = $wpdb->get_results("SELECT id, title FROM $table"); | |
$values = get_post_custom($post->ID); | |
$mlSelected = $values['maximize_lead_page']; | |
wp_nonce_field('maximize_lead_mb_nonce', 'maximize_lead_nonce'); | |
$mlCurrentSelected = $mlSelected[0]; | |
?> | |
<h4>Select a Maximize Lead Page</h4> | |
<select name="maximize_lead_page" | |
id="maximize_lead_page"> | |
<option <?php if($ezleadproCurrentSelected == "0"){ echo "selected='selected'"; } ?>>None</option> | |
<?php | |
foreach($p as $pages) { | |
$id = stripslashes($p->id); | |
$title = stripslashes($p->title); | |
$sel = $mlCurrentSelected == $id ? "selected='selected'" : ""; | |
echo "<option $sel value='$id'>$title</option>"; | |
} | |
?> | |
</select> | |
<?php | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment