午夜国产狂喷潮在线观看|国产AⅤ精品一区二区久久|中文字幕AV中文字幕|国产看片高清在线

    WordPress 內(nèi)容類型名稱重命名方法
    來源:易賢網(wǎng) 閱讀:943 次 日期:2014-09-03 09:28:19
    溫馨提示:易賢網(wǎng)小編為您整理了“WordPress 內(nèi)容類型名稱重命名方法”,方便廣大網(wǎng)友查閱!

    對dedecms了解的朋友們,想必對如何獲取上一篇、下一篇文章的標簽也是非常熟悉。dedecms獲取上一篇、下一篇文章的標簽分別為:{dede:prenext get='pre'/}、{dede:prenext get='next'}。

    在這個標簽里,并沒有設(shè)置上一篇、下一篇文章標題字數(shù)的功能,那么我們又該怎樣來實現(xiàn)這樣的功能呢?其實,dedecms系統(tǒng)這點也做得很好,考慮的也挺周到,這個是可以設(shè)置的。WordPress系統(tǒng)源于一個blog平臺,慢慢地發(fā)展到今天的這樣一個功能強大的cms系統(tǒng)!

    盡管如此,但是wordpress默認情況下文章頁英文叫post, page,有時候,我們開發(fā)的時候,也許并不想要這個菜單還是顯示著post,和page,也許你想要顯示為其它的名稱,比如“產(chǎn)品”,”聯(lián)系人”亦或是其它的名稱!

    當然我們可以自己寫一個post type,移除原來的文章類型,新建的的內(nèi)容類型可以自己命名,但是其實我們還有一個更好的方法對原來系統(tǒng)的內(nèi)容類型菜單名稱進行重命名:

    看下面的一個國外的高手的代碼:

    <?php

    function change_post_menu_label() {

    global $menu;

    global $submenu;

    $menu[5][0] = 'Contacts';

    $submenu['edit.php'][5][0] = 'Contacts';

    $submenu['edit.php'][10][0] = 'Add Contacts';

    $submenu['edit.php'][15][0] = 'Status'; // Change name for categories

    $submenu['edit.php'][16][0] = 'Labels'; // Change name for tags

    echo '';

    }

    function change_post_object_label() {

    global $wp_post_types;

    $labels = &$wp_post_types['post']->labels;

    $labels->name = 'Contacts';

    $labels->singular_name = 'Contact';

    $labels->add_new = 'Add Contact';

    $labels->add_new_item = 'Add Contact';

    $labels->edit_item = 'Edit Contacts';

    $labels->new_item = 'Contact';

    $labels->view_item = 'View Contact';

    $labels->search_items = 'Search Contacts';

    $labels->not_found = 'No Contacts found';

    $labels->not_found_in_trash = 'No Contacts found in Trash';

    }

    add_action( 'init', 'change_post_object_label' );

    add_action( 'admin_menu', 'change_post_menu_label' );

    To change the menu order, go with this:

    // CUSTOMIZE ADMIN MENU ORDER

    function custom_menu_order($menu_ord) {

    if (!$menu_ord) return true;

    return array(

    'index.php', // this represents the dashboard link

    'edit.php', //the posts tab

    'upload.php', // the media manager

    'edit.php?post_type=page', //the posts tab

    );

    }

    add_filter('custom_menu_order', 'custom_menu_order');

    add_filter('menu_order', 'custom_menu_order');

    ?>

    這一個代碼中就是把原來的文章post的菜單名“post”更改為Contact了!

    參考資料:http://wordpress.stackexchange.com/questions/9211/changing-admin-menu-labels

    dedecms設(shè)置上一篇、下一篇文章標題字數(shù)的方法:

    第一步:找到dedecms下“include/arc.archives.class.php”文件,用DW或記事本打開。

    第二步:查找 $this->PreNext['pre']="上一篇:{$preRow['title']}"; 在這一行上面加上 $preRow['title']=cn_substr($preRow['title'],30); ,30的意思就是30個字節(jié),也就是15個漢字。這個可以根據(jù)實際情況,自行設(shè)定。

    第三步:查找 $this->PreNext['next']="下一篇:{$nextRow['title']}"; 在這一行上面加上 $nextRow['title']=cn_substr($nextRow['title'],30); 。

    然后保存一下,至此,dedecms設(shè)置上一篇、下一篇文章標題字數(shù)的方法就完成了。怎么樣,簡單吧,如果你還在為這個犯愁,那就趕緊試試吧!

    更多信息請查看IT技術(shù)專欄

    更多信息請查看CMS教程
    易賢網(wǎng)手機網(wǎng)站地址:WordPress 內(nèi)容類型名稱重命名方法
    由于各方面情況的不斷調(diào)整與變化,易賢網(wǎng)提供的所有考試信息和咨詢回復僅供參考,敬請考生以權(quán)威部門公布的正式信息和咨詢?yōu)闇剩?/div>
    相關(guān)閱讀CMS教程

    2025國考·省考課程試聽報名

    • 報班類型
    • 姓名
    • 手機號
    • 驗證碼
    關(guān)于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡要咨詢 | 簡要咨詢須知 | 新媒體/短視頻平臺 | 手機站點 | 投訴建議
    工業(yè)和信息化部備案號:滇ICP備2023014141號-1 云南省教育廳備案號:云教ICP備0901021 滇公網(wǎng)安備53010202001879號 人力資源服務(wù)許可證:(云)人服證字(2023)第0102001523號
    聯(lián)系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢關(guān)注公眾號:hfpxwx
    咨詢QQ:1093837350(9:00—18:00)版權(quán)所有:易賢網(wǎng)