Add extra optional text to permalink e.g. “-with-*”

Yes, you sure can manipulate the URL. From what you are describing it seems rather pointless, though.

The simplest approach to do what you are asking, or seemingly getting at, is to use a switch case in the header.php

If you really need control of the switch case you can feed it theme option data or post/page metadata.

PHP Simplified version

switch (n)
{
case label1:
  code to be executed if n=label1;
  break;
case label2:
  code to be executed if n=label2;
  break;
default:
  code to be executed if n is different from both label1 and label2;
} 

Or you can see a more advanced version I wrote a tutorial on using sample wordpress functions at

unrelatedmedia.ca

Which should tell you how you can integrate queries into your switch statement easily.

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