Try
<?php
if ( in_category( 'wordpress-theme' )) {
echo ('<a href="http://example.com/<?php the_title(); ?>" class="test"></a>');
} ?>
Thread Starter
klo-wp
(@klo-wp)
broadleon
Put code in between back ticks. Check Allowed markup, so i can view all your code.
thanks
Try this:
<?php
if ( in_category( 'wordpress-theme' )) {
echo '<a href="http://example.com/' . the_title() . ' class="test"></a>';
} ?>
Thread Starter
klo-wp
(@klo-wp)
Josh,
Doesn’t work. I get the title outside the link, i need it inside.
<a href="http://example.com/<?php the_title(); ?></a>
should be:
http://example.com/TEST
thanks
How about this?
<?php
if ( in_category( 'wordpress-theme' )) {
echo '<a href="http://example.com/';
echo the_title();
echo '" class="test"></a>';
} ?>
I missed a closing quotation mark in my reply above (first reply). This should work also:
<?php
if ( in_category( 'wordpress-theme' )) {
echo '<a href="http://example.com/'.the_title().'" class="test"></a>';
} ?>
Thread Starter
klo-wp
(@klo-wp)
Thanks Josh, this worked 🙂