Tagged: x
-
AuthorPosts
-
April 7, 2016 at 6:07 pm #872041
I would like to be able to use HTML tags in my site’s name.
By default, if I use HTML tags in default WordPress site name and description fields these tags will not be rendered, but rather will be spelled out in the header of the web page.
I am no programmer, but if i go to /wp-content/themes/x/framework/views/global/_brand.php and modify two variables with “html_entity_decode” HTML tags will render fine.
Basically, I replace the following lines:
$site_name = get_bloginfo( 'name' ); $site_description = get_bloginfo( 'description' );
with these:
$site_name = html_entity_decode(get_bloginfo( 'name' )); $site_description = html_entity_decode(get_bloginfo( 'description' ));
Now, I can create the same _brand.php in my child theme directory: /wp-content/themes/x-child/framework/views/global/_brand.php and it will overwrite the original file in X-theme, but is there a better way to somehow overwrite only variables I need in the child theme without overwriting the entire file? It seems that overwriting the entire file is wrong, as no updates you make to this file in the main theme will propagate to the child theme.
What is the proper way of doing this?
Second question. When I do manipulations above I can use HTML tags in my site title and descriptions (in the visible header of the page) fine, but the actual title tag (<title>…</title>) of the document now spells HTML tags. Where do I go to strip HTML tags from the <title> tag?
Thank you.
April 8, 2016 at 6:43 am #872663Hi There,
Thanks for posting in.
Your steps to customize is correct. In case there’s an update, it is noted in our changelog. If that specific file was updated on the main x theme, you have to use the updated file and then apply your cuztomization again. Unfortunately, there’s no way of just updating that specific variable or line of code only.For the title tag, please check this file:wp-content\themes\x\framework\functions\global\meta.php. You may copy the same file to the same folder on the child theme or you may just copy the code under this :Filter <title> Output to your child theme’s functions.php file then update it.
Hope this helps.
April 8, 2016 at 9:22 am #872898Thank you for confirmation on the first question.
Could you also share code we would have to add to our child theme’s functions.php to have HTML tags stripped from these two items in wp-content\themes\x\framework\functions\global\meta.php?
return get_bloginfo( 'name' ) . ' | ' . get_bloginfo( 'description' );
April 8, 2016 at 11:48 pm #873731Hi there,
I’m not sure if I understand the second question correctly, but please try adding this to your child theme’s functions.php
add_filter ('wp_title', 'wp_title_strip_tags', 9999, 2 ); function wp_title_strip_tags ( $current_title, $sep ) { return strip_tags ( //Let's make sure that tags are converted back to HTML tags, else, strip_tags won't able to remove them html_entity_decode ( $current_title ) ); }
And please provide your site’s URL that has this issue.
Thanks!
-
AuthorPosts