One post cannot (and should not) have two single post URLs. All you can change is the archive view, the list of posts.
If /gallery/
and /extra/
are post of the post type page
, use a custom page template for those.
Update
Create two endpoints gallery
and extra
for the root (EP_ROOT
) (another example). The callback function for those endpoints the has two options:
- If the endpoint variable value is
TRUE
(/gallery/
was called without a post name), render an archive listing. - If there is a string value, use
get_page_by_path()
and fetch the post object. Render it.
Example for get_page_by_path()
:
$post = get_page_by_path(
get_query_var( 'gallery' ),
OBJECT,
'post'
);