Not signed in ( Sign In)

Categories

Welcome, Guest

Want to take part in these discussions? Sign in if you have an account, or apply for one below

Vanilla 1.1.10 is a product of Lussumo. More Information: Documentation, Community Support.

    •  
      CommentAuthorfastidioso
    • CommentTimeFeb 18th 2010 edited
     permalink
    I made a simple change to the plugin.
    I do not use more Technorati but the TAGS inserted automatically become the keys to quick search.
    In this way you can have sub categories ...I share just in case:


    <?php
    /*
    Plugin Name: SimpleTags
    Plugin URI: http://www.broobles.com/scripts/simpletags/
    Description: Allows you to create a list of Technorati tags at the bottom of your post by providing a comma separated list of tags between the [tags] tags. You can use it with any blogging tool/method, not just when posting from WordPress itself (doesn't use custom fields). Supports multiple words within tags. Also allows in-post tagging of words by enclosing them in [tag] tags. Works with the WYSIWYG editor.
    Version: 2.0
    Date: January 3rd, 2006
    Author: Broobles
    Author URI: http://www.broobles.com
    Contributors: Artur Ortega, Elias Schwerdtfeger <elias@weltretter.de>
    */



    function simpleTags($text) {


    // Change these if you want something else to appear before and after the tags.
    // Leave them blank ("") if you don't want any text to appear around the tags.
    // <p> tags added in 1.2 for backward compatibility with previous versions.
    $pre_replacement = '<p>Key Search: ';
    $post_replacement = '</p>';
    // If you want to use the tags inside a div, you can do something like this:
    // $pre_replacement = '<div class="simpletags">Key Search: ';
    // $post_replacement = '</div>';

    $tag_url = "http://www.xxxxxxxxx.com/search.php?q=";
    $tag_url_end = "&search=search";

    $tag_pattern = '/(\[tag\](.*?)\[\/tag\])/i';
    // Following line used to be:
    // $tags_pattern = '/(\[tags\](.*?)\[\/tags\])/i';
    // Enhanced by Elias Schwerdtfeger in 1.2 to remove the superflous paragraph
    // generated by WordPress and allow for valid XHTML (if you use divs,
    // they would be enclosed withing a paragraph which is invalid).
    // For backward compatibility, we've added <p> and </p> to $pre_replacement
    // and $post_replacement respectively.
    $tags_pattern = '/((?:<p>)?\s*\[tags\](.*?)\[\/tags\]\s*(?:<\/p>)?)/i';

    $tags_count = 0;
    $taglist_exists = 0; # Set to 1 if the tags list is present

    # Check for in-post [tag] [/tag]
    if (preg_match_all ($tag_pattern, $text, $matches)) {
    unset($technotags);
    $technotags = $pre_replacement;
    for ($m=0; $m<count($matches[0]); $m++) {
    unset($ttags);
    $ttags = explode(",", $matches[2][$m]);
    for ($i=0; $i<count($ttags); $i++) {
    $technotags .= '<a href="' . $tag_url . urlencode(trim($ttags[$i])) . $tag_url_end . '" rel="tag">' . trim($ttags[$i]) . '</a>';
    if ($i<count($ttags)-1) {$technotags.= ", "; }
    $tags_count += 1;
    }
    $text = str_replace($matches[0][$m],$matches[2][$m],$text);
    if ($m<count($matches[0])-1) {$technotags.= ", "; }
    }
    }

    # Check for [tags] [/tags]
    if (preg_match ($tags_pattern, $text, $matches)) {
    $taglist_exists = 1;
    if ($tags_count==0) {
    $technotags = $pre_replacement;
    } else {
    $technotags .= ", ";
    }

    unset($ttags);
    $ttags = explode(",", $matches[2]);
    for ($i=0; $i<count($ttags); $i++) {
    $technotags .= '<a href="' . $tag_url . urlencode(trim($ttags[$i])) . $tag_url_end . '" rel="tag">' . $ttags[$i] . '</a>';
    if ($i<count($ttags)-1) { $technotags .= ", "; }
    $tags_count += 1;
    }
    }

    # If tags were found, include them in the post
    if ($tags_count>0) {
    $technotags .= $post_replacement;
    if ($taglist_exists == 1) {
    $text = preg_replace($tags_pattern,$technotags,$text);
    } else {
    $text .= $technotags;
    }
    }

    return $text;
    }

    add_filter('the_content', 'simpleTags');

    ?>




    Ciau!
    •  
      CommentAuthorlantaca
    • CommentTimeFeb 19th 2010
     permalink
    ciao, non ho capito a che serve il plug in, potresti spiegarmi cosa fa? magari con un esempio
    •  
      CommentAuthorfastidioso
    • CommentTimeFeb 19th 2010
     permalink
    Ciao, niente di speciale...
    nel mio caso ad esempio ho creato una categoria "Fotografie", poi sotto ogni post aggiungo questo "tag" con valori come "Viaggi", "Amici", "Capodanno", etc...

    Se uno vuole trovare tutti i post con le fotografie clicca sulla categoria, mentre se vuole vedere le foto solo dei soli viaggi clicca sul Tag che alla fine, altro non รจ che una chiave di ricerca...

      ..peccato che la ricerca delle parole su flatpress funziona solo sui "titoli"...


    E' banale, ma almeno ho trovato un uso per un plugin che non mi serviva a nulla :)

    Se vuoi puoi guardare qua: link
    e cliccare sul tag

    Ciau!