Zjištění ID rodičovské kategorie

Potřebujete-li v loopu např. ve výpisu příspěvků z rubriky (archivu) zjistit u každého příspěvku ID kořenové rubriky (tedy jsou-li rubriky vnořené), vložte do *functions.php* funkci

/—code php
/*
* Returns ID of top-level parent category, or current category if you are viewing a top-level
*
* @param string $catid Category ID to be checked
* @return string $catParent ID of top-level parent category
*/
function pa_category_top_parent_id ($catid) {
while ($catid) {
$cat = get_category($catid); // get the object for the catid
$catid = $cat->category_parent; // assign parent ID (if exists) to $catid
// the while loop will continue whilst there is a $catid
// when there is no longer a parent $catid will be NULL so we can assign our $catParent
$catParent = $cat->cat_ID;
}
return $catParent;
}
\—

a v loopu si ji pak jen zavoláme pro hodnotu ID:

/—code php
$catid = get_query_var(‚cat‘);
$topcat = pa_category_top_parent_id ($catid);
// a můžeme použít třeba v podmínce
if ($topcat == konkretni-hodnota-id): neco-udelej;
\—

„Zdroj »“:http://alex.leonard.ie/2011/04/20/wordpress-get-id-of-top-level-parent-category/

Jetpack – řada rozšíření v jednom balíku

**Jetpack**
„http://wordpress.org/extend/plugins/jetpack/“:http://wordpress.org/extend/plugins/jetpack/
„http://jetpack.me/“:http://jetpack.me/

– Simple, concise stats with no additional load on your server. Previously provided by WordPress.com Stats.
– Email subscriptions for your blog’s posts and your post’s comments.
– Social networking enabled comment system.
– Monitor and manage your site’s activity with Notifications in your Toolbar and on WordPress.com.
Simple, Akismet-backed contact forms.
– The WP.me URL shortener.
– Hovercard popups for your commenters via Gravatar.
– Easily embedded media from popular sites like YouTube, Digg, and Vimeo.
– The ability to post to your blog from any email client.
– Integration with and automatic posting to your favorite social networks including Twitter, Facebook, Tumblr, and LinkedIn.
– For the Math geeks, a simple way to include beautiful mathematical expressions on your site.
– A widget for displaying recent tweets. Previously provided by Wickett Twitter Widget
– Your readers can easily share your posts via email or their favorite social networks. Previously provided by the Sharedaddy WordPress plugin.
– With Carousel active, any standard WordPress galleries you have embedded in posts or pages will launch a gorgeous full-screen photo browsing experience with comments and EXIF metadata.
– A CSS editor that lets you customize your site design without modifying your theme.
– A mobile theme that automatically streamlines your site for visitors on mobile devices.
– Mobile push notifications for new comments via WordPress mobile apps.
– The ability to allow applications to securely authenticate and access your site with your permission.

**Slim Jetpack**
„http://wordpress.org/plugins/slimjetpack/“:http://wordpress.org/plugins/slimjetpack/

Slim version of Jetpack unlinked from WordPress.com 🙂
Author smashed the original Jetpack bundle to remove the annoying parts and keep the awesomeness.

Dobré jsou moduly „sharing“ pro sociální sítě, „infinite scroll“ (načítání dalších článků po odrolování na konec stránky) a „mobile theme“ pro zobrazování webu na mobilních zařízeních.

If you need a new module from Jetpack future releases, copy the files into Slim Jetpack and try.
It should work .

Nepotřebné moduly stačí (souborově) smazat z adresáře.

Počet přečtení článku za pomoci Google Analytics

Pokud u svých článků chcete zobrazovat počet přečtení, tak WordPress vám nabídne velké množství pluginů, které můžete použít. Velkou nevýhodou je ovšem fakt, že začínáte lidově řečeno od nuly. I když už vaším blogem prošly tisíce lidí, tak u všech článků vám bude svítit děsivá nula. Pokud k měření návštěvnosti používáte Google Analytics, mám pro […]

Poznámky administrátora ke kódu nebo pro zákazníka

**Peter’s Post Notes for WordPress**
„http://wordpress.org/extend/plugins/peters-post-notes/“:http://wordpress.org/extend/plugins/peters-post-notes/
„http://www.theblog.ca/wordpress-post-notes“:http://www.theblog.ca/wordpress-post-notes

This plugin adds a panel to the sidebar of the add and edit post / page screens so that users can add notes for themselves or others and keep track of these notes. Whenever you save a post, you can type a note to be displayed along with the post in the edit view.

When used with „Peter’s Collaboration E-mails“:http://wordpress.org/extend/plugins/peters-collaboration-e-mails/ 1.2 and up, the notes are sent along with the e-mails in the collaboration workflow. There is also a general and private notes system on the dashboard.

Možnost přidat poznámku ke každé stránce či příspěvku.

**Simple Admin Notes**
„http://wordpress.org/extend/plugins/simple-admin-notes/“:http://wordpress.org/extend/plugins/simple-admin-notes/

Adds a simple „Notes“ section to the admin menu for taking down….notes
Like a built in notepad, can leave notes for clients or yourself.

– Uses WordPress’s built in custom post types
– Works like a regular post
– Functions with default WYSIWYG editor
– Shows all „Notes“ on one page in tab format
– Will not show in front end or search
– Requires default post privileges

Plusem je WYSIWYG editor, tj. např. možnost odkazovat na komentované příspěvky, asi nejlepší.

**WordPress Admin Notepad**
„http://wordpress.org/extend/plugins/wordpress-admin-notepad/“:http://wordpress.org/extend/plugins/wordpress-admin-notepad/

Podobný jako předchozí, s jediným oknem pro poznámky. Možnost zapnout zobrazení poznámek na každé stránce.
Lze konfigurovat ne/viditelnost a ne/editovatelnost pro 4 základní skupiny uživatelů.

**Dashboard Notepad**
„http://wordpress.org/extend/plugins/dashboard-notepad/“:http://wordpress.org/extend/plugins/dashboard-notepad/

This dashboard widget provides a simple notepad. The widget settings allow you to choose which roles can edit the notes, and which roles can merely read them.

You can display the contents of your notepad using a template tag and/or shortcode. The widget permissions apply to these tags as well: only users with permission to read the notes will see the notes on the front end. You can use div#dashboard-notes in your theme’s CSS file to style the notes.

**Dashboard Post-it**
„http://wordpress.org/extend/plugins/dashboard-post-it/“:http://wordpress.org/extend/plugins/dashboard-post-it/

Adds a simple ‚Post-it‘ widget to the Dashboard that allows you to leave yourself or other authors a note. The plugin can be configured and moved around as any other Dashboard widget. It will accept plain text or (sanitized) HTML. Only users with the capability „Edit dashboard“ can edit the note.

**Dashboard Site Notes**
„http://wordpress.org/extend/plugins/admin-dashboard-site-notes/“:http://wordpress.org/extend/plugins/admin-dashboard-site-notes/

Add notes as admin notices in contextual help tabs, as well as compile them into an instruction manual or placed in a dashboard widget.

This is intended to build instructions into a site for clients, so it is focused on providing abilities only to the highest role of user available on a site, although it can be configured as a general purpose tool to leave temporary notes to any group on your site that has admin access.

**WP Help**
„http://wordpress.org/extend/plugins/wp-help/“:http://wordpress.org/extend/plugins/wp-help/

Site operators can create detailed, hierarchical documentation for the site’s authors, editors, and contributors, viewable in the WordPress admin. Powered by Custom Post Types, you get all the power of WordPress to create, edit, and arrange your documentation. Perfect for customized client sites. Never send another „here’s how to use your site“ e-mail again!

You can now pull in help documents from another WP Help install, and they will be automatically updated when the source documents change (even additions and deletions!). Perfect for WordPress multisite installs, or consultants with a large number of client installs.

WYSIWYG pro popis uživatele

Následující kratičký kód zobrazí #WYSIWYG editor u popisu autora u uživatelského profilu:

Kód stačí přidat do function.php ve vašem template:

<?php
/**
 * WYSIWYG pro uzivatelsky profil WordPress
 *
 * @author Roman Ozana <ozana@omdesign.cz>
 */
class CustomUserProfile {

	/** @var array */
	private $tinymceOptions = array(
		'teeny' => true,
		'quicktags' => false,
		'media_buttons' => false, 'textarea_rows' => 8,
		'wpautop' => false,
		'tinymce' => array(
			'theme_advanced_buttons1' => 'p, bold, italic, ul, |,link,unlink,code',
			'theme_advanced_buttons2' => '',
			'theme_advanced_buttons3' => '',
			'theme_advanced_buttons4' => '',
		),
	);

	public function __construct() {
		add_action('show_user_profile', array($this, 'initDescriptionWysywig'));
		add_action('edit_user_profile', array($this, 'initDescriptionWysywig'));
	}

	/**
	 * Wysywig editor take pro description
	 *
	 * @param $options
	 */
	public function initDescriptionWysywig($options) {
		if ( ! class_exists('_WP_Editors' ) )
			require_once( ABSPATH . WPINC . '/class-wp-editor.php' );

		$options = _WP_Editors::parse_settings('description', $this->tinymceOptions);
		_WP_Editors::editor_settings('description', $options);
		wp_print_styles('editor-buttons');
	}

}
new CustomUserProfile();

#wordpress #php

Jak nainstalovat češtinu do WordPressu

Ano, jak všichni správně víte, tak WordPress je pravidelně překládán do češtiny (v poslední době to trochu vázne, ale měl by to být jen dočasný problém). Ovšem, může se stát, že si stáhnete anglickou verzi nebo vám hosting sám vytvoří cizojazyčnou mutaci. Vy si web nastavíte, vložíte články a ejhle, uvědomíte si, že potřebujete nahodit […]

Začínáme s wordpressem, 7.část – V administraci příspěvků

Dnes si ukážeme chytré úpravy, které nám usnadní pohyb a především listování v administraci. To nejen v příspěvcích, ale i ve stránkách, odkazech či komentářích, které využívají stejný interface. Jako ve většině případů i zde můžete použít pluginy, které váš WordPress patřičně vylepší. A jak může vypadat takový upravený výpis? Všimněte si především tlačítka “Nastavení […]

Delicate

With Delicate you can adjust Color scheme, display Header image or Page-based Slideshow, choose custom Slideshow effects and control Transition speed. This is a free professional WordPress theme built on the NattyWP CMS Framework.

[* http://wp-themes.com/wp-content/themes/delicate/screenshot.png *]

„Demo »“:http://wp-themes.com/delicate/?TB_iframe=true&width=1416&height=692

„Nastavení/Settings »“:http://support.nattywp.com/index.php?act=kb&code=cat&id=4

Inzertní odkazy pod článkem

**EasyAd**
„http://www.pes502.cz/plugin_easyad/easyad-plugin-pro-wordpress“:http://www.pes502.cz/plugin_easyad/easyad-plugin-pro-wordpress

EasyAd je jednoduchý plugin pro redakční systém WordPress, který umožňuje okamžitý prodej přímých odkazů pod jednotlivými články. Návštěvník pomocí několika kliknutí objedná a ihned zaplatí přímý odkaz pod vybraným článkem pomocí systému PayPal a odkaz se okamžitě po zaplacení začne zobrazovat.