-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathheader.php
45 lines (40 loc) · 1.11 KB
/
header.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
ob_start();
add_filter( 'et_html_logo_container', function( $html ){
$search = '</div>';
$pos = strrpos( $html, $search );
if( $pos !== false ){
ob_start();
dynamic_sidebar('logo-right');
$updated = ob_get_clean().'</div>';
$html = substr_replace($html, $updated, $pos, strlen($search) );
}
return $html;
});
include get_template_directory().'/header.php';
$header = ob_get_clean();
$svg = file_get_contents( get_stylesheet_directory().'/src/svg/logo-helvetica.svg' );
/*
// lets replace the logo with the svg
$header = preg_replace_callback('#<img[^>]+?id="logo"[^>]*?/>#', function($matches) use ($svg){
$imgElement = new SimpleXMLElement( $matches[0] );
$svgElement = new SimpleXMLElement( $svg );
foreach( $imgElement[0]->attributes() as $k => $v ){
// if( $k !== 'src' ){
// $svgElement->addAttribute($k, (string)$v);
// }
// else {
// $attrs = $svgElement->attributes();
//
// if( isset($attrs[$k]) ){
// $svgElement[$k] = $v;
// }
// else {
// $svgElement->addAttribute($k, '#logo-helvetica.svg');
// }
// }
}
return $svgElement->asXML();
}, $header);
*/
echo $header;