WordPress custom post type permalink: website.com/post-name/post-id

product/([0-9]+)?$ translates to product/ followed by any number or nothing (and nothing more, not even a trailing slash). This doesn’t sound like the thing you want to achieve. Instead, try the following function wpse33551_rewrites_init(){ add_rewrite_rule( ‘^([^/]+)/([0-9]+)/?$’, ‘index.php?post_type=artikelen&p=$matches[2]’, ‘top’ ); } which translates to: ^ start of the string (ie, there is nothing else in front) … Read more

How to load a template-part based on a url wildcard?

I ended up with this solution in functions.php, thanks to the offical WordPress documentation at: https://codex.wordpress.org/Rewrite_API/add_rewrite_rule First added a custom rewrite rule like so: function custom_rewrite_rule() { add_rewrite_rule( ‘^agenda/([^/]*)/([^/]*)/?’, ‘index.php?page_id=10&agenda_id=$matches[1]&agenda_name=$matches[2]’, ‘top’ ); } add_action( ‘init’, ‘custom_rewrite_rule’, 10, 0 ); Then this needed to be added: function prefix_register_query_var( $vars ) { $vars[] = ‘agenda_id’; $vars[] = … Read more

How to add Bootstrap Tour JavaScript to WordPress Admin Panel Dashboard Widget

Step-1 → Download: Download the necessary CSS / JS files for Bootstrap Tour in your theme’s directory. Step-2 → Tour setup script: Follow the instructions from bootstraptour for the Tour setup script. For example, the following script will load the Tour on the main WordPress Admin Panel Dashboard (on page load) and show the tour … Read more

How to add new args data in $wp_customize->add_setting?

This might be what you are looking for $args = array( ‘default’ => ‘#e9ecef’, ‘capability’ => ‘edit_theme_options’, ); if ( something() ) { $args[‘output’] = array( array( ‘element’ => ‘body’, ‘property’ => ‘background-color’, ), ); } $wp_customize->add_setting( ‘modular_header_main_border_bottom_color’, $args ); We are first creating an array for arguments. Later we are pushing a key value … Read more