wordpress和PHP 5.3。在我的php代码中使用参数getsomething header_text='Hello World‘的简短代码
extract( shortcode_atts( array (
'posts_per_page' => 6,
'orderby' => 'date',
'post_type' => 'insights',
'category_name' => '',
'author_name' => '',
'header_text' => ''
), $atts ) );但这并不像我预期的那样工作。它总是选择header_text,如果没有提供,它是一个空字符串。我遗漏了什么?
$output = '<section class="card-lists"><h3>' . $header_text ?: $post_type . '</h3>';发布于 2018-01-12 06:04:39
尝试更改
$header_text ?: $post_type至
(empty($header_text)?$post_type:$header_text)https://stackoverflow.com/questions/48216413
复制相似问题