رفتن به مطلب

کد انتقال ویرایشگر اصلی وردپرس به قسمت چکیده مطالب


پست های پیشنهاد شده

سلام میتونید از این دوتا افزونه استفاده کنید

https://wordpress.org/plugins/rich-text-excerpts/
https://wordpress.org/plugins/advanced-post-excerpt/

یا از طریق اضافه کردن کد زیر به functions.php

unction tinymce_excerpt_js(){ ?>
<script type="text/javascript">
jQuery(document).ready( tinymce_excerpt );
function tinymce_excerpt() {
jQuery("#excerpt").addClass("mceEditor");
tinyMCE.execCommand("mceAddControl", false, "excerpt");
tinyMCE.onAddEditor.add(function(mgr,ed) {
if(ed.id=="excerpt"){
ed.settings.theme_advanced_buttons2 ="";
ed.settings.theme_advanced_buttons1 = "bold,italic,underline,seperator,justifyleft,justifycenter,justifyright,separator,link,unlink,seperator,pastetext,pasteword,removeformat,seperator,undo,redo,seperator,spellchecker,";
}
});
}
</script>
<?php }
add_action( ‘admin_head-post.php’, ‘tinymce_excerpt_js’);
add_action( ‘admin_head-post-new.php’, ‘tinymce_excerpt_js’);
function tinymce_css(){ ?>
<style type=’text/css’>
#postexcerpt .inside{margin:0;padding:0;background:#fff;}
#postexcerpt .inside p{padding:0px 0px 5px 10px;}
#postexcerpt #excerpteditorcontainer { border-style: solid; padding: 0; }
</style>
<?php }
add_action( ‘admin_head-post.php’, ‘tinymce_css’);
add_action( ‘admin_head-post-new.php’, ‘tinymce_css’);

function prepareExcerptForEdit($e){
return nl2br($e);
}
add_action( ‘excerpt_edit_pre’,’prepareExcerptForEdit’);

یا کد زیر به functions.php

add_action( 'add_meta_boxes', array ( 'T5_Richtext_Excerpt', 'switch_boxes' ) );

/**
 * Replaces the default excerpt editor with TinyMCE.
 */
class T5_Richtext_Excerpt
{
    /**
     * Replaces the meta boxes.
     *
     * @return void
     */
    public static function switch_boxes()
    {
        if ( ! post_type_supports( $GLOBALS['post']->post_type, 'excerpt' ) )
        {
            return;
        }

        remove_meta_box(
            'postexcerpt' // ID
        ,   ''            // Screen, empty to support all post types
        ,   'normal'      // Context
        );

        add_meta_box(
            'postexcerpt2'     // Reusing just 'postexcerpt' doesn't work.
        ,   __( 'Excerpt' )    // Title
        ,   array ( __CLASS__, 'show' ) // Display function
        ,   null              // Screen, we use all screens with meta boxes.
        ,   'normal'          // Context
        ,   'core'            // Priority
        );
    }

    /**
     * Output for the meta box.
     *
     * @param  object $post
     * @return void
     */
    public static function show( $post )
    {
    ?>
        <label class="screen-reader-text" for="excerpt"><?php
        _e( 'Excerpt' )
        ?></label>
        <?php
        // We use the default name, 'excerpt', so we don’t have to care about
        // saving, other filters etc.
        wp_editor(
            self::unescape( $post->post_excerpt ),
            'excerpt',
            array (
            'textarea_rows' => 15
        ,   'media_buttons' => FALSE
        ,   'teeny'         => TRUE
        ,   'tinymce'       => TRUE
            )
        );
    }

    /**
     * The excerpt is escaped usually. This breaks the HTML editor.
     *
     * @param  string $str
     * @return string
     */
    public static function unescape( $str )
    {
        return str_replace(
            array ( '&lt;', '&gt;', '&quot;', '&amp;', '&nbsp;', '&amp;nbsp;' )
        ,   array ( '<',    '>',    '"',      '&',     ' ', ' ' )
        ,   $str
        );
    }
}

 

یا استفاده از افزونه Advanced Custom Fields و ایجاد یک زمینه دلخواه به جای چکیده مطالب پیشفرض

https://wordpress.org/plugins/advanced-custom-fields/

 

  • پسندیدن 2
لینک به ارسال
در 10 دقیقه قبل، سجاد نصر گفته است :

واگربخوام کل ابزارهاش رو دراین قسمت داشته باشم +تعدادواژه ها چه باید کرد؟؟؟

از آخرین افزونه استفاده کنید یک زمینه جدید بسازید با محتویات دلخواه خودتون و به جای  چکیده پیشفرض وردپرس از اون استفاده کنید

ادیتور کامل + هر تعداد واژه ای که بخواید

https://wordpress.org/plugins/advanced-custom-fields/

 

لینک به ارسال
در در ۱۳۹۹/۴/۱۷ در 19:16، asadiy4n گفته است :

بسیار ساده و روان و با مثال توضیح داده برای کل فایلد ها نمونه استفاده گذاشتن

https://www.advancedcustomfields.com

سلام  دوست عزیز مشکلم با همون افزونه که در ابتدا معرفی کردید حل شد ممنونم از لطفتون یه سوال دیگه داشتم در همین راستا فردا میپرسم

لینک به ارسال

سوال

بنده با این کدی که درذیل مشاهده می کنید میتونم تعداد کاراکتر های نوسته شده رو بشمارم

function devme_excerpt_count_js(){
      echo '<script>jQuery(document).ready(function(){
jQuery("#postexcerpt .handlediv").after("<div style=\"position:absolute;top:0px;right:5px;color:#666;\"><small>طول خلاصه: </small><input type=\"text\" value=\"0\" maxlength=\"3\" size=\"3\" id=\"excerpt_counter\" readonly=\"\" style=\"background:#fff;\"> <small>کاراکتر</small></div>");
     jQuery("#excerpt_counter").val(jQuery("#excerpt").val().length);
     jQuery("#excerpt").keyup( function() {
     jQuery("#excerpt_counter").val(jQuery("#excerpt").val().length);
   });
});</script>';
}
add_action( 'admin_head-post.php', 'devme_excerpt_count_js');
add_action( 'admin_head-post-new.php', 'devme_excerpt_count_js');

 

Screenshot_2020-07-09 Edit Car ‹ نمایندگی ایران خودرو۲۰۷۳نصر — وردپرس.png

لینک به ارسال

لطفا برای ارسال دیدگاه وارد شوید

شما بعد از اینکه وارد حساب کاربری خود شدید می توانید دیدگاهی ارسال کنید



ورود به حساب کاربری
×
×
  • اضافه کردن...