<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>
	Comments on: Using the WordPress bloginfo filter to add HTML markup	</title>
	<atom:link href="https://www.alexgeorgiou.gr/use-wordpress-bloginfo-filter-add-html-markup/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.alexgeorgiou.gr/use-wordpress-bloginfo-filter-add-html-markup/</link>
	<description>Balancing brackets for a living</description>
	<lastBuildDate>Wed, 03 Aug 2022 07:03:25 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>
		By: Filter the blog&#039;s title without using global variables		</title>
		<link>https://www.alexgeorgiou.gr/use-wordpress-bloginfo-filter-add-html-markup/#comment-19578</link>

		<dc:creator><![CDATA[Filter the blog&#039;s title without using global variables]]></dc:creator>
		<pubDate>Wed, 03 Aug 2022 07:03:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.alexgeorgiou.gr/?p=72#comment-19578</guid>

					<description><![CDATA[[&#8230;] site header, without affecting the HTML head’s &#060;title&#062; tag. This solution was taken from here and it works very well (tested with Firefox in Ubuntu and with Android&#8217;s default browser). I [&#8230;]]]></description>
			<content:encoded><![CDATA[<p>[&#8230;] site header, without affecting the HTML head’s &lt;title&gt; tag. This solution was taken from here and it works very well (tested with Firefox in Ubuntu and with Android&#8217;s default browser). I [&#8230;]</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Filter the blog title displayed in the header		</title>
		<link>https://www.alexgeorgiou.gr/use-wordpress-bloginfo-filter-add-html-markup/#comment-19575</link>

		<dc:creator><![CDATA[Filter the blog title displayed in the header]]></dc:creator>
		<pubDate>Wed, 03 Aug 2022 04:42:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.alexgeorgiou.gr/?p=72#comment-19575</guid>

					<description><![CDATA[[&#8230;] this is what I have finally used (code credit to Alexandros Georgiou). I don&#8217;t know if this is a good solution, but I like to have a single common place [&#8230;]]]></description>
			<content:encoded><![CDATA[<p>[&#8230;] this is what I have finally used (code credit to Alexandros Georgiou). I don&#8217;t know if this is a good solution, but I like to have a single common place [&#8230;]</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: alexg		</title>
		<link>https://www.alexgeorgiou.gr/use-wordpress-bloginfo-filter-add-html-markup/#comment-32</link>

		<dc:creator><![CDATA[alexg]]></dc:creator>
		<pubDate>Tue, 08 Nov 2016 14:44:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.alexgeorgiou.gr/?p=72#comment-32</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.alexgeorgiou.gr/use-wordpress-bloginfo-filter-add-html-markup/#comment-31&quot;&gt;Iurie&lt;/a&gt;.

Thanks :-)]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.alexgeorgiou.gr/use-wordpress-bloginfo-filter-add-html-markup/#comment-31">Iurie</a>.</p>
<p>Thanks 🙂</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Iurie		</title>
		<link>https://www.alexgeorgiou.gr/use-wordpress-bloginfo-filter-add-html-markup/#comment-31</link>

		<dc:creator><![CDATA[Iurie]]></dc:creator>
		<pubDate>Tue, 08 Nov 2016 14:42:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.alexgeorgiou.gr/?p=72#comment-31</guid>

					<description><![CDATA[Can I credit you &lt;a href=&quot;http://wordpress.stackexchange.com/a/245486/25187&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;?]]></description>
			<content:encoded><![CDATA[<p>Can I credit you <a href="http://wordpress.stackexchange.com/a/245486/25187" rel="nofollow">here</a>?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: alexg		</title>
		<link>https://www.alexgeorgiou.gr/use-wordpress-bloginfo-filter-add-html-markup/#comment-30</link>

		<dc:creator><![CDATA[alexg]]></dc:creator>
		<pubDate>Tue, 08 Nov 2016 14:31:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.alexgeorgiou.gr/?p=72#comment-30</guid>

					<description><![CDATA[Lurie,
Glad to be of help.
take care]]></description>
			<content:encoded><![CDATA[<p>Lurie,<br />
Glad to be of help.<br />
take care</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Iurie		</title>
		<link>https://www.alexgeorgiou.gr/use-wordpress-bloginfo-filter-add-html-markup/#comment-29</link>

		<dc:creator><![CDATA[Iurie]]></dc:creator>
		<pubDate>Tue, 08 Nov 2016 14:26:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.alexgeorgiou.gr/?p=72#comment-29</guid>

					<description><![CDATA[The &#060;pre&#062; tag don&#039;t worked as I expected, probably it must be used together with the the &#060;code&#062; tag. Anyway, I solved my problem. Thank you!]]></description>
			<content:encoded><![CDATA[<p>The &#060;pre&#062; tag don&#8217;t worked as I expected, probably it must be used together with the the &#060;code&#062; tag. Anyway, I solved my problem. Thank you!</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Iurie		</title>
		<link>https://www.alexgeorgiou.gr/use-wordpress-bloginfo-filter-add-html-markup/#comment-28</link>

		<dc:creator><![CDATA[Iurie]]></dc:creator>
		<pubDate>Tue, 08 Nov 2016 14:22:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.alexgeorgiou.gr/?p=72#comment-28</guid>

					<description><![CDATA[Alex, thank you very much! Again, for completeness, this is the final code I have used in my child theme&#039;s &lt;i&gt;functions.php&lt;/i&gt; (I hope the  tag will work):

&lt;code&gt;
$twentyseventeen_child_in_body = false;

function twentyseventeen_child_action_wp_head_finished() {
    global $twentyseventeen_child_in_body;
    $twentyseventeen_child_in_body = true;
}
add_action( &#039;wp_head&#039;, &#039;twentyseventeen_child_action_wp_head_finished&#039;, PHP_INT_MAX );

function twentyseventeen_child_action_wp_footer_started() {
    global $twentyseventeen_child_in_body;
    $twentyseventeen_child_in_body = false;
}
add_action( &#039;wp_footer&#039;, &#039;twentyseventeen_child_action_wp_footer_started&#039;, 0 );

function twentyseventeen_child_filter_bloginfo( $name, $show = null ) {
    global $twentyseventeen_child_in_body;
    if ( &#039;name&#039; == $show &#038;&#038; $twentyseventeen_child_in_body ) {
		$name = &quot;&#060;span class=&quot;info-style&quot;&#062;Info&#060;/span&#062;&quot; . &quot;&#060;span class=&quot;psi-style&quot;&#062;Psi&#060;/span&#062;&quot; . &quot;&#060;span class=&quot;md-style&quot;&#062;.md&#060;/span&#062;&quot;;
        return &quot;$name&quot;;
    } else {
        return $name;
    }
}
add_filter( &#039;bloginfo&#039;, &#039;twentyseventeen_child_filter_bloginfo&#039;, 10, 2 );
&lt;/code&gt;]]></description>
			<content:encoded><![CDATA[<p>Alex, thank you very much! Again, for completeness, this is the final code I have used in my child theme&#8217;s <i>functions.php</i> (I hope the  tag will work):</p>
<p><code><br />
$twentyseventeen_child_in_body = false;</p>
<p>function twentyseventeen_child_action_wp_head_finished() {<br />
    global $twentyseventeen_child_in_body;<br />
    $twentyseventeen_child_in_body = true;<br />
}<br />
add_action( 'wp_head', 'twentyseventeen_child_action_wp_head_finished', PHP_INT_MAX );</p>
<p>function twentyseventeen_child_action_wp_footer_started() {<br />
    global $twentyseventeen_child_in_body;<br />
    $twentyseventeen_child_in_body = false;<br />
}<br />
add_action( 'wp_footer', 'twentyseventeen_child_action_wp_footer_started', 0 );</p>
<p>function twentyseventeen_child_filter_bloginfo( $name, $show = null ) {<br />
    global $twentyseventeen_child_in_body;<br />
    if ( 'name' == $show &amp;&amp; $twentyseventeen_child_in_body ) {<br />
		$name = "&lt;span class="info-style"&gt;Info&lt;/span&gt;" . "&lt;span class="psi-style"&gt;Psi&lt;/span&gt;" . "&lt;span class="md-style"&gt;.md&lt;/span&gt;";<br />
        return "$name";<br />
    } else {<br />
        return $name;<br />
    }<br />
}<br />
add_filter( 'bloginfo', 'twentyseventeen_child_filter_bloginfo', 10, 2 );<br />
</code></p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: alexg		</title>
		<link>https://www.alexgeorgiou.gr/use-wordpress-bloginfo-filter-add-html-markup/#comment-27</link>

		<dc:creator><![CDATA[alexg]]></dc:creator>
		<pubDate>Tue, 08 Nov 2016 13:58:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.alexgeorgiou.gr/?p=72#comment-27</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.alexgeorgiou.gr/use-wordpress-bloginfo-filter-add-html-markup/#comment-24&quot;&gt;Iurie&lt;/a&gt;.

You probably don&#039;t need to know when the &lt;code&gt;body&lt;/code&gt; tag closes, unless your theme or plugins somehow use the bloginfo function afterwards. I just included the footer hook for completeness, in most cases you can get away without it I guess.

You can format your code with standard html &#060;pre&gt; and &#060;code&gt; tags. I&#039;ve edited your reply to add those.

As a sidenote, I see that you use &lt;code&gt;twentyseventeen&lt;/code&gt; as your slug. While this will work OK, keep in mind that this is the slug of your parent theme. Ideally you should have your own slug for your child theme. This is common practice. The idea here is to avoid any naming conflicts with other components, whether they are other plugins or themes or even your parent theme. If there was a &lt;code&gt;twentyseventeen_filter_bloginfo&lt;/code&gt; function in the twentyseventeen theme, you&#039;d be in trouble.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.alexgeorgiou.gr/use-wordpress-bloginfo-filter-add-html-markup/#comment-24">Iurie</a>.</p>
<p>You probably don&#8217;t need to know when the <code>body</code> tag closes, unless your theme or plugins somehow use the bloginfo function afterwards. I just included the footer hook for completeness, in most cases you can get away without it I guess.</p>
<p>You can format your code with standard html &lt;pre> and &lt;code> tags. I&#8217;ve edited your reply to add those.</p>
<p>As a sidenote, I see that you use <code>twentyseventeen</code> as your slug. While this will work OK, keep in mind that this is the slug of your parent theme. Ideally you should have your own slug for your child theme. This is common practice. The idea here is to avoid any naming conflicts with other components, whether they are other plugins or themes or even your parent theme. If there was a <code>twentyseventeen_filter_bloginfo</code> function in the twentyseventeen theme, you&#8217;d be in trouble.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Iurie		</title>
		<link>https://www.alexgeorgiou.gr/use-wordpress-bloginfo-filter-add-html-markup/#comment-24</link>

		<dc:creator><![CDATA[Iurie]]></dc:creator>
		<pubDate>Tue, 08 Nov 2016 13:45:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.alexgeorgiou.gr/?p=72#comment-24</guid>

					<description><![CDATA[After removing some errors and some testings, the next code worked:
&lt;pre&gt;
//$twentyseventeen_in_body = &quot;&quot;;
//$twentyseventeen_in_body = false;

function twentyseventeen_action_wp_head_finished() {
    global $twentyseventeen_in_body;
    $twentyseventeen_in_body = true;
}
add_action( &#039;wp_head&#039;, &#039;twentyseventeen_action_wp_head_finished&#039;, PHP_INT_MAX );

function twentyseventeen_action_wp_footer_started() {
    global $twentyseventeen_in_body;
    $twentyseventeen_in_body = false;
}
//add_action( &#039;wp_footer&#039;, &#039;twentyseventeen_action_wp_footer_started&#039;, 0 );

function twentyseventeen_filter_bloginfo( $name, $show = null ) {
    global $twentyseventeen_in_body;
    if ( &#039;name&#039; == $show &#038;&#038; $twentyseventeen_in_body ) {
		$name = &quot;Info&quot; . &quot;Psi&quot; . &quot;.md&quot;;
        return &quot;$name&quot;;
    } else {
        return $name;
    }
}
add_filter( &#039;bloginfo&#039;, &#039;twentyseventeen_filter_bloginfo&#039;, 10, 2 );
&lt;/pre&gt;

I commented the &lt;code&gt;add_action( &#039;wp_footer&#039;, &#039;twentyseventeen_action_wp_footer_started&#039;, 0 );&lt;/code&gt; and this nothing changed. It is needed?]]></description>
			<content:encoded><![CDATA[<p>After removing some errors and some testings, the next code worked:</p>
<pre>
//$twentyseventeen_in_body = "";
//$twentyseventeen_in_body = false;

function twentyseventeen_action_wp_head_finished() {
    global $twentyseventeen_in_body;
    $twentyseventeen_in_body = true;
}
add_action( 'wp_head', 'twentyseventeen_action_wp_head_finished', PHP_INT_MAX );

function twentyseventeen_action_wp_footer_started() {
    global $twentyseventeen_in_body;
    $twentyseventeen_in_body = false;
}
//add_action( 'wp_footer', 'twentyseventeen_action_wp_footer_started', 0 );

function twentyseventeen_filter_bloginfo( $name, $show = null ) {
    global $twentyseventeen_in_body;
    if ( 'name' == $show &amp;&amp; $twentyseventeen_in_body ) {
		$name = "Info" . "Psi" . ".md";
        return "$name";
    } else {
        return $name;
    }
}
add_filter( 'bloginfo', 'twentyseventeen_filter_bloginfo', 10, 2 );
</pre>
<p>I commented the <code>add_action( 'wp_footer', 'twentyseventeen_action_wp_footer_started', 0 );</code> and this nothing changed. It is needed?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: alexg		</title>
		<link>https://www.alexgeorgiou.gr/use-wordpress-bloginfo-filter-add-html-markup/#comment-23</link>

		<dc:creator><![CDATA[alexg]]></dc:creator>
		<pubDate>Tue, 08 Nov 2016 12:20:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.alexgeorgiou.gr/?p=72#comment-23</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.alexgeorgiou.gr/use-wordpress-bloginfo-filter-add-html-markup/#comment-21&quot;&gt;Iurie&lt;/a&gt;.

Assuming that you haven&#039;t defined a class in your &lt;code&gt;functions.php&lt;/code&gt;, you&#039;d just declare normal functions and maybe use a global variable.

Try this and let me know:

&lt;pre&gt;
$slug_in_body = false;

public function slug_action_wp_head_finished() {
    global $slug_in_body;
    $slug_in_body = true;
}
add_action( &#039;wp_head&#039;, &#039;slug_action_wp_head_finished&#039; ), PHP_INT_MAX );

public function slug_action_wp_footer_started() {
    global $slug_in_body;
    $slug_in_body = false;
}
add_action( &#039;wp_footer&#039;, &#039;slug_action_wp_footer_started&#039;, 0 );

public function slug_filter_bloginfo( $name, $show = null ) {
    global $slug_in_body;
    if ( &#039;name&#039; == $show &amp;&amp; $slug_in_body ) {
        return &quot;&lt;strong&gt;$name&lt;/strong&gt;&quot;;
    } else {
        return $name;
    }
}
add_filter( &#039;bloginfo&#039;, &#039;slug_filter_bloginfo&#039; ), 10, 2 );
&lt;/pre&gt;

Make sure to replace &quot;slug&quot; with whatever slug you&#039;re using to identify your child theme.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.alexgeorgiou.gr/use-wordpress-bloginfo-filter-add-html-markup/#comment-21">Iurie</a>.</p>
<p>Assuming that you haven&#8217;t defined a class in your <code>functions.php</code>, you&#8217;d just declare normal functions and maybe use a global variable.</p>
<p>Try this and let me know:</p>
<pre>
$slug_in_body = false;

public function slug_action_wp_head_finished() {
    global $slug_in_body;
    $slug_in_body = true;
}
add_action( 'wp_head', 'slug_action_wp_head_finished' ), PHP_INT_MAX );

public function slug_action_wp_footer_started() {
    global $slug_in_body;
    $slug_in_body = false;
}
add_action( 'wp_footer', 'slug_action_wp_footer_started', 0 );

public function slug_filter_bloginfo( $name, $show = null ) {
    global $slug_in_body;
    if ( 'name' == $show &#038;& $slug_in_body ) {
        return "<strong>$name</strong>";
    } else {
        return $name;
    }
}
add_filter( 'bloginfo', 'slug_filter_bloginfo' ), 10, 2 );
</pre>
<p>Make sure to replace &#8220;slug&#8221; with whatever slug you&#8217;re using to identify your child theme.</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
