如何将wp_edit(富文本)添加到此自定义帖子?

时间:2013-10-21 19:20:29

标签: wordpress richtext

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

在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'
)

);

1 个答案:

答案 0 :(得分:0)

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

如果显示的是内容字段,而不是编辑器,则可能是您切换到源代码编辑器。它可以切换到这里: toggle HTML and CODE

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

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

希望它有所帮助。