As we know, if the domain name is www.cheapglasses123.com, the default post url after you have installed the wordpress is:
Here are three parts:
www.cheapglasses123.com: domain name;
glasses: wordpress category name;
women-eyeglasses: post last part url.
How to get them seperately then?
Get the full part from url:
<?php echo home_url( $wp->request );?>
Get category part from url:
<?php echo dirname(home_url( $wp->request ));?>
Get the post last part from its url: