Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

WordPress PHP Query

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

WordPress PHP Query

Postby SkyNetworks » Mon May 26, 2014 4:03 pm

Hi Everybody.

Apologies if I've not posted this in the correct forum, but am hoping somebody can help me please.

The following line of WordPress code displays the ‘Title’ of my individual blog posts in the Sidebar of my website.

<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

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.

New php-forum User
New php-forum User
Posts: 1
Joined: Mon May 26, 2014 3:10 pm

Return to PHP coding => General

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.