Forums

Adding URL to cusom field (8 posts)

  1. TheATHEiST
    Member
    Posted 2 years ago #

    Hi il try and explain what im trying to do.

    Im trying to create a custom field where i can simply paste a url into and it will add the url to the post with the same title each time.

    Example I have a blog and also forum and would like to be able to add a "Discuss this post in forum.." link to bottom of every post without having to manually writing the title each time and then hyperlinking it with the URL.

    Instead I would like to be able to just poaste the URL into custom field and click add if possible.

    Can anybody help or recommend an even easier/quicker solution?

  2. MichaelH
    Volunteer
    Posted 2 years ago #

    Sure put this in your template, in your loop that displays posts...of course you may need to change link_url to your custom field name.

    <?php
    $link = get_post_meta($post->ID, 'link_url', true);
    if ($link){
      echo '<a href="'.$link .'">Discuss this post in forum...</a>';
    }
    ?>

    Stepping Into Template Tags
    Stepping Into Templates
    Template Hierarchy

  3. TheATHEiST
    Member
    Posted 2 years ago #

    Thnx for reply bud.

    How do I do this though? Where abouts do I paste that code and how do I create custom field for it etc :(

    I created my theme using Artisteer btw.

  4. MichaelH
    Volunteer
    Posted 2 years ago #

    You create the custom code when writing a post.

    You put the code in The Loop of the Template that is displaying your posts.

    Review:
    Custom Fields
    Stepping Into Template Tags
    Stepping Into Templates
    Template Hierarchy

  5. TheATHEiST
    Member
    Posted 2 years ago #

    Dude im a n00b when it comes to this, Can you explain it simpler, step by step maybe bud please.

    Does this allow be to add a different forum link each time i need to or is it a set link that is added to each post?

    I didnt make it clear in first post sorry, What i need is to be able to choose a different url for each post which automatically gets added to a "Discuss this news in forum..." link.

    I have a RSS plugin within my vbulletin forum which creates a topic from my blog via RSS so would be good to be able to add the created topic link back on the blog so that people who wish to discuss the topic have a direct link to it.

    Is this possible via the custom field?

  6. MichaelH
    Volunteer
    Posted 2 years ago #

    Probably better to give you a search for that:
    http://www.google.com/search?q=wordpress+how+to+use+custom+fields

  7. TheATHEiST
    Member
    Posted 2 years ago #

    I know about the custom field instructions but can you answer whether not this will allow me to change the url each time or will it just add the same link to all my posts?

    Just want clarification before I do anything so im not wasting my time.

    Does it allow me to simply paste teh url I want into the field and it automatically inserts it with the custom title for link?

  8. MichaelH
    Volunteer
    Posted 2 years ago #

    If you want the same link in every post then just edit your template that displays posts and put the link there.

    If you want a different link for each post, then use a custom field.

Topic Closed

This topic has been closed to new replies.

About this Topic