start at the begin, step by step
#1 - i start with a fresh wb 2.11, all filters activated, but not OpF, JQueryUI, these are the defaults after a new install
#2 - add some pages, BG and EN with type "menu-link", Home-BG and Home-EN with type "wysiwyg" (only to try it). Be sure, that every page has the correct language. Every Subpage (Child) of an Mainpage like BG or EN must have the language from this Parent-Page. it's recommended, to start with the main language and adding there all needed subpages / child for this tree-part
Example-tree here ->
https://i.gyazo.com/cc254a6f014b0b44d3911e0e3e282776.png#3 - the page code
if you have the exact page structure in all language-tree's (here under BG or under EN), WB set the pagescodes automatically, if you click in one page on the pagesettings on the link "pagecode". it is very important, that every page has the correct page code. otherwhise, you get a error, when you switch the pages or you get a redirect to the main-page.
#4 - the code for the index.php
i add your template to my installation (in a fresh WB 2.11). The code is a exact copy from the example in DefaultTemplate (WB-Package) - it works without problems and i can switch the languages from page to page
1. your code to prevent this file for directly access (outside from WB)if (!defined('WB_PATH')) die(header('Location: ../../index.php'));Redirect's to a higher level with a relative path like this example (with
../) is a security risk. its possible, to manipulate links like this. it is possible, to come with a manipulated link out of this wb-installation and directly into the server document root or more
WB use since WB 2.10 an prevention like this without a redirect
/* -------------------------------------------------------- */
// Must include code to stop this file being accessed directly
if (!defined('SYSTEM_RUN')) {header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found'); echo '404 File not found'; flush(); exit;}
/* -------------------------------------------------------- */2. - read the actual language of the selected page$sPageLang = strtolower(isset($wb->page) || ($wb instanceof frontend) ? $wb->page['language'] : 'EN');means in simple words: if it's not possible to read the page language, set it to EN (english - if you dont have a english page in this project, change the code to your main language - in your case maybe the favorite Language BG. Write this Language-code in upper Letter. if you not sure about the correct language code, take a look into the favorite language file in folder /languages
3. read the actual page-id$iPageId = (defined('PAGE_ID') ? PAGE_ID : 0);it's important to use the the flag menu
4. the flag menu - controler $iMultiLang = 0;$sMultiLang = ''; if (function_exists('language_menu')){$sMultiLang = language_menu('png',false); $iMultiLang = intval(!empty($sMultiLang) ? 1 : 0);} check, if it possible to use the function, result set this switch to true or false
language_menu('
png',false) - possible file type's gif, png, svg
5. build href-lang links (optional)
the follow code is only needed, if you want the href-links. if you use this, be sure, that this code in placed behind the open <head> and the closing </head>
if (!function_exists('LangPadeId')) {function LangPadeId(){return $iPageId;}}
if (function_exists('LangPadeId')&&$iMultiLang) {
?>
<!--
<link rel="alternate" hreflang="x-default" href="[wblink<?php echo LangPadeId($sPageLang);?>]" />
<link rel="alternate" hreflang="de" href="[wblink<?php echo LangPadeId('DE');?>]" />
<link rel="alternate" hreflang="en" href="[wblink<?php echo LangPadeId('EN');?>]" />
-->
<?php
}
?>
#6 - the flag menu - somewhere between open <body> and closing </body>the div-block around is only a example, important is the php-code there
<div id="lang" style="height: 2.925em;">
<?php if(trim($sMultiLang)!=''){ ?>
<?php echo $sMultiLang; ?>
<?php } ?>
</div>#7 - working without filtersif your project dont use any filters, specially without FrontendCSS, FrontendJS, RegisterModFiles, SnippetJS, you have to include the file /modules/WbLingual/include.php manually. (and also every other include file from other snippets)
You didn't understand me dbs, when I put the codes from the default template the page crash (that's why I removed them and you didn't saw them) ... the menu disappear and only one word stay somewhere behind the logo ... and the EN language doesn't work properly.
for example - if i remove the engine of your car, you cannot drive. And if you add the engine again and it doesnt run and because ot this, you remove it again, the car will not drive - you understand?

Step #1 - #4 are only some hints, very important are #2 and #3
from the points 1 - 7, you can remove No.5, if not needed, but all other things are neccessary. every little step is important, it's like a car - if i forgot to add the fuel, the car will not drive, if i forget to add the battery, the car will not drive e.g.
P.S. go to your advanced wb-settings - server settings, set PHP-Errors to production or development for the time, where you work on it, so you get some more informations about possible errors in your error log
if you get more problem's, give us also the used PHP-version - see info-Window here ->