WordPress.org

Ready to get started?Download WordPress

Forums

title() inside post area (4 posts)

  1. Boris Strahija
    Member
    Posted 5 years ago #

    Hi,

    I'm looking for someone who could could help me out...
    I've recently started a new blog about music reviews and stuff, and I'm looking for a way to have the posts modified a little.

    I'm looking for a way how to insert something like:

    a href="google.com/q=<title>">search <title> on google

    (cant' format properly because forums edit it, i assume you understand what i mean)

    at end of every post.

    I looked into my theme but it doesn't seem like I'm able to do it trough there..I would appreciated any help if possible...

    sorry for my bad English!

  2. Pranav Rastogi
    Member
    Posted 5 years ago #

    <?php if(is_single()): ?>
    <a href="http://www.google.com/q=<?php the_title(); ?>">text</a>
    <?php elseif: ?>
    <?php endif; ?>

    Or you can add this to every post manually:

    <a href="http://www.google.com/q=<?php the_title(); ?>">text</a>

    Remember, you'll have to install a plugin which executes php in posts if you want to do it manually, or u can also make use of custom fields and check if the field matches, then display the text or whatever you want.

  3. Boris Strahija
    Member
    Posted 5 years ago #

    Hi,

    thanks for rapid quick reply, but could you please tell me where exactly I should put the first code you provided?

    Thanks a lot!

  4. Pranav Rastogi
    Member
    Posted 5 years ago #

    in single.php

Topic Closed

This topic has been closed to new replies.

About this Topic