• Everyone who has visited Digg knows that when you click the headline of an article that it takes you directly to the source.

    My website I would like to link consumers to products that are on offer/sale etc.

    I am need direction on modifying the Headline of each post so that it links to the product. I would also like direction on modifying the RSS feed, so that too goes straight to the product.

    I think that I would be looking at integrating a new input field and then coding that into the database and php.

    Thanks in advance.

    Ash

Viewing 5 replies - 1 through 5 (of 5 total)
  • It’s my personal preference not to touch the database unless completely necessary, and I feel it isn’t necessary in this case.

    It is possible to do what you want by creating a new custom field for the URL of the product you want to link to, and then, replacing your normal headline with the value of that custom field in your theme’s templates.

    See the Codex’s documentation on using custom fields for details on pulling the value of your custom field.

    For RSS feed modification, you might want to look at your RSS template files, e.g. wp-rss2.php, and do the same thing.

    Thread Starter ashconnor

    (@ashconnor)

    OK this is where I stand ATM.

    ID, ‘link’, $single=true) ?>”>Product Link

    I’ve placed this in the Loop but it isn’t aligned where I would like. I think this might be a CSS problem/solution.

    https://www.ooee.biz/?p=11

    RSS still havent got a clue, I get errors when replacing:

    this:
    <link><?php permalink_single_rss() ?></link>

    with:
    <link><?php get_post_meta($post->ID, ‘link’, $single=true)?></link>

    Need help.

    Ash

    For your RSS2 template, try this to pull the value of your custom field into a variable named $avariablename:
    <?php list ($avariablename) = get_post_custom_values('link'); ?>

    Then, put $avariablename between the link tags, i.e.
    <link>$avariablename</link>

    If that still doesn’t work, although it should, you could always use the following plugin, which lets you call custom fields using a simple template tag:

    https://www.coffee2code.com/archives/2004/06/30/plugin-get-custom/

    Might be overboard, though, if you’re using only one custom field.

    Thread Starter ashconnor

    (@ashconnor)

    ZMAng genius my friend it worked with a little modification.

    I added

    <?php list ($avariablename) = get_post_custom_values(‘link’); ?>

    Under:

    <?php $items_count = 0; if ($posts) { foreach ($posts as $post) { start_wp(); ?>

    <link><?php print $avariablename ?></link>

    Just need to mod the CSS so that the Product link appears underneath the posts and above the comments and I’m done.

    Ash

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Digg Link Style Link RSS to source?’ is closed to new replies.