Předávání parametrů v url

WordPress parametry v url automaticky „odstřihne“. Je třeba přidat do functions.php:

/—code php
function parameter_queryvars( $qvars ) {
$qvars[] = ‚yourvarname‘;
return $qvars;
}
add_filter(‚query_vars‘, ‚parameter_queryvars‘ );
\—

a následně v šabloně použít:

/—code php
global $wp_query;
if (isset($wp_query->query_vars[‚yourvarname‘])) {
print $wp_query->query_vars[‚yourvarname‘]; // něco udělej
}
\—

„Zdroj »“:https://dmjcomputerservices.com/blog/passing-url-parameters-to-a-wordpress-page/

Staging

**WP Staging – DB & File Duplicator & Migration**
„https://wordpress.org/plugins/wp-staging/“:https://wordpress.org/plugins/wp-staging/

This duplicator plugin allows you to create an staging or development environment in seconds.

It creates a file clone of your website into a subfolder of your current WordPress installation with an entire copy of your database. This sounds pretty simple and yes it is! All the hard time consumptive database and file copy stuff including url replacements is done in the background.

Přidání nového příspěvku programátorsky

/—code php

/*
A function used to programmatically create a post in WordPress.
@returns -1 if the post was never created, -2 if a post with the same title exists, or the ID of the post if successful.
*/

function programmatically_create_post($user_id) {
// Initialize the page ID to -1. This indicates no action has been taken.
$post_id = -1;

// Setup the title of the post
$title = ‚My New Post‘

// If the page doesn’t already exist, then create it
if( null == get_page_by_title($title)) {
// Set the post ID so that we know the post was created successfully
$new_post = array(
‚post_title‘ => $title,
‚post_name‘ => my-new-post,
‚post_content‘ => ‚Lorem ipsum dolor sit amet…‘,
‚post_status‘ => ‚publish‘,
‚post_date‘ => date(‚j.n.Y H:i:s‘),
‚post_author‘ => $user_id,
‚post_type‘ => ‚post‘,
‚post_category‘ => array(0),
‚comment_status‘ => ‚closed‘,
‚ping_status‘ => ‚closed‘,
);
$post_id = wp_insert_post($new_post);
// Otherwise, we’ll stop
} else {
// Arbitrarily use -2 to indicate that the page with the title already exists
$post_id = -2;
} // end if
} // end programmatically_create_post
\—

„Programmatically Create a Post in WordPress »“:http://tommcfarlin.com/programmatically-create-a-post-in-wordpress/
„How to Create a Post in WordPress Programmatically »“:How to Create a Post in WordPress Programmatically

To lze využít např. pro automatické vytvoření příspěvku z uživatelského profilu při jeho ukládání přes „user_register hook“:http://codex.wordpress.org/Plugin_API/Action_Reference/user_register:

/—code php
add_action(‚user_register‘,’programmatically_create_post‘);
\—

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/

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.

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.

Testování šablony

**Theme-Check**
„http://wordpress.org/extend/plugins/theme-check/“:http://wordpress.org/extend/plugins/theme-check/

The theme check plugin is an easy way to test your theme and make sure it’s up to spec with the latest theme review standards. With it, you can run all the same automated testing tools on your theme that WordPress.org uses for theme submissions.
The tests are run through a simple admin menu and all results are displayed at once. This is very handy for theme developers, or anybody looking to make sure that their theme supports the latest WordPress theme standards and practices.

„Theme Unit Test »“:http://codex.wordpress.org/Theme_Unit_Test

The Theme Unit Test is an XML export of demo data that outlines most of the features built into WordPress, and while being mandatory for WordPress.org themes, it’s a good idea to quickly run through the tests when working with theme markets and client jobs.
With this test you’ll know that your h6 tag is styled, that nested lists are supported, that images and videos won’t break your design layouts and so on. You won’t have requests like “I inserted a right-aligned image in the editor but it’s not right-aligned on the site”.

„Essential Plugins for WordPress Theme Developers »“:http://theme.fm/2011/07/6-essential-plugins-for-wordpress-theme-developers-1006/

Vytvoření a úpravy šablony založené na Twenty Eleven

„Vytvoření odvozené (child) šablony »“:http://wp.tutsplus.com/tutorials/theme-development/creating-a-simple-child-theme-using-twenty-eleven/

Změna stylopisu – barva, písmo, velikost nadpisů, popisky, komentářů, postranní lišty apod.

„[* http://allaboutbasic.files.wordpress.com/2011/06/twenty-eleven1.png?w=630&h=376 *]“:http://allaboutbasic.com/2011/06/15/wordpress-com-theme-twenty-eleven-css-style-sheet-modification-change-site-titledescriptionpost-titlecommentsmenussidebar-and-more/

„Více zde »“:http://allaboutbasic.com/2011/06/15/wordpress-com-theme-twenty-eleven-css-style-sheet-modification-change-site-titledescriptionpost-titlecommentsmenussidebar-and-more/

„Digging Into Twenty Eleven »“:http://theme.fm/2011/07/theme-review-digging-into-twenty-eleven-597/

„Replace/Remove Default Header Image Twenty Eleven Theme »“:http://wpti.ps/functions/replace-remove-header-image-twenty-eleven-theme/

„Sidebar on Single Posts and Pages »“:http://www.transformationpowertools.com/wordpress/twenty-eleven-sidebar-on-single-posts-and-pages

„Adding a Narrow Sidebar on Each Side of TwentyEleven Single Post View »“:http://voodoopress.com/2011/07/adding-a-narrow-sidebar-on-each-side-of-twentyeleven-single-post-view/

„Plugin pro různé změny layoutu a designu Twenty Eleven »“:http://wordpress.org/extend/plugins/twenty-eleven-theme-extensions/
„Twenty Eleven Theme Extensions Plugin »“:http://wordpress.org/extend/plugins/twenty-eleven-theme-extensions/

„Plugin pro 3-sloupcové varianty Twenty Eleven »“:http://zeaks.org/other-stuff/three-column-twenty-eleven-update/

„Jak přidat logo do Twenty Eleven »“:http://zeaks.org/code-snippets/how-to-add-a-logo-to-twenty-eleven-theme/

„Logo a nadpis v Twenty Eleven »“:http://www.transformationpowertools.com/wordpress/logo-and-site-title-twenty-eleven

„How to Override Theme Functions »“:http://venutip.com/content/right-way-override-theme-functions

1. Copy (in full) the function you want to override from the parent theme.
2. Paste it into functions.php in the root of your child theme’s folder. If functions.php doesn’t exist, create it.
3. Rename the function from parent_theme_function to child_theme_function.
4. Deactivate the parent function.
5. Activate the child function.

/—code php
// Removes thematic_blogtitle from the thematic_header phase
function remove_thematic_actions() {
remove_action(‚thematic_header‘,’thematic_blogtitle‘,3);
}
// Call ‚remove_thematic_actions‘ during WP initialization
add_action(‚init‘,’remove_thematic_actions‘);

// Add our custom function to the ‚thematic_header‘ phase
add_action(‚thematic_header‘,’fancy_theme_blogtitle‘, 3);
\—