Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter Agnes

    (@agneslesagegmailcom)

    OK, What I am really trying to do is to be able call an URL (using a global variable) but be able to import my own text in there

    Typically: Here is [UrlGamme text=”my text”]
    That would output:

    <a href="$myUrlGamme">my text</a>

    For now I have put this in a shortcode:

    [UrlGamme]

    global $myUrl_Gamme;
    echo ‘<a href=”‘;
    echo $myUrl_Gamme;
    echo ‘”>’;

    But I dont know how to pass the text parameter…. The doc I find is not for this plugin…

    Thanlks for help?

    Plugin Contributor M66B

    (@m66b)

    Look at the bottom of the plugin page for a quick hint to pass parameters.

    If you need more information, follow the link ‘Shortcode API’ in the ‘Resources’ section in the left top of the plugin page.

    Thread Starter Agnes

    (@agneslesagegmailcom)

    It is actually the quick hints that let me think I can do better than simple use ??

    I cant find the API link?

    Thanks for the support

    Plugin Contributor M66B

    (@m66b)

    Thread Starter Agnes

    (@agneslesagegmailcom)

    Oh, I thought you were talking of an API for the plugin. But that is right, thanks!

    Thread Starter Agnes

    (@agneslesagegmailcom)

    Thanks the Codex, I ve found the way to make one complicate one!

    This outputs the name and link of a top parent (Gamme), with the posibility to append a text bore the name and after the name, yet in the link.

    I can use
    [gamme] for the name and link to the Gamme (ex: “buffets”)
    [gamme before=”the best” after =”in Paris”] (ex: “the best buffets in Paris”)
    [gamme] you won’t forget[/buffets] (ex: “buffets you won’t forget”)

    $parents = get_post_ancestors( $post->ID );
    $myId_Gamme = ($parents) ? $parents[count($parents)-1]: $post->ID;
    $myUrl_Gamme = get_permalink($myId_Gamme);
    $myName_Gamme = get_the_title($myId_Gamme);
    extract(shortcode_atts(array(
    	"before" => '',
    	"after" => '',
    	), $atts));
    
    echo '<a href="'.$myUrl_Gamme.'" title="'.$myName_Gamme.'">'.$before.''.$myName_Gamme.''.$after.''.$content.'</a>';

    It would be nice to put on bottom of the plugin settings a link to the API WP codex that gives examples.

    Thanks for the prompt support!

    Plugin Contributor M66B

    (@m66b)

    I am glad you sorted everything out.
    The link to the WordPress codex is in the yellow resources panel in the top right of the plugin page.

    Thread Starter Agnes

    (@agneslesagegmailcom)

    Thanks!
    I suggest yet to add it to the bottom of the plugin settings page, aside the mentions on parameters – son one understand they are actually just nromal ones.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘How to use [Url Toto][/Url] ?’ is closed to new replies.