• shadd

    (@shadd)


    Hi Guys

    Is it possible to get a page url by specifying the name of the page ? So if I have a page called courses, I just do somethng like get_page(‘courses’) and it’ll load the URL. Is this possible in WP ?

Viewing 7 replies - 1 through 7 (of 7 total)
  • yes, it’s called permalinks.

    https://your.site.tld/courses

    (if that’s what you mean).

    Peter

    Thread Starter shadd

    (@shadd)

    Thanks, that worked a charm. I have another dilemma now: mysite.com/courses/ will load the courses page – If the user specifies mysite.com/courses/1 (1 being the post id) it should load a page displaying just that post. How can I do this ?

    courses is a category?

    Peter

    Thread Starter shadd

    (@shadd)

    Its a page ??

    Are those individual courses pages as well?

    In that case you should create them as sub pages of the courses page.

    Look for an example here: https://www.boosten.org/books and then click one of the books and watch the url.

    Peter

    Thread Starter shadd

    (@shadd)

    Courses page displays all courses. courses/1 will display the first course as noted on the link you provided. I dont know how to do that though. The closest I came to it was to create another page called course and then sub it under Courses and use that to process single course requests. The url turns out to be:
    mysite.com/courses/course/1

    Do you know of any way I can get rid of the ‘course’ and just keep it as courses/1 ?

    change the slug of that page to 1.

    Peter

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Getting pages by name’ is closed to new replies.