WordPress ukládá všechna data do MySQL databáze. Zkrátka všechno co vytvoříte – články, stránky, média, menu, comentáře, nastavení, prostě vše se uloží v databázi. Administrace WordPressu je skvělá v tom, že vám umožňuje, všechno toto upravovat, mazat, vytvářet, až na jeden případ.
Rubrika: WordPress Strana 9 z 10
WordPress je svobodný open source redakční publikační systém napsaný v PHP a MySQL a vyvíjený pod licencí GNU GPL. Je oficiálním nástupcem systému b2/cafelog a má širokou uživatelskou a vývojářskou komunitu. Dle oficiálních statistik je používán jako CMS (z anglického content management system – systém pro správu obsahu) na více než 25 % webových stránek na světě a překonává tak open source CMS jako Joomla či Drupal, které se drží pod třemi procenty.
![](https://danielcak.ambike.com/wp-content/uploads/2016/12/snippet-e1613237592280.png)
Jak by nám jistě potvrdila řada provozovatelů magazínů, lidé jsou chybující a jednotný vzhled je tak často „rozbitý“ chybějícím obrázkem. Ukážeme si tedy, jak přinutit uživatele, aby ke článku vždy přiložil náhledový obrázek.
![](https://danielcak.ambike.com/wp-content/uploads/2016/12/snippet-e1613237592280.png)
![](https://danielcak.ambike.com/wp-content/uploads/2016/12/snippet-e1613237592280.png)
![](https://danielcak.ambike.com/wp-content/uploads/2016/12/snippet-e1613237592280.png)
You can customize the text for displaying the number of comments inside the loop. This is just a simple template edit however it is extremely useful if you are creating a theme that is not a traditional theme or you wanted to inject a little bit of personality into the site.
![](https://danielcak.ambike.com/wp-content/uploads/2016/12/snippet-e1613237592280.png)
![](https://danielcak.ambike.com/wp-content/uploads/2016/12/snippet-e1613237592280.png)
![](https://danielcak.ambike.com/wp-content/uploads/2016/12/snippet-e1613237592280.png)
![](https://danielcak.ambike.com/wp-content/uploads/2016/12/snippet-e1613237592280.png)
![](https://danielcak.ambike.com/wp-content/uploads/2016/12/snippet-e1613237592280.png)
![](https://danielcak.ambike.com/wp-content/uploads/2016/12/snippet-e1613237592280.png)
Adding this snippet within the loop of your wordpress theme will display the custom field value from the previous and next posts. Just change the CUSTOM_FIELD on line 4 and 5 to the name of the custom field you wish to display.
![](https://danielcak.ambike.com/wp-content/uploads/2016/12/snippet-e1613237592280.png)
![](https://danielcak.ambike.com/wp-content/uploads/2016/12/snippet-e1613237592280.png)
![](https://danielcak.ambike.com/wp-content/uploads/2016/12/snippet-e1613237592280.png)
![](https://danielcak.ambike.com/wp-content/uploads/2016/12/snippet-e1613237592280.png)
![](https://danielcak.ambike.com/wp-content/uploads/2016/12/snippet-e1613237592280.png)
![](https://danielcak.ambike.com/wp-content/uploads/2016/12/snippet-e1613237592280.png)
This snippet will allow you to control which posts or pages there should be excluded from WordPress search results.
![](https://danielcak.ambike.com/wp-content/uploads/2016/12/snippet-e1613237592280.png)
![](https://danielcak.ambike.com/wp-content/uploads/2016/12/snippet-e1613237592280.png)
![](https://danielcak.ambike.com/wp-content/uploads/2016/12/snippet-e1613237592280.png)
![](https://danielcak.ambike.com/wp-content/uploads/2016/12/snippet-e1613237592280.png)
![](https://danielcak.ambike.com/wp-content/uploads/2016/12/snippet-e1613237592280.png)
![](https://danielcak.ambike.com/wp-content/uploads/2016/12/snippet-e1613237592280.png)
This snippet will prevent WordPress from checking if there’s any updates for your plugins. This could be useful if you’re creating a website for a client, and you don’t want them to update their plugins incase you have changed the code in it, or if you’re worried that the update will break the site.
![](https://danielcak.ambike.com/wp-content/uploads/2016/12/snippet-e1613237592280.png)
![](https://danielcak.ambike.com/wp-content/uploads/2016/12/snippet-e1613237592280.png)
![](https://danielcak.ambike.com/wp-content/uploads/2016/12/snippet-e1613237592280.png)
![](https://danielcak.ambike.com/wp-content/uploads/2016/12/snippet-e1613237592280.png)
![](https://danielcak.ambike.com/wp-content/uploads/2016/12/snippet-e1613237592280.png)
![](https://danielcak.ambike.com/wp-content/uploads/2016/12/snippet-e1613237592280.png)
This snippet twill add the search form to your wordpress wp_nav_menu. Don’t forget to update the MENU-NAME to specify the menu you wish to display within, just in case you have multiple menus.
![](https://danielcak.ambike.com/wp-content/uploads/2016/12/snippet-e1613237592280.png)
![](https://danielcak.ambike.com/wp-content/uploads/2016/12/snippet-e1613237592280.png)
![](https://danielcak.ambike.com/wp-content/uploads/2016/12/snippet-e1613237592280.png)
![](https://danielcak.ambike.com/wp-content/uploads/2016/12/snippet-e1613237592280.png)
![](https://danielcak.ambike.com/wp-content/uploads/2016/12/snippet-e1613237592280.png)
![](https://danielcak.ambike.com/wp-content/uploads/2016/12/snippet-e1613237592280.png)
Send an email to all registered users when a post is published. Simply place this code into your functions.php file.
This shows PHP errors for your WordPress theme. It also checks that the user i an admin and error will only be displayed if it’s true.
CODE SNIPPET:
1 2 3 4 |
if ( current_user_can( 'administrator' ) ) { define('WP_DEBUG_DISPLAY', true); @ini_set('display_errors', 1); } |
Get all image attachments from a page or post. I usually use this to show a slideshow on a page.