76 užitečných tipů

  • WordPress Shortcodes
  • WordPress Permalinks Outside of the Loop
  • Custom Message to Returning Visitors
  • Recently Updated Posts and Pages
  • Custom Content to Search Engine Visitors
  • Last Modified Time and Date for Posts
  • Display Total Number of Trackbacks and Pingbacks
  • Display Recently Registered Users
  • List all of Your Site’s Posts
  • List WordPress User Information
  • Display List of Scheduled Posts
  • Display Private Posts to Logged-in Users
  • Display Posts from Exactly One Year Ago
  • Custom CSS Styles for Recent Posts
  • New WordPress-2.7 Comments Loop
  • Backwards-Compatible Comment Templates
  • Disable WordPress Post Revisions
  • Limit WordPress Post Revisions
  • Remove WordPress Post Revisions from the Database
  • Reduce Comment Spam by Blocking No-Referrer Requests
  • Prevent Google Analytics from Tracking Admin Pages
  • Meta Descriptions without a Plugin
  • Differentiate Between Posts Depending on Presence of Excerpt
  • Modify the wp_options Table via the WordPress Admin
  • Alternate Comment Styles
  • Automatically Remove Code Mistakes in Posts
  • Automatically Disable Comments and Trackbacks in Old Posts
  • Access Post Data Outside the Loop
  • Display Posts for a Specified Time Period
  • Unique Single Post Templates for Different Categories
  • Display Performance Statistics for WordPress Pages
  • Custom Post Thumbnails in Two Steps
  • Highlight Author Comments
  • Easy Random Posts
  • Display Dates for Groups of Posts
  • Display a Sticky Post in the Sidebar
  • Display Latest Comments without a Plugin
  • Display Most Commented Posts without a Plugin
  • Change Permalinks from Date-Based to Post-Date Only
  • Test for Sub-Pages
  • Multiple Widgetizable Sidebars
  • Remove Fancy Quotes from Comments
  • Display a List of All Untagged Posts
  • Easy Display of Custom Headers, Footers, and Sidebars
  • A Better Way for Users to Logout
  • Display a Custom Message on a Specific Date
  • Display Three Columns of Posts
  • Disable WordPress Search Functionality
  • Display Posts with Specific Custom Fields
  • How to Number Your Comments, Pingbacks, & Trackbacks in 2.7+
  • How to Number Your Comments Using the Classic Loop
  • Invite Readers to Comment via Feed
  • Display the Total Number of Users for Your Blog
  • Automatically Insert Content into Your WordPress Post Editor
  • How to Prevent Duplicate Content
  • Conditionally Display Full Posts or Excerpts
  • Display Related Posts without a Plugin
  • Drop-Dead Easy Styles for Author Comments
  • Display Posts Upcoming Scheduled Posts
  • Display Automatic TinyURLs for Your Posts
  • Implement a Site-Maintenance Page for Your Blog
  • Display the First Image from Each of Your Posts
  • Display Most Popular Posts without a Plugin
  • Automatically Highlight Search Terms
  • Automatically Disable Widgets
  • Display All Images from Your Post Content
  • Display Category List in Two Columns
  • Show Ads or Other Content Only in the First Three Posts
  • A Better Way to Display Recent Comments without a Plugin
  • Selectively Disable Automatic Post Formatting
  • Browser Detection via WordPress’ body_class Function
  • Get Post or Page Contents as a PHP Variable
  • Simple Example of How to Use WordPress Cron
  • Add More Default Avatar Choices to the WordPress Admin
  • Add a Private Page to Your Navigation Menu
  • How to Add Additional Links to wp_list_pages

Stupid WordPress Tricks »

Drobečková navigace bez použití pluginu

Do functions.php vložíme:

