krenzelman Posted November 20, 2013 Share Posted November 20, 2013 Working in WordPress. I want to make it so that when a user puts a url into a field that it automatically links and displays the name of the page it is linking to not the url itself. How would I go about making that work or is it even possible? Here's the code I'm working from.. <?php if($item_website): ?> <tr class="detail"> <td class="detail-label"><?php echo __('Website','company'); ?></td> <td class="detail"><a href="<?php echo $item_website; ?>" class="text-green"><?php echo $item_website; ?></td> </tr> <?php endif; ?> Quote Link to comment Share on other sites More sharing options...
dalecosp Posted November 20, 2013 Share Posted November 20, 2013 If I'm understanding correctly, you'd need code that would fetch the page at the URL, parse it for it's TITLE tag and various other attributes, and then display them. Should be possible. Quote Link to comment Share on other sites More sharing options...
krenzelman Posted November 21, 2013 Author Share Posted November 21, 2013 If I'm understanding correctly, you'd need code that would fetch the page at the URL, parse it for it's TITLE tag and various other attributes, and then display them. Should be possible. That is correct Dale. Quote Link to comment Share on other sites More sharing options...
digibucc Posted November 21, 2013 Share Posted November 21, 2013 how automatic? if you want it immediately after entering it into the box, it will require javascript and be much more complicated. if you want it after the submit button, then it just needs php and you can use php's curl function to accomplish what you want. the piece of code you show needs the info already, where is the address entered by a user, and where is the code that that form uses for an action? Quote Link to comment Share on other sites More sharing options...
krenzelman Posted November 22, 2013 Author Share Posted November 22, 2013 how automatic? if you want it immediately after entering it into the box, it will require javascript and be much more complicated. if you want it after the submit button, then it just needs php and you can use php's curl function to accomplish what you want. the piece of code you show needs the info already, where is the address entered by a user, and where is the code that that form uses for an action? I just want it to appear after hitting the submit button. The address is entered in a form at the bottom of the Wordpress page editor, as seen below.. I didn't build the theme.. I'm just trying to customize it with very little knowledge, so I apologize if I sound like an idiot. I think this is the code that it draws from: array( 'name' => __('Website', 'company'), 'id' => $prefix . 'item_website', 'type' => 'text', 'desc' => __('', 'companyl') ), Photo of WP Form Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.