View Full Version : How to carry a query string in wordpress post.
hashbury
2009-04-03, 04:38 PM
Im trying to figure out how to carry an affiliate id in posts through an rss feed in wordpress. Is there a string of code i can add on to my links in my post? Or is there a plugin that can manage this?
Beaver Bob
2009-04-03, 06:49 PM
I use runPHP
http://www.nosq.com/blog/2006/01/runphp-plugin-for-wordpress/
allows you to use PHP in your posts. There might be a better way, but this works for me.
hashbury
2009-04-04, 02:38 AM
I use runPHP
http://www.nosq.com/blog/2006/01/runphp-plugin-for-wordpress/
allows you to use PHP in your posts. There might be a better way, but this works for me.
This is perfect Beaver Bob. I was already trying to use php code in the post but it was making the blog display wrong.
Thank You
hashbury
2009-04-06, 05:57 PM
Anyone know how to carry a query string in the post titles or a way to include it in the permalinks? Im thinking maybe htaccess?
Beaver Bob
2009-04-07, 07:57 PM
You will most likely need to modify your theme.
Using the default kubrick theme, here is how I put the query string in the post title.. this is in the main index template, can you see where I made the modification?
<h2><a href="<?php the_permalink() ?><?php echo (isset($_GET['ref'])) ? '?ref='.$_GET['ref'] : ''; ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
Hope that gives you an idea.
hashbury
2009-04-08, 05:15 PM
That was perfect Beaver Bob. How do you do the rss feeds? Ive searched through all the files trying to find a href spot for my query string. Is this done a different way?
Beaver Bob
2009-04-08, 07:13 PM
you have to modify the feed-rss file in the wp-includes directory. Don't look for href but look for everywhere that displays a link.
hashbury
2009-04-09, 03:09 PM
Beaver Bob Thanks for your help so far. Im still having problems. In my feeds-rss file I found the two bits of code
<link><?php the_permalink_rss() ?></link>
<link><?php bloginfo_rss('url') . ?></link>
Is this the right code? Ive tried adding my code like this
<link><?php the_permalink_rss() . $_GET ['aff_link_id']; ?></link>
<link><?php bloginfo_rss('url') . $_GET ['aff_link_id']; ?></link>
I editted the code every way i could think of to get it to work.
So I thought i would go to feed.php and add my string to the the_permalink_rss function. This worked half ass, it will display my aff_link_id= but it will not display the actual affiliate number. I was going to try and use session variables to carry the affiliate number, but i cant seem to get it to work|banghead|. Any suggestions?
Beaver Bob
2009-04-09, 03:17 PM
try this:
<link><?php bloginfo_rss('url') ?><?php echo (isset($_GET['aff_link_id'])) ? '/?aff_link_id='.$_GET['aff_link_id'] : ''; ?> ?></link>
you just need to carry $aff_link_id in your query string
hashbury
2009-04-09, 03:46 PM
I had to add it to the function
function the_permalink_rss() {
echo apply_filters('the_permalink_rss', get_permalink()). '?aff_link_id=' .$_GET['aff_link_id'];
Thank so much for your help
Beaver Bob
2009-04-10, 12:51 PM
hope it works out for you!
vBulletin® v3.8.1, Copyright ©2000-2026, Jelsoft Enterprises Ltd.