CyberAleks
CyberAleks

Reputation: 1613

Widgeting with wordpress page editor

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?

Upvotes: 0

Views: 30

Answers (1)

Umer Shoukat
Umer Shoukat

Reputation: 290

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!

Upvotes: 1

Related Questions