Support » Plugin: Humans TXT » Suggestion of additional variables

  • Resolved Xoyozo

    (@xoyozo)


    Hello Till,

    I’ve a few points to suggest:

    1.) The variable $wp-letzte-aktualisierung$ doesn’t work (for me). The preview in the right variable-column with mouse hover works surprisingly. – $wp-lastupdate$ does work.

    2.) I think it would be better not to have the variables in localization, so not to translate them. For me are “German named variables” (e.g. “letzte-aktualisierung”) a bit confusing.

    3.) I’d like to readout the installed localization of WordPress (e.g. “3.9.1–de_DE” or “3.9.1–en_US” so that I can set the language automatically e.g. like this:
    CMS: WordPress $wp-version$ (Language: $wp-localization$)
    CMS: WordPress 3.9.1 (Language: German)

    4.) The variable $wp-sprache$ doesn’t work for me either. The preview in the right variable-column with mouse hover works. – And if I use the WPML plugin (WPML Multilingual CMS) than the preview is translated like “Englisch, Deutsch”, but of course I’d liek to have this in English (English, German)! – $wp-language$ does work.

    5.) The variables $mysql-version$ and $php-version$ work like a charm, but I additionally would like to readout the following platform releases/versions, because $server-os$ brings to much information for me (in my case: “Linux info 3.0 #1337 SMP Tue Jan 01 00:00:00 CEST 2000 all GNU/Linux”). Would that be possible?
    Platform: LAMP ($linux-distribution$ $linux-version$, Apache $apache-version$, MySQL $mysql-version$, PHP $php-version$)
    Platform: LAMP (Debian 7.6, Apache 2.4.10, MySQL 5.1.73, PHP 5.5.14)

    TIA and
    Many greetings from Germany!

    https://wordpress.org/plugins/humanstxt/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Till Krüss

    (@tillkruess)

    Hallöchen!

    1&4: I just discovered that none of the translated variables get replaced, I’ll release a plugin update soon that fixes this.

    2: Variable names will be translated like the rest of the UI, it’s easier for non-english folks.

    3&5: You can add your own custom human.txt variables using the humanstxt_variables filter, have a look at the function humanstxt_variables().

    add_filter( 'humanstxt_variables', function( $variables ) {
    	// $variables[] = array( $group, $name, $name_localized, $callback, $description );
    	return $variables;
    });
    Thread Starter Xoyozo

    (@xoyozo)

    Hi Till,

    thank you for your prompt reply and the plugin update that fixes this issue.

    1&4: Thanks. After submiting of my posting I’ve just realized that probably all translated variables do not work.

    2: Okay, in that case it would be great if I could configure (e.g. in the configuration area of the Human TXT plugin) whether the variable names will be translated or not.

    3&5: Yes okay, but I don’t want to dig into code anymore because with a larger number of website projects to manage with different themes and various plugins a maintenance is hardly possible at least if you do not document very well. If the automatic update mechanisms no longer work this easily then the regular maintenance will be too much work.

    6.) One additional suggestion:
    It would be great if I could configure quite comfortable in the configuration area of the Human TXT plugin:
    – the maximum number of stored revisions (if set to 0, revisions will be disabled)
    – deleting of revisions (e.g. on the revision subpage “Humans TXT: Revisionen”)

    Thanks in advance.

    PS: Übrigens, mein Vorname ist auch Till. 🙂

    Plugin Author Till Krüss

    (@tillkruess)

    Witzig.

    1&4: I released 1.2.7, the translated variables should work now.

    2: You can use either, the english/primary one or the translated one, but the admin UI will be translated into the default WordPress language.

    3&5: Use the humanstxt_variables filter in independent/separate location, like a mu-plugin, that way a plugin update will not remove your customizations.

    6: The default number of stored revisions is 50. You can change that number using the humanstxt_max_revisions filter. If you want to disable revisions entirely, return 0 using this filter.

    WordPress doesn’t offer a way to delete a single revision, so I won’t include an option to do that : )

    Thread Starter Xoyozo

    (@xoyozo)

    Hello Till,

    all right, thanks again for your informations.

    One thing isn’t probably still not quite clear to me, namely where I need to edit the file so that the humanstxt_variables filter get active? Does that mean that I’ve to create a file (filename?) in the directory /wp-content/mu-plugins, in which I afterwards can set the desired filter values ​​accordingly? Could you give me an example of this or point me to a source of information?

    Thanks in advance
    and many greetings!

    Plugin Author Till Krüss

    (@tillkruess)

    Yeah, create a file in wp-content/mu-plugins named for example humanstxt.php and then add your custom filters. That way when you update the plugin, your customizations remain intact.

    <?php
    /*
    Plugin Name: Humans TXT Customizations
    Description: Custom code for the Humans TXT plugin.
    */
    
    // disable revisions
    add_filter( 'humanstxt_max_revisions', function( $email ) {
    	return 0;
    });
    
    // add custom humans.txt variables
    add_filter( 'humanstxt_variables', function( $variables ) {
    	// $variables[] = array( $group, $name, $name_localized, $callback, $description );
    	return $variables;
    });
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Suggestion of additional variables’ is closed to new replies.