Support » Fixing WordPress » How to put my site title into a google search url

  • I have this code…
    <a href="<?php the_title(); ?> - <?php the_category(' '); ?>" ><?php the_title(); ?></a>

    Which I want it to turn out like this… Awesome Widgets - brown widgets

    But it doesn’t

    Sooooooooooo I’d love if anyone could help me out to make it work.

    Thanks heaps!

Viewing 3 replies - 1 through 3 (of 3 total)
  • What does it turn out like?

    the_category() function is meant to be used inside what is known as the loop. Where WordPress loops through queried posts. I’m going to guess your using it outside of the loop.

    Using it like this…

    Categories: <?php the_category(‘ ‘); (within the loop)

    Would list all of the current posts categories.

    It is used inside the loop, no worries there.

    It’s filled with spans and data-post_id= and data-type= and all sort of other ‘stuff’

    <span data-post_id="1480" data-type="input" data-filter="the_title" class="fee-field">My Awesome Widgets</span> <span data-post_id="1480" data-taxonomy="category" data-before="" data-sep=" " data-after="" data-type="termselect" data-filter="the_category" class="fee-field"><a href="http://xyz" title="View all posts in abc" rel="category tag">My Awesome Widgets</a></span>

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to put my site title into a google search url’ is closed to new replies.