wordpress二次开发全能教程

1,根据分类来制定导航条

A. 修改页面header.php!

<div id="main-nav" class="col span-12">
   <ul>
    <?php wp_list_pages('&title_li='); ?>
    <?php wp_list_categories('title_li='); ?> //增加这一行
   </ul>
</div>

 

 B. 修改style.css,增加下面一行语句

#main-nav li.cat-item
{
 margin-right: 2.2em;  float: left;

} 

2,删除控制面板多余版块

A. 删除开发日志面板,在wp-admin\includes\dashboard.php注释掉下面几句代码。

 // Primary feed (Dev Blog) Widget
    if ( !isset( $widget_options['dashboard_primary'] ) ) {      $update = true;
   $widget_options['dashboard_primary'] = array(    'link' => apply_filters( 'dashboard_primary_link', __( 'http://wordpress.org/development/' ) ),    'url' => apply_filters( 'dashboard_primary_feed', __( 'http://wordpress.org/development/feed/' ) ),    'title' => apply_filters( 'dashboard_primary_title', __( 'WordPress Development Blog' ) ),    'items' => 2,    'show_summary' => 1,    'show_author' => 0,    'show_date' => 1   );
  }  wp_add_dashboard_widget( 'dashboard_primary', $widget_options['dashboard_primary']['title'], 'wp_dashboard_primary', 'wp_dashboard_primary_control' ); 

B. 删除相关新闻,在wp-admin\includes\dashboard.php注释掉下面几句代码。

  if ( !isset( $widget_options['dashboard_secondary'] ) ) {   $update = true;   $widget_options['dashboard_secondary'] = array(    'link' => apply_filters( 'dashboard_secondary_link', __( 'http://planet.wordpress.org/' ) ),    'url' => apply_filters( 'dashboard_secondary_feed', __( 'http://planet.wordpress.org/feed/' ) ),    'title' => apply_filters( 'dashboard_secondary_title', __( 'Other WordPress News' ) ),    'items' => 5   );  }  wp_add_dashboard_widget( 'dashboard_secondary', $widget_options['dashboard_secondary']['title'], 'wp_dashboard_secondary', 'wp_dashboard_secondary_control' ); 

 

C. 删除相关插件

 if ( current_user_can( 'activate_plugins' ) )   wp_add_dashboard_widget( 'dashboard_plugins', __( 'Plugins' ), 'wp_dashboard_plugins' ); 

 

 D. 删除引用链接 

 // Incoming Links Widget

  if ( !isset( $widget_options['dashboard_incoming_links'] ) || !isset( $widget_options['dashboard_incoming_links']['home'] ) || $widget_options['dashboard_incoming_links']['home'] != get_option('home') ) {   $update = true;   $widget_options['dashboard_incoming_links'] = array(    'home' => get_option('home'),    'link' => apply_filters( 'dashboard_incoming_links_link', 'http://blogsearch.google.com/blogsearch?hl=en&scoring=d&partner=wordpress&q=link:' . trailingslashit( get_option('home') ) ),    'url' => apply_filters( 'dashboard_incoming_links_feed', 'http://blogsearch.google.com/blogsearch_feeds?hl=en&scoring=d&ie=utf-8&num=10&output=rss&partner=wordpress&q=link:' . trailingslashit( get_option('home') ) ),   'items' => isset($widget_options['dashboard_incoming_links']['items']) ? $widget_options['dashboard_incoming_links']['items'] : 10,    'show_date' => isset($widget_options['dashboard_incoming_links']['show_date']) ? $widget_options['dashboard_incoming_links']['show_date'] : false   );  } wp_add_dashboard_widget( 'dashboard_incoming_links', __( 'Incoming Links' ), 'wp_dashboard_incoming_links', 'wp_dashboard_incoming_links_control' );

 

 E. 删除“更新到新版本

” update_right_now_message(); //287

3,显示所有最新文章

<?php  $postslist = get_posts('numberposts=10&order=ASC&orderby=title');  foreach ($postslist as $post) :      setup_postdata($post);  ?>   <div>  <?php the_date(); ?>  <br />  <?php the_title(); ?>     <?php the_excerpt(); ?>  </div>  <?php endforeach; ?>

4,发布文章时对文章进行操作

<?php functionfilter_handler($data,$postarr)
 { 
     //dosomethingwiththepostdata
       return$data;
 } 
 add_filter('wp_insert_post_data','filter_handler','99');
 ?>

 

 

 

转载于:https://www.cnblogs.com/munboo/archive/2013/03/10/2952786.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值