0

我在 wordpress 中构建了以下网站 http://www.drwagenberg.com/以前的开发人员创建了四个模板页面,并在不同类别的帖子中创建了所有内容。这是模板页面代码之一

<?php
/*
Template Name: detail
*/
?><?php get_header(); ?>
<?php include (TEMPLATEPATH . '/banner.php'); ?>
<div id="inner_servce_bx">   <!-- inner service bx -->

<?php $cat_id=$_GET['catid']; ?> 
<div id="inner_heading">
<?php  $title = $wpdb->get_results( "SELECT * FROM $wpdb->terms WHERE term_id=$cat_id"); 
    foreach ($title as $objt)  {
    $main_title =  $objt->name; ?>
  <div id="inner_hdng_txt"><?php echo $main_title; ?></div>
  <?php } ?>
  </div> 

  <div id="servcs_smal_bx">  <!-- service service bx -->

<?php  $service_id = $wpdb->get_results( "SELECT * FROM $wpdb->term_taxonomy WHERE parent=7 order by term_id asc"); 
foreach ($service_id as $obj)  {
$service_cat_id =  $obj->term_id; ?>
<?php  $service_name = $wpdb->get_results( "SELECT * FROM $wpdb->terms WHERE term_id=$service_cat_id"); 
foreach ($service_name as $obj1)  {
$service_cat_name =  $obj1->name;
$service_cat_id = $obj1->term_id; ?>

        <div id="servcs_smal_bx1">  <!-- servcs smal bx1 -->
        <div id="servc_title_bx">  <!-- servc title bx -->
          <div id="title_txt"><?php echo $service_cat_name; ?><br/>
<span id="title_txt1"><?php echo category_description( $service_cat_id ); ?></span></div>
<!-- servc title bx end -->
        <?php query_posts("cat=$service_cat_id&meta_key=short_desc" );  ?>      
        <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>            
<div id="servc_sml_img"><?php echo get_post_meta($post->ID, 'short_img', true); ?></div>
<?php endwhile; ?>
<?php endif; ?>
</div> <!-- servc title bx end -->
<?php query_posts("cat=$service_cat_id&meta_key=short_desc" );  ?>      
        <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
        <div id="serv_descrip"><?php echo get_post_meta($post->ID, 'short_desc', true); ?></div>
        <?php endwhile; ?>
        <?php endif; ?>
        <div id="read_mre1"><a href="index.php/?page_id=53&catid=<?php echo $service_cat_id; ?>">Read More...</a></div>
        <div id="ser_btm_line"><img src="<?php bloginfo('template_directory'); ?>/images/srvice_line.jpg" width="439" height="42" />
        </div>
        </div>
        <?php } } ?>

    </div>

</div> <!-- service service bx end -->
<?php get_footer(); ?>

然后在每个模板页面上检查调用的类别并从该模板页面上的数据库中加载该类别。所以网址看起来像这样

http://www.drwagenberg.com/?page_id=101&catid=8

永久链接设置为此类型

post   http://www.drwagenberg.com/sample-post/

有什么简单的方法可以将地址栏中显示的网址设置为我想要的类型,例如

http://www.drwagenberg.com/services-procedures/periodontal-disease

以及我将如何为 SEO 优化做到这一点???

4

1 回答 1

0

设置 > 固定链接

使用自定义结构选项将其更改为您想要的格式。将以下代码复制并粘贴到那里,它将在您的网站上发生变化:

%category%/%postname%/
于 2013-09-04T07:35:29.170 回答