dongpengqin3898 2016-05-13 08:00
浏览 36
已采纳

Wileting with wordpress页面编辑器

Is there some way to create a widget or placeholder for some content that should be only shown if i use some special tag in page editor? For example: I have a special menu, that i want to define with page editor, but it should be shown outside of page content.

enter image description here

So if i write in editor something like this, it should put this in my optional menu:

[menu]
   <ul>
      <li><a>Menu Item 1</a></li>
      <li><a>Menu Item 1</a></li>
   </ul>
[/menu]
<div>
    Some content for my page
</div>

Is there some pugins or tricks or some filters etc. in wordpress for this?

  • 写回答

1条回答 默认 最新

  • dpbdl44228 2016-05-13 08:12
    关注

    If it's just like a menu then go to function.php file and register a menu with you specific name like this.

    register_nav_menu( 'your-menu', __( 'Your Menu', 'theme-slug' ) );
    

    and then show that menu conditionally on inside your div.

    <?php if($var==1) : ?>
    <div>
    wp_nav_menu(array());
    </div>
    <?php endif; ?>
    

    and if you have some different content then register custom fields for pages and show output those fields with conditional statement. hope it make sense to you. Cheers!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 请看一下,学校实验要求,我需要具体代码
  • ¥50 pc微信3.6.0.18不能登陆 有偿解决问题
  • ¥20 MATLAB绘制两隐函数曲面的交线
  • ¥15 求TYPCE母转母转接头24PIN线路板图
  • ¥100 国外网络搭建,有偿交流
  • ¥15 高价求中通快递查询接口
  • ¥15 解决一个加好友限制问题 或者有好的方案
  • ¥15 急matlab编程仿真二阶震荡系统
  • ¥20 TEC-9的数据通路实验
  • ¥15 ue5 .3之前好好的现在只要是激活关卡就会崩溃