46
wp-n00b.php @vtemian

wp-n00b.php

Embed Size (px)

Citation preview

wp-n00b.php @vtemian

whoami

WordPress hostingdedicated to publishers

I’m going on an adventure!

kernel developer

data.gov.ro

student

infrastructura

php developer

php developer

php developer

php developer

sounds like a good plan

codereview

push on feature branch

deploy after a master commit

github.com

vagrantgazeta.info.ro

plugins and themes changes

it’s easy

we need a theme

let’s change it

theme options in DB

sync

staging is HELL

child theme

functions.php

<?php// load theme styles from parent and from childadd_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );function theme_enqueue_styles() { wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' ); wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css', array('parent-style') );}

// load languages from child themeload_theme_textdomain( 'hueman', get_stylesheet_directory() . '/languages' );

// load javascript dependencieswp_enqueue_script('twitter', get_stylesheet_directory_uri() . '/js/twitter.js');wp_enqueue_script('facebook', get_stylesheet_directory_uri() . '/js/facebook.js');

// fix auto quotingremove_filter( 'the_title', 'wptexturize' );remove_filter( 'the_content', 'wptexturize' );remove_filter( 'the_excerpt', 'wptexturize' );remove_filter( 'comment_text', 'wptexturize' );?>

functii1.php

functii2.php

OOP Themes

<?php

namespace Blogwerk\Theme;

use Blogwerk\Theme\AbstractTheme;

class TwigExample extends AbstractTwigTheme{ const SLUG_SIDEBAR = 'sidebar'; const SLUG_MENU = 'menu'; public function setup() { // specifiy the twig views folder in the current theme $this->services['view_path'] = function($c){ return $c['map_folder']('views/twig'); }; $this->registerViews(array( // main entry points 'index' => 'main.html.twig', 'home' => 'main.html.twig', 'frontpage' => 'main.html.twig', // layout 'header' => 'layout/header.html.twig', 'footer' => 'layout/footer.html.twig', 'sidebar' => 'layout/sidebar.html.twig', ));

// register sidebar register_sidebar(array( 'name' => 'Sidebar', 'description' => __('Sidebar', $this->getTextDomain()), 'id' => static::SLUG_SIDEBAR, 'before_widget' => '<section class="widget %2$s clearfix">',

'after_widget' => '</section>', 'before_title' => '<h2 class="widget-title">', 'after_title' => '</h2>', )); // register menu register_nav_menus(array( static::SLUG_MENU => 'Main Menu', )); } public function setupComponents() { $this->registerComponents(array( // Menu Component '\\Blogwerk\\Theme\\Component\\Menu', )); } /** * register widgets at widgets_init(10) */ public function widgets() { register_widget('\\Blogwerk\\Widget\\Image'); } /** * Registers assets */ public function assets() { wp_enqueue_style('blogwerk-theme-css', $this->resolveUri('resources/styles/styles.css'), array(), $this->getVersion()); }}

it was fun

requirements.txt

package.json

Gemfile

$ ./manage.py runserver

$ ./manage.py migrate

$ ./manage.py compress

testing framework

mvc Model View Controller

know what to buy

staging is hard as hell

create a child(theme)

10q