Howto: WordPress 2.7+ User Link Feed Submit Form and Widget

March 20, 2010 · 117 comments

by Lars


In this article tripwire magazine provides a mini-tutorial on how to setup a User Link/News Feed solution in WordPress 2.7+. I really think it is a nice feature as it gives a blog dynamic content and it it may actually drive traffic from bloggers looking for sources to get some easy and free traffic for their own site. You may also yourself find useful ressources by follwoing the links that your users submit.

NB! Post updated here: Build an Awesome Community News Feature for Your WordPress Blog




Adding a User Link/News Feed is currently quite popular and I have seen it many of the very popular Web Development and Desing Blogs i follow. Here is a few good examples that you can check out: Noupe Psdtuts+ Smashing Apps. Even though User Link/News Feeds are popular there doen’t seam to be an easy way to implement it in WordPress. There is as far as I know currently no plugin or really good tutorials that binds all the elements together why I decided to share the details of the solution I have just added to tripwire magazine (make sure you try it out and post a link to a useful resource!). There are as usual more than one way of doing this. Some use the comments system in WordPress while others use their own proprietary database. In the solution I cover in this tutorial User Submitted content will be added as new posts in WordPress.

Step 1. Get the files.

Submitting content to WordPress from the front end can be done in many ways but I think that one of the best and most flexible ways available is to use TDO Mini Forms. TDO is not exactly simpel to configure to start with but as start using it you will see that it gives you real power to make the Forms you want.

TDO Mini Forms: Download

Listing posts from one Category in a widget can also be done in countless ways. You should really use the plugin or approach you prefer here but in this tutorial I have decided to use the plugin Query Posts. I have made a few changes to the plugin presentation template to make it fit my needs. I’m not that proud of this part but….well you may find a better and more generic way yourself if you’re not into changing code to preserve compatibility with future releases of the plugin. If you do please share and post a comment.

Query Posts: Download

2. Install and activate both plugins.

This is not a tutorial on how to install plugins in general but it is very simple.

a. Upload the files under your wp-content/plugins directury

b. Log into WordPress back-end and click the Plugins menu button. Find the 2 new plugins under Inactive Plugins and press Activate.

3. Create a Page and a Category to hold the Form

You may call the page whatever you want but I suggest calling it "Submit User Link". There’s no reason to publish the page yet but you need it as a placeholder. Describe at the top of the page if you have any rules for what resources will be approved.

Create a WordPress Categoty that the posts will be put into per default. In this tutorial the Category is called User-News (user-news)

4. Basic Configuration

Activating TDO Mini Forms (TDOMF) will add a Options Menu at the bottom of your WordPress Admin Menu.

Make sure you start with configuring TDOMF via the main TDOMF menu "Form Manager and Options" in the WordPress Administration back-end. You must assign a user as the "Default Author". This user must not have rights to publish or edit posts, i.e. they should be of the subscriber role. The TDOMF options menu can automatically create a dummy user to set as the Default Author. This is the recommended approach.

With a Default user selected you’re actually done setting up the basics. You may consider enabling the Akismet Spam Protection at the bottom of the page.

5. Creating the Form

Press the “New Form” button. This will add a Form 2 button next to Form 1. I’m not sure why the names are Form 1,2,x and keep being this after naming the form but you may call it a “feature”.Once the form is created press the Form 2 button.This takes you to the main Form 2 configuration page.

  • Put in the Form Name “User Link Feed”.
  • Make sure that "Unregistered Users (i.e. everyone)" and "Users with rights to publish posts" can access the form. The check boxes for this can be found scrolling a bit down. Further down if you want to receive notifications enable it for Administrator.
  • Scroll further down and locate “Default Category” Select the category created in step 3.
  • Look for Enable Moderation and make sure it is checked.
  • To prevent your WordPress from becoming spammed you should create a throttle rule.In the example here each IP address can only have 10 unapproved submissions per hour. Setup what you want here.

Finally if you like Ajax forms enable it. I’m using it and it really is a nice feature.

6. Setting up the Form Layout

Form Layouts in TDOMF is called widgets and thus should not be confused with WordPress side bar widgets! To configure your widget press the Widget button.

First of all scroll to the bottom and set the Custom Field Widget to 3 and press save.

The make the following arrangement by dragging the field boxes from the area below the widget into it.

Configuration of the 3 custom fields and the content field can be seen here. Click on the images.

[nggallery id=7]

Add the following code to “Custom Fields 1”.

$LINKTITLE= get_post_meta($post_id, 'LINKTITLE', true);
if($LINKTITLE != false) {
   $link_title = $LINKTITLE;
} else {
   $link_title = '[No Link Title]';

<p><a href="%%VALUE%%" target="_blank"><?php echo $link_title ?></a></p>

Add the following code to “Append to Post Content 1”.

/* Using value put into Custom Field 3 called  LINKTITLE to insert
custom title on post to make it stand out in the WordPress Posts view. */

$link_title = get_post_meta($post_id, 'LINKTITLE', true);

if($link_title != false) {
   $post_title = '[User Link:'.$link_title.']';
} else {
   $post_title = '[no link title set]';
$postdata = array(
         "ID" => $post_id,
         "post_title" => $post_title);

The Form is basically set up now. To make the last hacks you have to go into Form Hack Mode.
Press the Form Hack Button and a page that gives you access to all the code is loaded.
What to do here:
1. Search for “URL:” and remove it. (makes the form look better)
2. Search for “Email:” and remove it.
3. If you want ot get rid of the preview button as well you can just locate the button input html and delete it.

7. Add the form to the Submit User Link Page

Open the page you created in step 3 for editing. Insert this tag on the page as shown below (I can’t put in the code here as it will be turned into a form):

Visit the form page and try to submit a few User Links. NB! Depending on the configuration you decided on in step 5: If you’re logged in as an administrator on the Browser session your submissions will be published directly.

This is the end result at tripwire magazine.

8. Add the Sidebar widget

Showing the links that users have submitted somewhere is necessary. If the Query Posts plugin was activated earlier as described you should navigate to the WordPress Widgets page.

Here you should Add a “Query Posts” widget to the sidebar and click edit. The configuration is simple but make sure you put in the id of the category you created in step 3 instead of 41.

Save the sidebar.

9. Changing the Query Posts plugin

Now to this is where it gets a bit ugly. I may have found a better way but I don’t have to use the plugin for other things at the moment.Open the following file for editing (on the server or locally….if locally you need to upload it afterwards):


To add the Add and RSS buttons insert the following line of code on line 180. Update the […] as needed.

<div id="userLinkMenu"><a href="http://[your domain]/submit-user-link">
<img src="[theme name]/images/[add image]" />Submit</a>
<a href="http://[your domain]/category/user-news/feed">
<img src="[theme name]/images/[rss image]" />RSS</a></div>

You need some images if you want to use the code as it is. If you just want text links remove the img tag.

<div id="userLinkMenu"><a href=""><img src="" />Submit</a><a href=""><img src="" />More Links</a><a href=""><img src="" />RSS</a></div>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

<div <?php if ( function_exists( 'post_class' ) ) post_class(); else echo 'class="post"'; ?>>

<?php if ( function_exists( 'get_the_image' ) && $thumbnail ) : ?>
  <?php get_the_image( array( 'custom_key' => array( 'Thumbnail', 'thumbnail' ), 'default_size' => 'thumbnail' ) ); ?>
  <?php endif; ?>
  <!-- comment this part out to leave out title in user link presentation
    <?php the_title( '<h2 class="post-title entry-title"><a href="' . get_permalink() . '" title="' . the_title_attribute( 'echo=0' ) . '" rel="bookmark">', '</a></h2>' ); ?>
    <p class="byline">
      <?php printf( __('<span class="text">By</span> %1$s <span class="text">on</span> %2$s', 'query-posts'), '<span class="author vcard"><a class="url fn n" href="' . get_author_posts_url( get_the_author_ID() ) . '" title="' . get_the_author() . '">' . get_the_author() . '</a></span>', '<abbr class="published" title="' . sprintf( get_the_time( __('l, F jS, Y, g:i a', 'query-posts') ) ) . '">' . sprintf( get_the_time( __('F j, Y', 'query-posts') ) ) . '</abbr>' ); ?>
      <?php edit_post_link( __('Edit', 'query-posts'), ' <span class="separator">|</span> <span class="edit">', '</span> ' ); ?>
    <?php if ( $display == 'the_content' ) : ?>

    <div class="entry-content">
      <?php the_content( __('Continue reading', 'query-posts') . ' ' . the_title( '"', '"', false ) ); ?>
      <?php wp_link_pages( array( 'before' => '<p class="pages">' . __('Pages:', 'query-posts'), 'after' => '</p>' ) ); ?>

    <?php else : ?>

    <div class="entry-summary">
      <?php the_excerpt(); ?>

    <?php endif; ?>
    <!-- comment this part out to leave out post meta in user link presentation
    <p class="entry-meta">
      <span class="categories"><span class="text"><?php _e('Posted in', 'query-posts'); ?></span> <?php the_category( ', ' ); ?></span>
      <?php the_tags( '<span class="tags"> <span class="separator">|</span> <span class="text">' . __('Tagged', 'query-posts') . '</span> ', ', ', '</span>' ); ?>
      <?php if ( comments_open() ) : ?><span class="separator">|</span><?php endif; ?> <?php comments_popup_link( __('Leave a response', 'query-posts'), __('1 Response', 'query-posts'), __('% Responses', 'query-posts'), 'comments-link', false ); ?>
  <div style="border-bottom:1px solid #F1F1ED; padding-bottom:3px; padding-top:2px;"></div>
  <?php endwhile; endif; ?>
<?php endif;

In order to make the list of Link only show the post content containing the title og the link and the description and exclude fx. the realt title of the posts some lines of code in the file have to be either deleted or commented out. I recommend commenting them out so for. The blocks below start at around line 195.

Save the file and make sure it is updated on the server. Check how it looks. This is the sidebar at tripwire magazine:

10. Exclude the User News Category from Menus, front page and RSS feed.

I don’t think that You dont want the User Link menu and the User Link posts to appear on your front page or in your RSS feed. This part is really quite dependant on the theme you are using and how you set up your blog. I’m giving a few hints but don’t expect this part to be fully covered here.

1) The feed part is very simple if you’re using feedburner and the feedburner plugin that redirects all feed requests to Just add ?cat=-[catid] to feed URL provided to feedburner

When it comes filtering what is shown on the to the frontpage or what Categoties that are shown in menus and widgets I will advise you to look for descriptions and tutorials that cover this as its main focus. There are manu good resource for this that you can use.

Please leave a comment if you find this tutorial useful or if you try it out and run into trouble!

{ 51 comments… read them below or add one }

reklama July 23, 2013 at 4:51 pm

Everyone loves it when folks get together and share thoughts.
Great blog, keep it up!


Sven June 11, 2013 at 2:47 pm

Exceptional post however I was wondering if you could write a litte
more on this subject? I’d be very grateful if you could elaborate a little bit more. Bless you!


zarzadzanie trescia May 17, 2013 at 2:35 pm

Way cool! Some very valid points! I appreciate you writing this article and also
the rest of the website is also very good.


custom publishing February 6, 2013 at 5:21 pm

Hi everyone, it’s my first pay a visit at this web page, and article is actually fruitful in favor of me, keep up posting these articles or reviews.


annesofie February 7, 2013 at 9:22 am

Welcome to the blog – hope you will like our articles :)
Kind regards,


Trista January 23, 2013 at 9:26 pm

Hello! Do you use Twitter? I’d like to follow you if that would be ok. I’m
undoubtedly enjoying your blog and look forward to new


annesofie January 24, 2013 at 8:24 am

Hi Trista, glad to hear you enjoy the blog. You can follow us on Twitter @tripwiremag where we post lost of interesting articles every day.
Look forward to seeing you on Twitter as well :)

Kind regards,


cerca casa November 2, 2012 at 2:10 pm

In case you are novice trader, you should begin off with just one one sort of expense.

Opt for an individual residence sort which you would take pleasure
in beginning from and simply pay attention to it.
It is actually to your advantage to keep focused on a single kind and do your best,
instead of distribute on your own too thin and simply do
typical at several purchases.


background for facebook page October 16, 2012 at 6:21 pm

Hurrah! In the end I got a blog from where Ӏ know how to truly takе valuable information concerning my stuԁy
and knoωledge.


sam March 9, 2011 at 9:06 am

hi ….. i want users to add links to post … i mean if i published a post … i want users to add link to dat particular post …not like if dey submit link …a new post is created.. plz help me how to do dat?


Why Country Sucks December 30, 2010 at 4:23 pm

hey tripwireteam, thanks for your link. that was very useful! TDO miniforms has not been updated in a long time and I fear upgrading wordpress because of this. I do not want to lose its functionality.


wczasy August 30, 2010 at 11:03 am

Super zapomnialem dopisac ze jestescie extra


qyu August 30, 2010 at 11:02 am

Bardzo dobra strona polecam ka?demu THX :)


tripwire team August 30, 2010 at 10:49 pm

he he I don’t understand one single word here…..sorry 😉


Craig Borok July 31, 2010 at 9:09 am

Thanks for great post, and i will bookmark this post, have a good day!!!


mysuperwoofer July 19, 2010 at 5:50 pm

Link Building is one of the most significant aspect of the off page optimization process and is a major determinant of the popularity of your site. For search engines, back links or links pointing to your website indicate that you are ‘hot’ in the online marketplace.


Stevo April 21, 2010 at 3:51 pm

I’m stuck on step 9, all I did was paste the code and then publish it. But then my whole site gave me an error. I’m using Fresh News theme from Woothemes. How do I do this?


tripwire team April 21, 2010 at 7:23 pm
Chris April 1, 2010 at 7:06 pm

Hi – awesome tutorial, thanks. I am curious as to how to setup each user submitted post/link with it’s own page, like they do at WD here:

Any suggestions?


adegustiann March 30, 2010 at 11:21 am

thanks for the information.. i like this post..:)


Simran March 28, 2010 at 8:25 am

Hey I’m not able to find “Append to Post Content 1?

Can you pls help me out ?


Jason Keith March 26, 2010 at 4:43 pm

Theme Name: Law Firm Theme

Theme Description:
This is a simple, but professional Wordpress theme for use by lawyers, attorneys, law firms and other legal industry companies and organizations.

The theme features blue colors and a right sidebar for navigation. This theme is perfect for a blog or to run the website as a CMS theme.

Theme Demo | Theme Download


san March 20, 2010 at 1:06 am

@tripwire team thanks for the link, I will give that a try! I just thought I might have read something wrong the first few try and didn’t want to bother you before I gave it my best, thanks again for the fast response!


san March 19, 2010 at 11:03 pm

Hi, thanks for the tutorial on this site! I been trying to get this to work for sometime already but I keep getting stuck. I am having the same problem with another comment from above but I don’t see any thing to solve it yet. I keep getting no new link on my result instead of the title, I’ve deleted and tried so many times. I just can’t get it to work right…


tripwire team March 20, 2010 at 12:13 am

@san, I’m really sorry that you tried more than once and didn’t contact me for help. Please take a look at this newer post covering same subject but in more details.


home magazine rack March 19, 2010 at 7:03 pm

wow, this is a helpful page, thank`s for share, maybe i try later.


web design staffordshire February 24, 2010 at 8:27 pm

Brilliant tutorial. Thanks for the in depth description. Thanks.


Lars V February 24, 2010 at 10:41 pm

@web design staffordshire, your welcome, let me know if you have any questions!


Wow Flickr January 19, 2010 at 6:43 am

Great hack, I’ll using this for my new site:
Thank you!


sriganesh January 12, 2010 at 6:31 pm

iam not getting the links ony the path and it showing as a new post when someone sumitt the link. i like to show the user links in the submit page | help in this plz the whole day i wasted in try out this 😀 could nt get it :(


Shurandy Thode January 8, 2010 at 4:40 am

Nice guide. How did you manage to make the “user-links” page with all the links listed on there?


Franco December 15, 2009 at 3:06 am

Done Deal!!!!, It works just perfect!!!, Thanks for Everything!!!


Franco December 14, 2009 at 4:21 pm

Hi!!, thanks for the fast answer, the first code i pasted in previous comment, is part of the code you gave me in an earlier comment, and the second part of the code is the new one, i`m very ignorant when it comes to php, so what i need to do it`s to change the old code starting from *SELECT? I`ll give it another try!. Thanks


Franco December 14, 2009 at 5:32 am

Guys? any help? I`m so close I`can taste it! (all thanks to you). I need the last push, please


tripwiremag December 14, 2009 at 6:50 am

@Franco, sorry I didn’t see your comment as it did approve itself (because your a regular user of the commments section). Anyway le have a look. What are you trying to achieve? The two sections of code you have added to the comment seams to uncomplete or wrong. First one is missing the “SELECT” and is having a “?” just after LIMIT 0, 10 instead of “. Tell me what you need and I’ll change it.


Franco December 9, 2009 at 12:53 am

Hello, sorry taht took me that long to check back. I have traied to change this code:

FROM wp_posts as wpost
INNER JOIN wp_term_relationships ON wpost.ID = wp_term_relationships.object_id
INNER JOIN wp_term_taxonomy ON wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id
AND wp_term_taxonomy.taxonomy = ‘category’
WHERE wp_term_taxonomy.term_id IN ( 41 )
AND post_status = ‘publish’
ORDER BY wpost.post_date DESC
LIMIT 0,10? );

for this one:
FROM wp_posts as wpost
INNER JOIN wp_term_relationships ON wpost.ID = wp_term_relationships.object_id
INNER JOIN wp_term_taxonomy ON wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id
AND wp_term_taxonomy.taxonomy = ‘category’
WHERE wp_term_taxonomy.term_id IN ( 41 )
AND post_status = ‘publish’
ORDER BY wpost.post_date DESC
LIMIT 0,10

Leaving exactly everything else the same way, but I always get a syntax error, unexpected T_STRING
I think, most likely that I have made a mistake changing the code (obviously I`m not a php expert). So again thanks and apologies for the troubles!


Franco December 4, 2009 at 10:50 pm

Hi, me again, sorry to bother you again, but I have discovered that with the code you gave me to add in my sidebar.php, de submitted links, are ordered in a desc way (older at the top, I`ve changed DESC to ASC, but nothing happened, and I`ve even erased it, and nothing happened either) and the links in the side bar, don`t refresh, the first 10 links only get shown. Well, hope ypu have the time to helpme, and I really apreciatte all you did.


tripwiremag December 5, 2009 at 9:26 am

@Franco: Here’s your SQL that should work. The problem and reason why the order by did not have any effect was the ' around post_date in the order by clause.
FROM wp_posts as wpost
INNER JOIN wp_term_relationships ON wpost.ID = wp_term_relationships.object_id
INNER JOIN wp_term_taxonomy ON wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id
AND wp_term_taxonomy.taxonomy = 'category'
WHERE wp_term_taxonomy.term_id IN ( 41 )
AND post_status = 'publish'
ORDER BY wpost.post_date DESC
LIMIT 0,10


Franco December 3, 2009 at 4:19 am

in previous comment the code is missing, its p style: —->, Again thanks, maybe in the future this could help someone else!


Franco December 3, 2009 at 4:18 am

in previous comment the code is missing, its p style: —->


Franco December 2, 2009 at 3:47 am

HI!!, me again, thanks for the help. I`ve tried to add style to ““. But It didn`t work, still I`m very happy to had the user links in the site, all thanks yo tou, again thenk you very much


Franco December 1, 2009 at 5:31 am

Yeap, me again, sorry to disturb you again, but is there any way that I can style the post title within the above code, It`s the only thing left to do, hope it helps someone esle too, thanck you very much!!!!


tripwiremag December 1, 2009 at 7:04 am

@Franco: You’re welcome, happy that we fixed it 😉 I think the only way to style the title is by setting this up in the TDO form. This is because the post title contains [user link:] to make it stand out inside Wordpress. In this post you need to look for step 6 and find the text:
“Add the following code to “Custom Fields 1?. ” Just below that is the code you put into the form to add title to the post content. Hope this will work.


Franco December 1, 2009 at 4:02 am

WOW!! Thanks so much for your help!!!, it`s working now, just a couple of things. The only thing left to do is tweak it a little bit. Thanks again


Franco November 30, 2009 at 7:47 pm

Hi there, man is a bit difficult for me, I don`t know wich hack to follow from the link you gave me. Thanks again.


tripwiremag November 30, 2009 at 9:12 pm

@Franco: No problem. Try adding the code below to your sidebar.php (or whatever it is called). I tested it and it works on my test site.

    < ?php global $wpdb; $result = $wpdb->get_results(“SELECT *
    FROM wp_posts as wpost
    INNER JOIN wp_term_relationships ON wpost.ID = wp_term_relationships.object_id
    INNER JOIN wp_term_taxonomy ON wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id
    AND wp_term_taxonomy.taxonomy = ‘category’
    WHERE wp_term_taxonomy.term_id IN ( 41 )
    AND post_status = ‘publish’
    ORDER BY wpost.post_date DESC
    LIMIT 0,10” );
    foreach ($result as $post) {
    $postid = $post->ID;
    $title = $post->post_title;
    $post_content = $post->post_content;


  • < ?php echo $post_content ?>
  • < ?php } ?>


Franco November 30, 2009 at 2:38 pm

thaks, sorry for the double comment,please delete, thanks again!


Franco November 30, 2009 at 2:36 pm

Hi guys, awesome tutorial!!!. I need some help, if I add the query post widget to my sidebar, the theme “breaks down”, aparently because it is not widget ready, can anyone help me to add it manually?? or link me to a tutorial??


Franco November 30, 2009 at 4:07 am

Cool tutorial, but I need a little help, the current theme I`m using is not widget ready, can anyone help me to add de querypost widget manually?.
Thanks again!


tripwiremag November 30, 2009 at 8:00 am

@Franco: If your not using a theme with widget support I guess you have to jump directly into the code and one idea I would investigate is selecting the rows you need from the database as described here.

Just have to change the sql to something like this:
FROM wp_posts as wpost
INNER JOIN wp_term_relationships ON wpost.ID = wp_term_relationships.object_id
INNER JOIN wp_term_taxonomy ON wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id
AND wp_term_taxonomy.taxonomy = ‘category’
WHERE wp_term_taxonomy.term_id IN ( 41 )
AND post_status = ‘publish’
ORDER BY wpost.post_date DESC
LIMIT 0,10

Where 41 in “WHERE wp_term_taxonomy.term_id IN ( 41 )” is the categoty id used for user links.


Ali November 25, 2009 at 4:44 pm

this is good, l must try soon because would be nice


Leave a Reply

Your email address will not be published. Required fields are marked *

{ 6 trackbacks }

Previous post:

Next post:

Web Analytics