Code to add template to page

locate_template function searches your current theme’s folder for template name(s). If your templates are in a root folder of your theme, use: $template = locate_template( ‘member-content-template.php’ ); otherwise, precede the name of a template with subfolder’s name ( no slash in front ): $template = locate_template( ‘templates/member-content-template.php’ ); To load a template ( if found … Read more

Plugin or Custom Page Type

First of all, keep it in your mind that WordPress convention says theme is only for presentation and plugin is for functionality. So that means if you need to initiate any functionality you should do that in plugin and when you represent the data visually in frontend you need to do it with theme. Now … Read more

How to pass a more variable with page/subpage in Wordprees URL?

function add_custom_query_var( $vars ){ $vars[] = “q”; return $vars; } add_filter( ‘query_vars’, ‘add_custom_query_var’ ); mydomain/how-we-work/our-process/?q=more-value You can handle it with get_query_var( ‘q’ ); Edit1: If you want to use with ‘SEO URL’ you need to add_rewrite_rule function add_rewrites(){ add_rewrite_rule( ‘^how-we-work/our-process/([^/]*)/?’, ‘index.php?pagename=how-we-work/our-process&q=$matches[2]’, ‘top’ ); } add_action( ‘init’, ‘add_rewrites’ );