1

我正在开发一个名为 Tesla 的免费模板。它有一个不错的投资组合自定义帖子,但它不允许您以丰富的形式编辑文本。我的客户正在寻找一个富文本编辑器并且模板适合它的需要,但他不想手动添加中断、粗体等。

它在声明文本的 teslawp_porftolio 中,如何打开 wp_edit?或者,有没有其他方法可以添加富文本?

<?php

return array(

'teslawp_main' => array(
    'name' => 'Main Slider',
    'term' => 'slide',
    'term_plural' => 'slides',
    'order' => 'ASC',
    'options' => array(
        'description' => array(
            'type' => 'text', 
            'description' => 'Enter description of the slide',
            'title' => 'Description',
        ),
        'image' => array(
            'type' => 'image',
            'description' => 'Image of the slide',
            'title' => 'Image',
            'default' => 'holder.js/960x407/auto'
        ),
        'url' => array(
            'type' => 'line',
            'description' => '(Optional) URL applied to the title',
            'title' => 'URL',
            'default' => ''
        )
    ),
    'output_default' => 'main',
    'output' => array(
        'main' => array(
            'shortcode' => 'tesla_main_slider',
            'view' => 'views/main_slider_view',
            'shortcode_defaults' => array(
                'style' => '',
                'speed' => 4,
                'pause' => 8,
                'toggle_caption' => true
            )
        )
    ),
    'icon' => '../images/favicon.png'
),
'teslawp_clients' => array(
    'name' => 'Clients Slider',
    'term' => 'slide',
    'term_plural' => 'slides',
    'order' => 'ASC',
    'options' => array(
        'image' => array(
            'type' => 'image',
            'description' => 'Image of the slide',
            'title' => 'Image',
            'default' => 'holder.js/144x65/auto'
        ),
        'url' => array(
            'type' => 'line',
            'description' => '(Optional) URL for the image',
            'title' => 'URL',
            'default' => ''
        )
    ),
    'output_default' => 'main',
    'output' => array(
        'main' => array(
            'shortcode' => 'tesla_clients_slider',
            'view' => 'views/clients_slider_view',
            'shortcode_defaults' => array(
                'title' => __('our clients','teslawp'),
                'style' => 'style'
            )
        )
    ),
    'icon' => '../images/favicon.png'
),
'teslawp_secondary' => array(
    'name' => 'Secondary Slider',
    'term' => 'slide',
    'term_plural' => 'slides',
    'order' => 'ASC',
    'options' => array(
        'image' => array(
            'type' => 'image',
            'description' => 'Image of the slide',
            'title' => 'Image',
            'default' => 'holder.js/682x330/auto'
        )
    ),
    'output_default' => 'main',
    'output' => array(
        'main' => array(
            'shortcode' => 'tesla_secondary_slider',
            'view' => 'views/secondary_slider_view',
            'shortcode_defaults' => array(
                'style' => '',
                'speed' => 4,
                'pause' => 8
            )
        )
    ),
    'icon' => '../images/favicon.png'
),

'teslawp_portfolio' => array(
    'name' => 'Portfolio',
    'term' => 'portfolio item',
    'term_plural' => 'portfolio items',
    'has_single' => true,
    'order' => 'DESC',
    'options' => array(
        'small_description' => array(
            'type' => 'text',
            'description' => 'Breve descripción (mostrada en el home)',
            'title' => 'Breve descripción (mostrada en el home)',
        ),

        'full_description' => array(
            'type' => 'text',
            'description' => 'Objetivo del programa (mostrado en la página del programa). Favor de usar HTML.',
            'title' => 'Objetivo del programa (mostrado en la página del programa). Favor de usar HTML.',
        ),
        'small_image' => array(
            'type' => 'image',
            'description' => 'Imagen de 240x240px que se mostrará en el home.',
            'title' => 'Imagen de 240x240px que se mostrará en el home.',
            'default' => 'holder.js/240x240/auto'
        ),

        'informacion' => array(
            'type' => 'text',
            'description' => 'Información completa del programa. Favor de usar HTML.',
            'title' => 'Información completa del programa. Favor de usar HTML.',
        ),

        'image_slider' => array(
            'type' => 'image',
            'description' => 'Slider dentro de la página del programa.',
            'title' => 'Slider dentro de la página del programa.',
            'default' => 'holder.js/627x330/auto',
            'multiple' => true
        ),
        'categories' => array(
            'type' => 'line',
            'description' => 'Fecha en la que se realizará el curso.',
            'title' => 'Fecha en la que se realizará el curso.',
            'default' => ''
        ),
        'skills' => array(
            'type' => 'line',
            'description' => 'Precio del curso.',
            'title' => 'Precio del curso.',
            'default' => ''

        )
    ),
    'output_default' => 'main',
    'output' => array(
        'main' => array(
            'shortcode' => 'tesla_portfolio',
            'view' => 'views/portfolio_view',
            'shortcode_defaults' => array(
                'no_more' => false
            )
        ),
        'single' => array(
            'view' => 'views/portfolio_single_view',
            'shortcode_defaults' => array(
                'style' => '',
                'speed' => 4,
                'pause' => 8
            )
        )
    ),
    'icon' => '../images/favicon.png'
),
'teslawp_testimonial' => array(
    'name' => 'Testimonials',
    'term' => 'testimonial',
    'term_plural' => 'testimonials',
    'order' => 'ASC',
    'options' => array(
        'testimonial' => array(
            'type' => 'text',
            'description' => 'Enter text of the testimonial',
            'title' => 'Testimonial',
        ),
        'image' => array(
            'type' => 'image',
            'description' => 'Author\'s image',
            'title' => 'Author\' Image',
            'default' => 'holder.js/126x126/auto'
        ),
        'author' => array(
            'type' => 'line',
            'description' => 'Author of the testimonial (Ex. John Doe)',
            'title' => 'Author\'s Name',
            'default' => ''
        ),
        'url' => array(
            'type' => 'line',
            'description' => '(Optional) url to the author\'s page',
            'title' => 'Author\'s Url',
            'default' => ''
        )
    ),
    'output_default' => 'main',
    'output' => array(
        'main' => array(
            'shortcode' => 'tesla_testimonial',
            'view' => 'views/testimonial_view',
            'shortcode_defaults' => array(
                'wide' => true,
                'class' => '',
                'speed' => 4,
                'pause' => 8
            )
        )
    ),
    'icon' => '../images/favicon.png'
)

);

4

1 回答 1

0

因此,要显示富编辑器的帖子类型,您只需在帖子类型中添加帖子内容字段('editor')属性。

如果显示内容字段,但没有显示编辑器,则可能您切换到源代码编辑器。可以在这里切换: 切换 HTML 和 CODE

但是,如果帖子类型显示没有文本区域,那么您需要修改帖子类型。在这种情况下,它将是:

add_post_type_support( 'post_type_name', array('editor') )

希望能帮助到你。

于 2013-10-22T00:20:45.637 回答