Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

There is lots of information out there on how to customize meta boxes added with add_meta_box(), such as enabling WYSIWYG editors on textareas and uploading images.

What I have yet to find is a way to reuse WordPress 3.1 Internal Linking feature. Many of my custom fields contain urls to other pages on the site. The new Internal Linking feature would make it a lot easier for my users to find a page URL rather than having to remember it of cut & paste it.

Is the new Internal Linking feature reusable in conjunction with add_meta_box()?

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

WordPress 3.1 Internal Linking feature was coded as a TinyMCE editor plugin so its not really a widget or a meta box but you can code your own meta box and reuse the functiona needed for that.

The files you need to look at are

  • /wp-includes/js/tinymce/wp-mce-link.php
  • /wp-includes/js/tinymce/plugins/wplink/js/wplink.js and maybe a few more but these are the main files you will need to achieve this functionality.

Side note: I can tell you that up until now when ever i needed to let my user add a url to a post or a page as a custom field i always created a dropdown select with the names of my posts and there id as value, then when i needed to show that link i'd call get_the_permalink(selected_ID);. Now i know that this won't work in all cases but its an option and i wanted to post it here for future reference.

Hope this helps,

Ohad.

share|improve this answer
    
@בניית אתרים Thanks! Yes a dropdown with pages/posts are a possible solution but I find the Search feature very useful. I am looking for a way to leverage the existing functionality rather than have to rebuild it myself. To let other users give their advice, will leave the question unanswered for the day. –  Bundarr Feb 7 '11 at 15:33
    
Did you ever get this to work using Wordpress 3.1's official internal linking? –  Joe Mar 10 '11 at 7:05
    
@Joe No I did not get it to work ... I decided to roll my own rather than try to use the existing one. I create a plugin called I called post-selector that displays the list of content like the Internal Linking feature, but inline, not in a modal window. With JS I just send the Id of the selected post to a hidden field. I still need to ajaxify it and add search functionality. –  Bundarr Mar 17 '11 at 17:36
    
@Bundarr let us know if you need any help –  Bainternet Mar 17 '11 at 18:41
    
@Bainternet - can you post an example of your select box code? –  codecowboy Jul 10 '11 at 16:32
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.