Use a template file for a specific url without creating a page

You can just look at url, load the file and exit. That can be done when WordPress loaded its environment, e.g. on ‘init’. add_action(‘init’, function() { $url_path = trim(parse_url(add_query_arg(array()), PHP_URL_PATH), “https://wordpress.stackexchange.com/”); if ( $url_path === ‘retail’ ) { // load the file if exists $load = locate_template(‘template-retail.php’, true); if ($load) { exit(); // just exit … Read more

Mixing custom post type and taxonomy rewrite structures?

You can always override the template that will be called with the template_include or a related filter, but this might hide deeper problems with custom archives. As I understand it, you want to use the following structure: /glossary/ should be an archive page for all sumo-glossary-term posts /glossary/[letter]/ should be an archive page for posts … Read more

Custom Post Type URL Rewriting?

When you register the custom post type, you have to specify that the rewrite rule shouldn’t be prepended with the existing URL structure. In short, this means that this line in your register_post_type call: ‘rewrite’ => array(‘slug’ => ‘projects’), should turn into this: ‘rewrite’ => array(‘slug’ => ‘projects’,’with_front’ => false), For more info, check out … Read more

Need help with add_rewrite_rule

Some background on rewrite rules The WP Rewrite system looks complicated, but in fact it’s not that hard to understand how it works. It is used to parse pretty URLs (/designers/) as if they were non-pretty (/index.php?pagename=designers). The basic idea is that you have a list of rewrite rules, regular expressions that can match the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)