[Plugin: wp-Typography] Dewidow function affecting inline styling
-
The situation:
I’m getting a list of posts, like so…
$myposts = get_posts( $args );
and putting each post found into a new list item with structure…
<li><a><div></div><span></span></a></li>
To that div tag, I’m adding a style…
<div style="background-image: url('/fixed-root/plus-variable-based-on-post-title.png');"></div>
The raw post title is written into the span…
<span><?php the_title(); ?></span>
The problem:
The background image url is having a %C2%A0 added into it which breaks it.
Turning off dewidowing makes the background-image-url work, but then display in other areas is not as nice.I don’t think this is intended behaviour, so if there’s a workaround anybody could tell me about?
Or if it’s not been seen before and could be fixed, that’d be brilliant!This is how I form the background-image url:
(Spaces added in to & nbsp;, & #160;, & #xA0;, and & amp; for display)<?php $theTitle = get_the_title(); $theTitle = str_replace("& nbsp;?", "", $theTitle); $theTitle = str_replace("& #160;?", "", $theTitle); $theTitle = str_replace("& #xA0;", "", $theTitle); $theTitle = str_replace("& #x00A0;", "", $theTitle); $theTitle = str_replace("& amp;", "", $theTitle); $theTitle = str_replace("%C2%A0", "", $theTitle); $theTitle = str_replace("=C2=A0", "", $theTitle); $theTitle = str_replace(" ", "", $theTitle); $thumbUrl = "/images/speakers/".$theTitle.".png"; ?> <div style="background-image: url(<?php echo($thumbUrl); ?>);" class="speaker-thumb circle"></div>
Any help and suggestions greatly appreciated!
- The topic ‘[Plugin: wp-Typography] Dewidow function affecting inline styling’ is closed to new replies.