Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Ako na vlastne WP temy

610 views

Published on

Ako zacat robit vlastne WP temy a vyhnut sa castym chybam

Published in: Internet
  • Be the first to comment

  • Be the first to like this

Ako na vlastne WP temy

  1. 1. Ako na vlastne WP temy
  2. 2. WP theme dev @ webikon
 soundsystem @ cyklokuchyňa
  3. 3. Preco stavat custom a neklikat premium temy?
  4. 4. 20 sliderov! 15 dizajnov 60 shortcodov 50 templatov 18 druhov tlacitok 5 typov menu 800 novych nastaveni v backende onepage parallax nekonecno farebnych kombinacii
  5. 5. ako zacat? • codex.wordpress.org/Theme_Development • index.php + style.css • zaklady sa nauc “from scratch” a potom si vyber starter temu • _s (underscores.me) • components (components.underscores.me)
  6. 6. nevymyslaj koleso odznova • codex.wordpress.org/Function_Reference • <?php echo url_shorten( 'http:// www.example.com/an/article/with/a/ very/long/url' ); • example.com/an/article/with/a/ve...
  7. 7. Neopakuj sa, get_template_part();
  8. 8. archive.php
 <?php while( have_posts() ) :
 the_post(); if( get_post_type() == ‘post’ ) { …markup pre post… } elseif( get_post_type() == ‘product’ ) {
 
 …markup pre produkt…
  9. 9. <?php while( have_posts() ) :
 the_post();
 
 get_template_part( 
 ‘loop’, 
 get_post_type() 
 ); loop-post.php
 loop-product.php
 …
  10. 10. Nauc sa pouzivat hooky!
  11. 11. • do_action(); 
 apply_filters(); • add_action();
 add_filter(); • codex.wordpress.org/ Plugin_API/Hooks
  12. 12. • template:
 do_action( ‘my_action’ ); • plugin:
 add_action( ‘my_action’, ‘my_function’ )
 
 function my_funcion() {
 echo ‘hello wordcamp’;
 }
  13. 13. • Nazov page * • function add_asterisk( $title, $post_id ) {
 if( get_post_type( $post_id ) == ‘page’ ) {
 $title = $title . ‘*’;
 }
 return $title;
 } • add_filter( ‘the_title’, ‘add_asterisk’ );
  14. 14. • function order_posts( $query ) {
 $query->set( ‘order’, ‘ASC’ );
 } • add_action( ‘pre_get_posts’, ‘order_posts’ );
  15. 15. prezentacia = tema funkcionalita = modul • templaty = tema • CPT, taxonomie, metaboxy => modul • mu-plugins FTW
  16. 16. mu-plugins • funguju bez aktivacie • nedaju sa deaktivovat ani zmazat z admin rozhrania • klient o nich ani nevie
  17. 17. wp-content/mu-plugins/ hello-wcba.php <?php // print hello wordcamp in footer function wcba_hello() { echo ‘Hello Wordcamp Bratislava’; } add_action( ‘wp_footer’, ‘wcba_hello’ );
  18. 18. boostrap? foundation? • pouzivaj sass/less a grunt/gulp • includuj len to co potrebujes • pouzivaj mixiny • minifikuj v produkcii
  19. 19. foundation.css <div class=“site row”>
 <div class=“site-content small-12 medium-8 large—9”>…</div>
 <div class=“site-sidebar small-12 medium-4 large-3>…</div>
 
 <a class=“button secondary custom-class”…
  20. 20. foundation.scss <div class=“site”>
 <div class=“site-content”>…</div>
 <div class=“side-sidebar”>…</div> .site {
 @include grid-row();
 &-content {
 @include grid-column();
 @include breakpoint( medium ) {
 @include grid-column(8);
 …
  21. 21. github.com/Webikon/_s-foundation-sites
  22. 22. Neboj sa customizera
  23. 23. diky

×