【问题标题】:Display Custom CSS and HTML instructions for posts Wordpress显示帖子的自定义 CSS 和 HTML 说明 Wordpress
【发布时间】:2011-10-16 20:55:03
【问题描述】:

我正在为一些人创建一个博客,他们将在我创建的 5 个不同的自定义帖子中将帖子放在他们的网站上。

由于某些类别要求用户在帖子数据中注明项目符号(因此创建 ul>li ),因此请确保其在网站上显示时样式正确。

为了确保网站的编辑正确地将数据输入到帖子管理区域,我也希望这样做。

  1. 在新建/编辑帖子屏幕的右侧显示一张图片,其中包含有关如何创建自定义帖子的说明。

或/和

  1. 有带水印的输入表单(例如“在此处插入标题”的位置),以举例说明数据的显示方式。

我正在使用插件更多字段来显示我的输入字段。这有插入 HTML 的选项,我在其中放置图像和代码方面取得了不同程度的成功,因为它是否有效似乎是零星的!

非常感谢任何帮助。

【问题讨论】:

    标签: wordpress post admin customization


    【解决方案1】:

    如果我理解正确,custom meta box 可以解决这个问题。

    add_action( 'add_meta_boxes', 'wpse_54822_add_custom_box' );
    
    function wpse_54822_add_custom_box() 
    {
        $post_types = array( 'post', 'movies', 'testimonial' );
    
        foreach( $post_types as $box )
        {
            add_meta_box(
                'wpse_54822_sectionid',
                __( 'Instructions' ), 
                'wpse_54822_inner_custom_box',
                $box,
                'side'
            );
        }
    }
    
    
    function wpse_54822_inner_custom_box() 
    {
        ?><pre>
    &lt;b&gt;This text is bold&lt;/b&gt;
    &lt;strong&gt;This text is strong&lt;/strong&gt;
    &lt;i&gt;This text is italic&lt;/i&gt;
    &lt;em&gt;This text is emphasized&lt;/em&gt;
    &lt;code&gt;This is computer output&lt;/code&gt;</pre>
        <?php
    }
    

    结果:


    其他可能性可能是插入自定义Help Tab

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-12-29
      • 2019-04-15
      • 2015-09-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多