function the_breadcrumb() {
                echo '<ul id="crumbs">';
        if (!is_home()) {
                echo '<li><a href="';
                echo get_option('home');
                echo '">';
                echo 'Home';
                echo "</a></li>";
                if (is_category() || is_single()) {
                        echo '<li>';
                        the_category(' </li><li> ');
                        if (is_single()) {
                                echo "</li><li>";
                                echo '</li>';
                } elseif (is_page()) {
                        echo '<li>';
                        echo the_title();
                        echo '</li>';
        elseif (is_tag()) {single_tag_title();}
        elseif (is_day()) {echo"<li>Archive for "; the_time('F jS, Y'); echo'</li>';}
        elseif (is_month()) {echo"<li>Archive for "; the_time('F, Y'); echo'</li>';}
        elseif (is_year()) {echo"<li>Archive for "; the_time('Y'); echo'</li>';}
        elseif (is_author()) {echo"<li>Author Archive"; echo'</li>';}
        elseif (isset($_GET['paged']) && !empty($_GET['paged']))
        {echo "<li>Blog Archives"; echo'</li>';}
        elseif (is_search()) {echo"<li>Search Results"; echo'</li>';}
        echo '</ul>';

V šabloně funkci zavoláme:


Zdroj »

Galerie – obrázky v mřížce

Space Boxes
Your text to link...

Space Boxes was designed to make building content & media grids quick and painless. Each Space Box set is created solely with a WordPress gallery inserted into a custom post type. When you insert the shortcode [spaceboxes id=XX”] , it will display the title, and caption for each image, if they are provided.

Have 7 images in your gallery? Then you’ll have 7 boxes. Want a lightbox? No problem. Control over the grid? Check! There’s even a portfolio mode to show off images or product screenshots. You can also use the gallery to drag and drop your boxes in the order that you want them displayed.

Demo »

Import XML a CSV souborů

WP All Import
Import any XML or CSV File to WordPress

Makes it easy to import any XML or CSV file to WordPress. Has a four step import process and an intuitive drag & drop interface that makes complicated import tasks simple and fast.

Can be used for everything from migrating content from a legacy CMS to WordPress to building a store with an affiliate datafeed to displaying live stock quotes or sports scores to building a real estate portal.

Our YouTube channel has many videos showing WP All Import in action. Documentation of advanced features »

Přidání custom posts do výsledků vyhledávání

Do functions.php přidáme

add_filter( 'pre_get_posts', 'tgm_cpt_search' );
* This function modifies the main WordPress query to include an array of post types instead of the default 'post' post type.
* @param mixed $query The original query
* @return $query The amended query
function tgm_cpt_search( $query ) {
if ( $query->is_search )
$query->set( 'post_type', array( 'post', 'movies', 'products', 'portfolio' ) );
return $query;

Automatický náhledový obrázek

Auto Post Thumbnail

Automatically generate the Post Thumbnail (Featured Thumbnail) from the first image in post or any custom post type only if Post Thumbnail is not set.

If the post thumbnail is already present, the plugin will do nothing. If you don't want a post thumbnail for some post with images, just add a custom field skip_post_thumb to the post and the plugin will restrain itself from generating post thumbnail. The plugin also provides a Batch Processing capability to generate post thumbnails for already published posts.

Další pluginy

nebo pomocí funkcí:

function autoset_featured() {
global $post;
$already_has_thumb = has_post_thumbnail($post->ID);
    if (!$already_has_thumb)  {
        $attached_image = get_children( "post_parent=$post->ID&post_type=attachment&post_mime_type=image&numberposts=1" );
        if ($attached_image) {
            foreach ($attached_image as $attachment_id => $attachment) {
                set_post_thumbnail($post->ID, $attachment_id);
add_action('the_post', 'autoset_featured');
add_action('save_post', 'autoset_featured');
add_action('draft_to_publish', 'autoset_featured');
add_action('new_to_publish', 'autoset_featured');
add_action('pending_to_publish', 'autoset_featured');
add_action('future_to_publish', 'autoset_featured');


function set_first_as_featured($attachment_ID){
    $post_ID = get_post($attachment_ID)->post_parent;
        set_post_thumbnail($post_ID, $attachment_ID);
add_action('add_attachment', 'set_first_as_featured');
add_action('edit_attachment', 'set_first_as_featured');

On every upload / edit attachment, function checks if the post already has featured image. If it has not, image in question is set as featured. Every next picture will be ignored (since post already has featured image).


wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'thumbnail' )[0];

Get The First Image From a Post »