Tuesday, August 23, 2022
HomeWordPress Developmentphp - Customized put up kind web page with parameter

php – Customized put up kind web page with parameter


I am constructing an academic web site with WordPress and Elementor Professional. I programmed a plugin that programmatically creates a customized put up kind.

public static operate new_cpt_course() {

        $cap_type="course";
        $plural="Programs";
        $single="Course";
        $cpt_name="course";

        $opts['can_export']                         = TRUE;
        $opts['capability_type']                        = $cap_type;
        $opts['description']                            = '';
        $opts['exclude_from_search']                        = FALSE;
        $opts['has_archive']                            = FALSE;
        $opts['hierarchical']                           = FALSE;
        $opts['map_meta_cap']                           = TRUE;
        $opts['menu_icon']                              = 'dashicons-groups';
        $opts['menu_position']                          = 25;
        $opts['public']                             = TRUE;
        $opts['publicly_querable']                      = TRUE;
        $opts['query_var']                          = TRUE;
        $opts['register_meta_box_cb']                       = '';
        $opts['rewrite']                                = TRUE;
        $opts['show_in_admin_bar']                      = FALSE;
        $opts['show_in_menu']                           = FALSE;
        $opts['show_in_nav_menu']                       = FALSE;
        $opts['show_ui']                                = FALSE;
        $opts['supports']                               = array( 'title', 'editor', 'thumbnail' );
        $opts['taxonomies']                         = array();

        $opts['rewrite']                                = array();
        $opts['rewrite']['ep_mask']                     = EP_PERMALINK;
        $opts['rewrite']['feeds']                       = FALSE;
        $opts['rewrite']['pages']                       = TRUE;
        $opts['rewrite']['slug']                        = esc_html__( strtolower( 'course' ), 'my-courses' );
        $opts['rewrite']['with_front']                  = FALSE;

        $opts = apply_filters( 'courses-cpt-options', $opts );

        register_post_type( strtolower( $cpt_name ), $opts );

    } // new_cpt_course()

My query is, is there a option to make my plugin serve all urls that time to this practice put up kind?

http://www.instance.com/course/
this deal with is plugin url and it really works high-quality

http://www.instance.com/course/123456
123456 is the id of a sure course and may present the course with id 123456 however as an alternative it returns 404

Any concepts how you can get ID passing within the url and dealing with within the plugin working?

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments