mark
Site Admin
Posts: 5519 Joined: Tue Apr 25, 2000 6:56 pm
Post
by mark » Fri May 27, 2016 3:07 pm
The walker doesn't record site favicons. You could use XSL results style and modify the style sheet to grab the favicon directly from each site.
munoz
Posts: 7 Joined: Fri May 27, 2016 12:44 pm
Post
by munoz » Tue May 31, 2016 8:55 am
Yeah, that might be good.
Could you maybe guide me to how do do that?
A reference page or something?
mark
Site Admin
Posts: 5519 Joined: Tue Apr 25, 2000 6:56 pm
Post
by mark » Tue May 31, 2016 5:42 pm
Something like this will construct the img tag for favicon.ico:
<img height="16" width="16" alt="">
<xsl:attribute name="src">
<xsl:value-of select="substring-before(Url,'://')"/>
<xsl:text>://</xsl:text>
<xsl:choose>
<xsl:when test="substring-before(substring-after(Url, '://'),'/')=''">
<xsl:value-of select="substring-after(Url, '://')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="substring-before(substring-after(Url, '://'),'/')"/>
</xsl:otherwise>
</xsl:choose>
<xsl:text>/favicon.ico</xsl:text>
</xsl:attribute>
</img>
You'll probably want to add that somewhere in the ResultTitle template.
munoz
Posts: 7 Joined: Fri May 27, 2016 12:44 pm
Post
by munoz » Wed Jun 01, 2016 10:24 am
Oh thank you!!!! That works!!!
For most of the URLS, and of course I have one where the ico is not in the root.
How can I add something to address that?
The .ico is under "URL/wp-content/themes/nabsd/"
(I have never used .xsl before in my life, so all this is new to me)
mark
Site Admin
Posts: 5519 Joined: Tue Apr 25, 2000 6:56 pm
Post
by mark » Wed Jun 01, 2016 10:54 am
You'd have to compare Url to your prefix and do different behavior based on match/nomatch. Something like below (untested) before <xsl:text>/favicon.ico</xsl:text>
<xsl:if test="contains(Url,'/wp-content/themes/nabsd/')">
<xsl:text>/wp-content/themes/nabsd</xsl:text>
</xsl:if>
A handy XSL reference is
http://www.w3schools.com/xsl/