Get link value only from the_content()?

You can scan the content to see whether it contains a link and then parse it to find the href attribute. There are many ways to do this, this example uses the built-in kses functionality, as demonstrated by Otto: $post_link = get_the_permalink(); if ( preg_match(‘/<a (.+?)>/’, get_the_content(), $match) ) { $link = array(); foreach ( … Read more

root-relative links for multiple parked domains

I tracked the function calls in my theme (a child theme of Oenology by Chip Bennett) and wp-include that generate the links, found the home_url() function, and then wrote these functions for my site: function gregory_make_relative($url=””) { return preg_replace( ‘#^https?://[^/]+/#iu’, “https://wordpress.stackexchange.com/”, $url, 1 ); } add_filter( ‘home_url’, ‘gregory_make_relative’, 11, 1 ); I intentionally grep-searched to … Read more

get_category_link() is returning nothing

You should be using get_term_link instead, also for consistencys sake and to future proof, use get_terms instead of get_categories. Both work on categories/tags and all custom taxonomies. Also check for the return of a WP_Error object ( returned when an invalid or nonexistent term is passed )

Count and show Clicks on external links in a single page/post

Yes, it is possible. You can do this with ajax call that updates post meta field before the link is followed. In the example, I used admin and non-admin users who click the link and automatic increase link_check_click_counter in the post meta. I used here the example to show the data using wp_footer. You can … Read more

Creating a Link Directory using WordPress?

A great starting point would be Mike’s answer to the question about cloning CrunchBase. You’ll want to do something similar with custom post types for entries in your directory. If you want to allow visitors to submit sites, you could perhaps use the TDO Mini Forms plugin to allow visitors to create a new listing, … Read more

Is it possible to link to draft pages?

I should start off by saying that linking to drafts will only work for logged in users (with appropriate permissions) – other users will simply hit a 404 Not Found! You’d be much better off getting all your content ready & published, or only link to it once it is ready! Nevertheless, to answer your … Read more