Example #1
0
 function newSocial()
 {
     $schemaModel = new KcSeoSchemaModel();
     $id = $_REQUEST['id'] ? $_REQUEST['id'] + 1 : 0;
     $html = null;
     $html = "<div class='sfield'>";
     $html .= "<select name='social[{$id}][id]'>";
     foreach ($schemaModel->socialList() as $skey => $social) {
         $html .= "<option value='{$skey}'>{$social}</option>";
     }
     $html .= "</select>";
     $html .= "<input type='text' name='social[{$id}][link]'>";
     $html .= '<span class="dashicons dashicons-trash social-remove"></span>';
     $html .= "</div>";
     wp_send_json(array('data' => $html));
     die;
 }
Example #2
0
                    <tr class="field_social_title">
                        <th style="font-size: 18px; padding: 10px 0;">Social Profiles</th>
                    </tr>
                    <tr class="social_field_link">
                        <th>Social Profile</th>
                        <th>
                            <div id="social-field-holder">
                                <?php 
$socialP = isset($settings['social']) ? $settings['social'] ? $settings['social'] : array() : array();
if (is_array($socialP) && !empty($socialP)) {
    $html = null;
    $i = 0;
    foreach ($socialP as $socialD) {
        $html .= "<div class='sfield'>";
        $html .= "<select name='social[{$i}][id]'>";
        foreach ($schemaModel->socialList() as $sId => $social) {
            $slt = $sId == $socialD['id'] ? "selected" : null;
            $html .= "<option value='{$sId}' {$slt}>{$social}</option>";
        }
        $html .= "</select>";
        $html .= "<input type='text' name='social[{$i}][link]' value='{$socialD['link']}'>";
        $html .= '<span class="dashicons dashicons-trash social-remove"></span>';
        $html .= "</div>";
        $i++;
    }
    echo $html;
}
?>
                            </div>
                            <a class="button button-primary add-new" id="social-add" >Add Social Profile</a>
                        </th>