我对php不是那么专业,但我有很好的概念,可以很聪明地找到自己的路,这个论坛总是让我走在游戏的前面,因为像你这样的人都很关心我,
我有一个作为博客网站的网站,我有多个国家在顶部滚动。
<a href="http://ca.unitysofts.com/">http://ca.unitysofts.com/</a>
我想实现的是,当有人点击“中国”国旗时,下一页将显示所有来自中国的帖子标签。这很有效,但我想定制
每个国家的每个标签页当前都是这样的
ca.unitysofts公司。com/tag/中国/
我想自定义它,所以每个结果首先检查标记id,然后执行该国国旗的图像该国的一些维基百科信息,然后在下面开始博客滚动,
我希望我已经解释过了,很抱歉我的无知,也许答案很简单,
谢谢
最合适的回答,由SO网友:terminator 整理而成
将此代码放入函数中。ph值
define(\'IMAGES\',get_stylesheet_directory_uri().\'/img\');
其中,img是存在标志图像的目录
<?php
get_header();
$queried_object = get_queried_object();
$term = $queried_object->name;
switch ($term) {
case "china":
echo \'<img src=" <?php echo IMAGES; ?>/china.jpg">\';
break;
case "russia":
echo \'<img src=" <?php echo IMAGES; ?>/russia.jpg">\';
break;
case "india":
echo \'<img src=" <?php echo IMAGES; ?>/india.jpg">\';
break;
}
echo \'
<div class="title-head"><h1>\'.$term.\'</h1></div>
<div class="blog-fixed">\';
$page_layout = page_sidebar_layout();
switch ($page_layout) {
case "sidebar-left":
echo \'
<div id="blog-right">\';
break;
case "sidebar-full":
echo \'
<div id="blog-full">\';
break;
case "sidebar-right":
echo \'
<div id="blog-left">\';
break;
}
if (have_posts())
while (have_posts()):
the_post();
$image_id = get_post_thumbnail_id($post->ID);
$cover = wp_get_attachment_image_src($image_id, \'short-one\');
$no_cover = get_template_directory_uri();
$author = get_the_author_meta(\'ID\');
echo \'
<div class="bl2page-archive">\';
echo \'
<div class="bl2page-cover">\';
if ($image_id) {
echo \'
<a href="\' . get_permalink() . \'"><img src="\' . $cover[0] . \'" alt="\' . get_the_title() . \'" /></a>\';
} else {
echo \'
<a href="\' . get_permalink() . \'"><img src="\' . $no_cover . \'/images/no-cover/short-one.png" alt="no-cover" /></a>\';
}
echo \'
<div class="comment-bubble">
<span class="comment-count">\' . get_comments_number() . \'</span>
</div>
</div>\';
echo \'
<h2 class="bl2page-title"><a href="\' . get_permalink() . \'" rel="bookmark">\' . get_the_title($post->ID) . \'</a></h2>
<div class="bl2page-info">\' . get_the_time(\'F jS, Y\') . \' | by <a href="\' . get_author_posts_url($author) . \'">\' . get_the_author() . \'</a> </div>\';
echo \'\' . get_excerpt(230) . \'\';
echo \'
</div>\';
endwhile;
if (function_exists("pagination_wz")) {
pagination_wz();
}
echo \'
</div><!-- end .blog(left&full&right) -->
\';
switch ($page_layout) {
case "sidebar-left":
echo \'
<div id="sidebar-left">\';
wz_setSection(\'zone-sidebar\');
if (!function_exists(\'dynamic_sidebar\') || !dynamic_sidebar(\'sidebar-page\'));
echo \'
</div><!-- end .sidebar-left -->\';
break;
case "sidebar-full":
echo \'
<div id="sidebar-right">\';
wz_setSection(\'zone-sidebar\');
if (!function_exists(\'dynamic_sidebar\') || !dynamic_sidebar(\'sidebar-page\'));
echo \'
</div><!-- end .sidebar-right -->\';
break;
case "sidebar-right":
echo \'
<div id="sidebar-right">\';
wz_setSection(\'zone-sidebar\');
if (!function_exists(\'dynamic_sidebar\') || !dynamic_sidebar(\'sidebar-page\'));
echo \'
</div><!-- end .sidebar-right -->\';
break;
}
echo \'
</div><!-- end .blog-fixed -->\';
get_footer();
?>