Skip to content

Instantly share code, notes, and snippets.

View mikeemoo's full-sized avatar

Mikeemoo mikeemoo

  • Leeds, United Kingdom
View GitHub Profile
@mikeemoo
mikeemoo / home.html.twig
Created May 22, 2012 10:35
Twig extending
{% extends 'LowpressWordpressBundle:Default:index.html.twig' %}
@mikeemoo
mikeemoo / layout.html.twig
Created May 22, 2012 10:36
Extending layout in twig
{% extends '::base.html.twig' %}
{% block body %}
{% block content %}{% endblock %}
{% block sidebar %}{{ lowpress_get_sidebar() }}{% endblock %}
{% endblock %}
@mikeemoo
mikeemoo / index.html.twig
Created May 22, 2012 10:37
Twig wordpress template
{% extends 'LowpressWordpressBundle::layout.html.twig' %}
{% block content %}
{% if lowpress_have_posts() %}
{% for i in 0..wp_query.post_count-1 %}
{{ lowpress_the_post() }}
{{ lowpress_get_header() }}
{% block body %}{% endblock %}
{% block javascripts %}{% endblock %}
{{ lowpress_get_footer() }}
@mikeemoo
mikeemoo / general-template.php
Created May 22, 2012 14:29
Wordpress template loading
function get_header( $name = null ) {
do_action( 'get_header', $name );
$templates = array();
if ( isset($name) )
$templates[] = "header-{$name}.php";
$templates[] = 'header.php';
// Backward compat code will be removed in a future release
@mikeemoo
mikeemoo / symfony2-bridge.php
Created May 22, 2012 16:19
redeclare wordpress methods
<?php
/*
Plugin Name: Symfony2 Bridge
Plugin URI: http://www.lowpress.com
Description: Integrate Symfony2 and Wordpress
Author: Mikee Franklin
Version: 1.0
Author URI: http://www.lowpress.com
*/
@mikeemoo
mikeemoo / symfony2-bridge.php
Created May 22, 2012 16:22
override load_template and locate_template
<?php
/*
Plugin Name: Symfony2 Bridge
Plugin URI: http://www.lowpress.com
Description: Integrate Symfony2 and Wordpress
Author: Mikee Franklin
Version: 1.0
Author URI: http://www.lowpress.com
*/
function rename_template_functions()
@mikeemoo
mikeemoo / general-template.php
Created May 22, 2012 16:26
get_header, locate_template and load_template
<?php
//..
function get_header( $name = null ) {
do_action( 'get_header', $name );
$templates = array();
if ( isset($name) )
$templates[] = "header-{$name}.php";
@mikeemoo
mikeemoo / wp-config.php
Created May 22, 2012 18:42
Wordpress connection details
<?php
//..
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'lowpress');
/** MySQL database username */
define('DB_USER', 'root');
@mikeemoo
mikeemoo / parameters.ini
Created May 22, 2012 18:47
Symfony parameters
[parameters]
database_driver = pdo_mysql
database_host = localhost
database_port =
database_name = lowpress
database_user = root
database_password =