Solution:1
I found out how to do this by myself. If anyone is in the same Situation, here is the solution to this. There is a function called get_page_by_path()
in wordpress which searches for your page based on the permalink
. I’m using this code in the Shortcode, which is included in the Visual Composer Header-Element and displayed in a subpage, to get the Page-ID from the site which includes the header and not the Header iteself (which is a posttype in wordpress too).
$pageId = get_page_by_path($_SERVER["REQUEST_URI"])->ID;