admin管理员组

文章数量:1432213

I'm looking for how to code custom "special" page as use many plugins. An idea is that I have in theme links to the custom special page. Then admin can chose which of his pages is the one "special" page.

The functionality I'm looking for is similar as functionality of for example "Shop page" in woocommerce.

I appreciate any help or a documentation link.

I'm looking for how to code custom "special" page as use many plugins. An idea is that I have in theme links to the custom special page. Then admin can chose which of his pages is the one "special" page.

The functionality I'm looking for is similar as functionality of for example "Shop page" in woocommerce.

I appreciate any help or a documentation link.

Share Improve this question asked Apr 27, 2019 at 9:47 Tomáš VavřinkaTomáš Vavřinka 1979 bronze badges 1
  • Possible duplicate of How to create a Page alias in WordPress – Jacob Peattie Commented Apr 29, 2019 at 7:33
Add a comment  | 

1 Answer 1

Reset to default 1

Because you asked "How to Code", here is my guide to get you started.

  1. Create a menu page in the administration area using add_menu_page
  2. Create the form using html select form-element
  3. Populate the form-element with all pages. To get all pages you can use get_posts()
  4. Save the form using admin_post action
  5. Save the selected-item of the form using update_option()
  6. To get the saved option you can use get_option()
  7. To add that — Special Text in the page list, you need to filter the title. If the page's ID is equal to the saved_setting, then append that text. I'm not sure which hook to use, I think it is manage_pages_columns

I hope it helps.

本文标签: theme developmentHow to code custom special page