I'd like to generate the wordpress post title in the following javascript code: I'm placing this code under the content in my wordpress posts.
<script charset="utf-8" type="text/javascript">
document.write('\x3Cscript type="text/javascript" charset="utf-8" src="http://adn.ebay.com/cb?programId=1&campId=5337203820&toolId=10026&customId=posttop&keyword=**POST-TITLE**&width=728&height=90&font=1&textColor=000000&linkColor=0000AA&arrowColor=8BBC01&color1=709AEE&color2=[COLORTWO]&format=ImageLink&contentType=TEXT_AND_IMAGE&enableSearch=y&usePopularSearches=n&freeShipping=n&topRatedSeller=y&itemsWithPayPal=n&descriptionSearch=n&showKwCatLink=n&excludeCatId=&excludeKeyword=&catId=177913%2C179767%2C1059&disWithin=200&ctx=n&autoscroll=n&flashEnabled=' + isFlashEnabled + '&pageTitle=' + _epn__pageTitle + '&cachebuster=' + (Math.floor(Math.random() * 10000000 )) + '">\x3C/script>' );
The keyword= part of the script is where I need to generate the wordpress post title. I was trying keyword="<?php single_post_title(); ?>"
but it doesn't generate the wordpress post title... not sure if I'm on the right track or not.
Any help would be appreciated. Please remember I'm a newbie. If I forgot to mention something please ask. I'll be quick to respond.
Thanks a lot!
There's a simple way to do it for blog posts and normal pages. Here it is:
inside your loop see
if ( have_posts() )
andwhile
, use this inside thewhile
statement.Now the variable is set, you can use it later unless it is overwritten.
in your js: