Bodové hodnocení příspěvku

**WP Voting**
„http://wordpress.org/extend/plugins/wp-voting/“:http://wordpress.org/extend/plugins/wp-voting/
„http://wpclue.com/2011/06/wordpress-voting-plugin/“:http://wpclue.com/2011/06/wordpress-voting-plugin/

A plugin to site owner to add voting functionality to the blog posts. Using the power of the ajax, voter can have instant voting and update to top voted widget. It doesn’t matter voter is logged in or not. Public voting is done by tracking their IP address.

Použito na webu „Abeceda angličtiny“:http://abeceda-anglictiny.cz/.

Nastavení jiného jazyka pro web (frontend) a jiného pro administraci

**User Language Switch**
„https://wordpress.org/plugins/user-language-switch/“:https://wordpress.org/plugins/user-language-switch/

Allows backend users to set the language displayed in the back-end and front-end of your site. It also allows to translate pages and posts. Define one language for admin and the other for theme. **Don’t** define WPLANG in your wp-config.php file.

A nebo:

/—code php
// setup one language for admin and the other for theme
// must be called before load_theme_textdomain()
function set_my_locale($locale) {

$locale = ( is_admin() ) ? „cz_CS“ : „en_US“;
setlocale(LC_ALL, $local );
return $locale;

}
add_filter( ‚locale‘, ‚set_my_locale‘ );
\—

Jak vytvořit a přidat vlastní shortcodes

**Zakódování e-mailové adresy**

/—code php
function cwc_mail_shortcode( $atts , $content=null ) {
for ($i = 0; $i < strlen($content); $i++) $encodedmail .= "&#" . ord($content[$i]) . ';'; return '‚.$encodedmail.‘‚;
}
add_shortcode(‚mailto‘, ‚cwc_mail_shortcode‘);
\—

Použití shortcode:

[mailto]email@yourdomain.com[/mailto]

**Obsah pouze pro přihlášené uživatele**

/—code php
function cwc_member_check_shortcode( $atts, $content = null ) {
if ( is_user_logged_in() && !is_null( $content ) && !is_feed() )
return $content;
return “;
}

add_shortcode( ‚member‘, ‚cwc_member_check_shortcode‘ );
\—

Použití shortcode:

[member]This text will be only displayed to registered users.[/member]

**Zobrazení PDF v iframe**

/—code php
function cwc_viewpdf($attr, $url) {
return ‚‚;
}
add_shortcode(‚embedpdf‘, ‚cwc_viewpdf‘);
\—

**Použití shortcode**

/—code php
[embedpdf width=“600px“ height=“500px“]http://infolab.stanford.edu/pub/papers/google.pdf[/embedpdf]
\—

**Volání shortcode v šabloně (mimo editor)**

/—code php
echo do_shortcode(‚[jmeno_shortcode]‘);
\—

viz „dokumentace“:http://codex.wordpress.org/Function_Reference/do_shortcode.

**Znepřístupnění shortcodes**

There might be some cases that you need the shortcodes of the text to be omitted. When that time comes, strip_shortcodes() is your friend.

Let’s say that you need to strip shortcodes in the homepage but let them run in other content pages:

/—code php

\—

„Jak vytvořit vlastní shortcode (musilda.cz) »“:http://musilda.cz/jak-vytvorit-vlastni-shortcode/
„10 super useful WordPress shortcodes »“:http://www.catswhocode.com/blog/10-super-useful-wordpress-shortcodes
„Mastering WordPress shortcodes »“:http://coding.smashingmagazine.com/2009/02/02/mastering-wordpress-shortcodes/
„8 fun & useful shortcode functions for WordPress »“:http://blue-anvil.com/archives/8-fun-useful-shortcode-functions-for-wordpress/

Shortcodes pro umistění widgetů do příspěvků a stránek

**Amr shortcode any widget**
„http://wordpress.org/extend/plugins/amr-shortcode-any-widget/“:http://wordpress.org/extend/plugins/amr-shortcode-any-widget/
„http://webdesign.anmari.com/category/plugins/shortcode-any-widget/“:http://webdesign.anmari.com/category/plugins/shortcode-any-widget/

Umožní použití widgetů v příspěvku nebo na stránce prostřednictvím shortcodes vložením [do_widget widgetname ] nebo [do_widget „widget name“ ].

Používání uživatelských polí v šablonách

„Using Custom Fields In Your WordPress Template »“:http://return-true.com/2010/06/using-custom-fields-in-your-wordpress-template/

/—code php
// key = název (klíč) uživatelského pole
// $post->ID lze použít pouze v loopu
if($data = get_post_meta($post->ID, ‚key‘, true)) {
echo $data;
}

// v případě pole
if($data = get_post_meta($post->ID, ‚key‘)) {
echo $data[0];
echo $data[1];
}
\—

„Detailed example“:http://codex.wordpress.org/Function_Reference/post_meta_Function_Examples for the usage of the add_post_meta, delete_post_meta, update_post_meta, and get_post_meta functions.

Úprava RSS kanálu pomocí hooku

„Action hooks and filter hooks »“:http://codex.wordpress.org/Plugin_API

„Vysvětlení a příklady »“:http://wpcandy.com/teaches/how-to-use-wordpress-hooks/

„All plugin hooks in WordPress 3.5 »“:http://adambrown.info/p/wp_hooks/version/3.5

/—code php
###################################################################################
# tento hook prida do RSS thumbnail, odstrani iframe a urizne obsah za tagem „more“
###################################################################################

function improveRSS($content) {
global $post;
if ( has_post_thumbnail( $post->ID ) ){
$content = “ . get_the_post_thumbnail( $post->ID, ‚rss-thumbnail‘, array( ‚style‘ => ‚margin:0; border: 10px solid #202020‘ ) ) . “ . $content;
}

$content = preg_replace( ‚//is‘, “, $content );

$teaser = preg_split( ‚/<\/span>/‘, $content );
$readmore = ‚Více na webu »‚;
$content = $teaser[0].$readmore;
return $content;
}

add_filter(‚the_excerpt_rss‘, ‚improveRSS‘);
add_filter(‚the_content_feed‘, ‚improveRSS‘);
\—

Automatické stažení náhledů videa z videoserverů

**Video Thumbnails**
„http://wordpress.org/extend/plugins/video-thumbnails/“:http://wordpress.org/extend/plugins/video-thumbnails/

Video Thumbnails makes it easy to automatically display video thumbnails in your template. When you publish a post, this plugin will find the first video embedded and locate the thumbnail for you. Thumbnails can be saved to your media library and set as a featured image automatically. There’s even support for custom post types and custom fields!

Adresy náhledových obrázků na YouTube:

img.youtube.com/vi/VIDEO_ID/#.jpg

# 1,2,3 – 120×90 px
# 0 – 480×360 px

(Použito např. na „abeceda-anglictiny.cz“:http://abeceda-anglictiny.cz/)

Generátor .po souborů, konvertor .mo souborů

„This generator“:http://www.icanlocalize.com/tools/php_scanner will scan PHP file(s) and create .po files, that are used for localization. It will extract all strings wrapped in __(„txt“, „domain“) and _e(„txt“, „domain“) calls.

Strings can be enclosed in either double quotes („) or single quotes(‚) and with any character encoding.

You can upload a single PHP file or a ZIP file containing multiple files. The scanner will extract strings from all PHP files inside the archive, ignoring other files (like images and stylesheets).

„Nástroj pro Konverzi z .mo do .po »“:http://tools.konstruktors.com/

Vytváření PDF verze stránek nebo příspěvků

**PDF24 Articles To PDF**
„http://wordpress.org/extend/plugins/pdf24-posts-to-pdf/“:http://wordpress.org/extend/plugins/pdf24-posts-to-pdf/

This plugin enables your blog readers to create PDF files of one or more articles in your blog. A little box is shown below or above every article, in a sidebar, on the top or bottom of a page or wherever you want in your wordpress blog by inserting a peace of code in a template.

A PDF box or a PDF link below or above each article creates a PDF file with the corresponding article only. A PDF widget box in the sidebar or above or below all articles creates a PDF file with all articles on the current page.

The PDF boxes, PDF links and the format of the PDF file can be highly customized by CSS and templates. Furthermore you can configure a lot of other parts of the plugin by editing the plugin settings which are provided in your WordPress admin area.

Odkaz na náhled dosud nepublikovaného příspěvku bez přihlášení

**Public Post Preview**
„http://wordpress.org/extend/plugins/public-post-preview/“:http://wordpress.org/extend/plugins/public-post-preview/

Enables you to give a link to anonymous users for public preview of a post (or any other public post type) before it is published.

Have you ever been writing a post with the help of someone who does not have access to your blog and needed to give them the ability to preview it before publishing? This plugin takes care of that by generating an URL with an expiring nonce that can be given out for public preview.