dongxieyou3314 2018-12-05 17:23
浏览 51

如何在我的后端Wordpress自定义类型页面上显示已检查的版本,但在数据库中我想看到变量名称

So I have to work with a wordpress function file. In this file I made a custom type called Series. I want to be able to check off genres of the series and save it in my database as the genre names separately and not as an array. I got it to show up and save as an array but I have no clue how to save them separately. I searched it and they all go back to the implode code but there are no good examples of how to use this.

Example checkbox:

function sps_add_custom_box(){
add_meta_box(
    'sps_genres_box_id',
    'Genres',
    'sps_custom_box_genre_html',
    'series');}

function sps_custom_box_genre_html($post){
    $value_action = get_post_meta($post->ID, '_genres_series', true);
    print("<input type='checkbox' name='Genres[]' id='Action' value='".$value_action."'></input>");
    print("<label for='Action'>Action </label>");}

add_action('add_meta_boxes', 'sps_add_custom_box');

function get_all_of_post_type( $type_name = ''){
$items = array();
if( !empty($type_name)){
    $args = array(
        'post_type' => "{$type_name}",
        'posts_per_page' => -1,
        'order' => 'ASC',
        'orderby' => 'title');
    $results = get_posts( $args );}
return $results;}
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 数学建模,尽量用matlab回答,论文格式
    • ¥15 昨天挂载了一下u盘,然后拔了
    • ¥30 win from 窗口最大最小化,控件放大缩小,闪烁问题
    • ¥20 易康econgnition精度验证
    • ¥15 msix packaging tool打包问题
    • ¥28 微信小程序开发页面布局没问题,真机调试的时候页面布局就乱了
    • ¥15 python的qt5界面
    • ¥15 无线电能传输系统MATLAB仿真问题
    • ¥50 如何用脚本实现输入法的热键设置
    • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能