• Resolved erdalatabalkan

    (@erdalatabalkan)


    To contribute, I have added a code to the attachment to URL and TAG posting.

    /wp-content/plugins/auto-post-to-instagram/wp2instagram.php

    $caption = get_the_title($ID); // caption

    Change

    $tags	= get_the_tags($ID);
     $tagged = '';
     if ( $tags ) {
     foreach ( $tags as $tag ) { $tagged[] = rawurlencode($tag->name); }
     $tagged = implode('#',$tagged);
     }
     $caption = get_the_title($ID)."\n".home_url('?p='.$ID)."\n#".$tagged;     // caption

    Tags
    Sonuç

Viewing 3 replies - 1 through 3 (of 3 total)
  • Wow, what a great contribution. Any idea how to also add price and other hashtags also?

    Thanks

    Edit: then again i noticed it’s just for new post. Still not bad i guess.

    hi. where i need to put the script?
    thx

    Very useful addition! I modified it slightly to be able to throw out any special characters that exist in the tags and to be able to handle any special characters that exist in the title as well. I also added an extra line between the title, url, and tags. Here is what I ended up with:

    $tags	= get_the_tags($ID);
    $tagged = '';
    if ( $tags ) {
    	foreach ( $tags as $tag ) { $tagged[] = rawurlencode(preg_replace('/[^A-Za-z0-9\-]/', '', htmlspecialchars_decode($tag->name))); }
    	$tagged = implode(' #',$tagged);
    }
    $caption = htmlspecialchars_decode(get_the_title($ID))."\n\n".home_url('?p='.$ID)."\n\n#".$tagged;     // caption
    • This reply was modified 8 years, 10 months ago by jwenz723.
Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘URL and TAGS’ is closed to new replies.