SkyNetworks Posted May 26, 2014 Share Posted May 26, 2014 Hi Everybody. Apologies if I've not posted this in the correct forum, but the following line of WordPress code displays the ‘Title’ of my individual blog posts in the Sidebar. <a href="<?php the_permalink(); ?>"><?php get_the_title() ? the_title() : the_ID(); ?></a> Can somebody please help me tweak it so it displays both the ‘Title’ and ‘Subtitle’ of each post please? So far I’ve tried adding the ‘Subtitle’ at the end, like this: <a href="<?php the_permalink(); ?>"><?php get_the_title() ? the_title() : the_ID(); ?><span class="subtitle"><?php the_subtitle(); ?></span></a> This works in the sense that both the ‘Title’ and ‘Subtitle’ are displayed (both of which are styled in slightly different colours using a separate CSS file), but while the ‘Title’ changes font colour on mouse-hover, the ‘Subtitle’ doesn’t (I’m guessing because I’ve wrapped it in a span class). What I’m really hoping to do is have the ‘Title’ displayed in one colour and the ‘Subtitle’ in a slightly different colour, but for both ‘Title’ and ‘Subtitle’ to change to the same colour when the mouse hovers over either one of them. I’m still building my site, but you can see the Sidebar as it stands, here http://www.retelevise.com. I don’t know if this is even possible and have not had any feedback on the WordPress support forum, so was really hoping one of the PHP experts here might be able to help me please? Bear in mind I'm a complete PHP novice. Thanks, SN. Quote Link to comment https://forums.phpfreaks.com/topic/288795-wordpress-php-query/ Share on other sites More sharing options...
sKunKbad Posted May 27, 2014 Share Posted May 27, 2014 This isn't really a PHP or WP issue, because the output is what you want it to be. What it is is a CSS issue, and if your on-hover color isn't right for the span, then you'll need to add/edit some CSS to make it right. So where you have CSS rules for "a" and "a:hover", you're also going to need one for "a span:hover". This wouldn't normally be the case, but it seems that you might have a rule that this span is inheriting from. Quote Link to comment https://forums.phpfreaks.com/topic/288795-wordpress-php-query/#findComment-1481066 Share on other sites More sharing options...
SkyNetworks Posted May 28, 2014 Author Share Posted May 28, 2014 You're brilliant. Thank you so much!! Quote Link to comment https://forums.phpfreaks.com/topic/288795-wordpress-php-query/#findComment-1481221 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.