我创建了自定义分类
// store
$book_label = array(
'name' => _x( 'stores', 'taxonomy general name' ),
'singular_name' => _x( 'store', 'taxonomy singular name' ),
'search_items' => __( 'Search in store' ),
'all_items' => __( 'All store' ),
'most_used_items' => null,
'parent_item' => null,
'parent_item_colon' => null,
'edit_item' => __( 'Edit store' ),
'update_item' => __( 'Update store' ),
'add_new_item' => __( 'Add new store' ),
'new_item_name' => __( 'New store' ),
'menu_name' => __( 'stores' ),
);
register_taxonomy('stores', 'books',array(
'hierarchical' => true,
'labels' => $book_label,
'show_ui' => true,
'query_var' => true,
'rewrite' => array('slug' => 'stores' )
));
//
商店现在允许我在输入网址的描述中输入名称和描述,以便在根据所选商店名称添加帖子时,也会自动选择网址。
<?php
$link = term_description( '', get_query_var( 'stores' ) );
if($link != '') : ?>
<div class="click"><a href=<?php header('Location' .$link); ?>> BUY </a></div>
<?php endif; ?>
但是在前端,网址既不显示也不重定向....关于我出错的地方指导
答案 0 :(得分:0)
很难说只能看到预处理的服务器端代码,但如果我猜测,我说它可能是因为你的事实您的网址周围没有"
个。因此,您得到的锚标记将是这样的:
<a href=http://example.com> BUY </a>
那将是无效的。你需要的是这样的:
<a href="<?php header('Location' .$link); ?>"> BUY </a>
这将产生以下结果(假设标题echo
出一个字符串):
<a href="http://example.com"> BUY </a>
您也可以在问题中发布标题功能。