Listing
controller contains all the routes and actions related to listings (e.g. viewing, creating, updating and deleting).class-{extension-name}.php
file (use lowercase letters, numbers, and hyphens only) in the includes/controllers
extension subdirectory and HivePress will load it automatically.Foo_Bar
class for the class-foo-bar.php
file). Pick a name that is unique enough to avoid conflicts with other HivePress controllers.listing_edit_page
route checks if you have permission to edit this listing (or redirects you otherwise) and then renders the page template.path
from;/custom-route
URL that checks if the current user is logged in and, if so, redirects to the account page. If not, it renders the login page template.listing_update_action
route, updating the listing based on the field values.path
from;GET
, POST
);/wp-json/hivepress/v1/custom-route
URL, accepts requests via the POST
method and calls the custom_action
function.hivepress/v1/routes
filter hook. For example, the code below changes the Add Listing page URL: