我需要添加一些静态值,就像我们在java中的属性文件中所做的那样。
我怎么能在Wordpress中做同样的事情?
我尝试了POST方法,但无法在前端检索POST值。
有人能提出建议吗?
我试着检索帖子如下:
$args = array(
'slug' => 'cpurl',
'post_type' => 'cpurl',
'post_status' => 'draft',
'numberposts' => 1
);
$my_posts = get_posts($args);
print_r ($my_posts);
显示空数组
$postid = $wpdb->get_var( "SELECT ID FROM $wpdb->posts WHERE post_title = '" . $postTitle . "'" );
$content_post = get_post($postid);
$cpUrl = $content_post->post_content;
使用上面的代码来获取帖子内容,使用可用的内容标题