on 21 September 18
- Consider the following code snippet. Briefly explain what changes it will achieve, who can and cannot view its effects, and at what URL WordPress will make it available.
'; echo 'This is a custom page
This will add a new menu item Custom Menu to the side menu of the WordPress dashboard. When you click on this menu item, WordPress will call the function ‘custom_menu_page_display’ and show a page titled Custom Menu, with the heading Hello World and a paragraph that reads This is a custom page.
With default settings and roles, admins can view it and all lower roles can’t. this menu item will only be visible to users who have the privilege to manage options or change settings from WordPress admin dashboard.
The admin custom page will be made available at this (relative) URL: ?page=custom-menu-slug.
2. How would you change all the occurrences of Hello into Good Morning in post/page contents, when viewed before 11AM?
In a plugin or in theme functions file, we must create a function that takes as input, changes it as needed, and returns it. This function must be added as a filter for the_content.
It’s important that we put a little effort to address some details: