• Hello. I registered a custom column in the list of posts, opposite to each post I should have a select tag, but I need to assign each id to the id of the post opposite which it is displayed. How can I do that? It is advisable to do this through jquery
    My registered column

    function equipment_column_display( $column_name, $post_id ) {
    if ( 'equip' != $column_name )
    return;
    $equip = get_post_meta($post_id, 'source_link_custom_field', true);
    if ( !$equip )
    $equip = rel_select_post().'<a id="savebtn" class="save-sel" >Save</a>';
    echo $equip;
    }
    add_action( 'manage_posts_custom_column', 'equipment_column_display', 10, 2 );

    Function that prints from the database a select
    `function rel_select_post(){
    global $wpdb;
    $table_cat = $wpdb->prefix . ‘rel_cat’;
    $rel_cat = $wpdb->get_col(“SELECT name FROM $table_cat”);
    ?>
    <select name=”cat-select” id=”category-select”>
    <option value=””>Select category</option>
    <?php
    foreach($rel_cat as $key => $value):
    $key = 1;
    echo ‘<option value=”‘.$value.'”>’.$value.'</option>’;
    endforeach;
    ?>
    </select>
    <?php
    } `

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Get post id and pass it to jquery’ is closed to new replies.