0

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.

enter image description here

enter image description here

I appreciate any help or a documentation link.

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.

  • Thank you for your answer. Your solution could work! Do you also know how to mark such page among others as on my second attached image? – Tomáš Vavřinka Apr 27 at 10:37
  • You need to create a filter for the title in Pages-list. And if the column ID is equal the setting, you append that — Special Text) in the title. I haven't tried this, but I think this is the hook codex.wordpress.org/Plugin_API/Filter_Reference/… – hamdirizal Apr 27 at 10:52
  • Ok, I'll do so. Thank you for your help. – Tomáš Vavřinka Apr 27 at 11:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.