mayaboni
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Make Clickable URLsCan I at least make all external links open in new tab using that make_clickable() function?
Forum: Fixing WordPress
In reply to: Make Clickable URLsI need to customize urls opening in one page that will warn user he is leaving my site, so i have link holder also, and output link, that same after he proced will go into iframe document(page).
Yes, I know I can make warning on another way, but this is the only way I want to do it.
I saw it somewhere and I am in love with this way of openning external urls.
Forum: Fixing WordPress
In reply to: Make Clickable URLsOk.
I have new function that I made before I discovered make_clickable().
Here it is:
function url_auto( $atts, $content = null ) { $url_pattern = "/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)/"; $text = get_the_content(); $cnt = substr($text, 0, strpos($text, '/', strpos($text, '/')+2)); $cnt = str_replace('http://www.', '', $cnt); $cnt = str_replace('http://', '', $cnt); $cnt = str_replace('www.', '', $cnt); $replace = '<a href="$1" target="_blank">$2</a>'; $text= preg_replace($url_pattern, $replace, $text); echo $text; } add_filter( 'the_content', 'url_auto' );Is it possible to remove this filter in shortcodes and html, because it broke my embeds and my shortcodes aswell.
Forum: Fixing WordPress
In reply to: Make Clickable URLsI know, the content is everything inside post.
But, still it is weird.function url_auto( $atts, $content = null ) { $string = get_the_content(); echo make_clickable($string); } add_filter( 'the_content', 'url_auto' );This outputs everything nice and links are clickable. Than logic would be that mine function. I will try with another way if not possible I ‘ll quit. I am very limited with php. Even what I knew I am confused more now.
Forum: Fixing WordPress
In reply to: Make Clickable URLsResult should be:
<a href="http://wordpress.org">okokok</a>This is wordpress website, ....And not all content inside href.
Forum: Fixing WordPress
In reply to: Make Clickable URLsI am newbie.
I kinda sort it out now with quotes.
With double quotes i have to add \ before any quote that shouldn’t be the end of an string.Problem here is this, if I use function like this:
function url_auto( $atts, $content = null ) { $string = get_the_content(); echo make_clickable($string); }This will output nice.
But I need to customize that to output url into my html form (link holder page).Tried:
$string= "<a href=\"/external/?link=" . get_the_content() . "\" target=\"_blank\">okokok</a>";and
$string = '<a href="/external/?link=' . get_the_content() . '">okokok</a>';Both outputing everything inside post.
For example, output is like:
<a href="http://wordpress.orgThis is wordpress website, ....">okokok</a>This is confusing.
Forum: Fixing WordPress
In reply to: How to change image when posting article on Facebook?header.php
find <head>
add after
Forum: Fixing WordPress
In reply to: Remove filter?Still, it messes html and shortcodes. π
Forum: Fixing WordPress
In reply to: Remove filter?That will remove filter even in plain text.
I am doing this:
function url_auto( $atts, $content = null ) { $url_pattern = "/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)/"; $text = get_the_content(); $replace = '<a href="$1" target="_blank">$2</a>'; $text= preg_replace($url_pattern, $replace, $text); echo $text; } add_filter( 'the_content', 'url_auto' );URL to HTML.
Forum: Fixing WordPress
In reply to: Auto URL to HTML in WordPressI solved it, with help on another place.
Forum: Fixing WordPress
In reply to: How to change image when posting article on Facebook?Add to header:
<meta property=”og:image” content=”IMAGE URL” />