Cycling 4 Gaza

A collection of solutions

Posted by Amer Shalan on April 7, 2017

The cycling4gaza team approached me to redesign their website to give it a more modern feel.

The first thing to figure out was what their stack was built on. After some investigation I figured out it was built on wordpress. Something I had no experience in. Time to learn!

It turns out wordpress is a very simple php app. Luckily they already had a child theme set up. Which it turns out is the wordpress way to override a theme. I just had to copy and paste some php template files and modify them. However I did not want to add any hardcoded things into the templates. Time to break out some googling about adding theme customization. You need to add a variable the custom register on your theme. To do that you can add actions in your themes functions.php file as shown below.

function standard_child_customize_register( $wp_customize ) {
   //All our sections, settings, and controls will be added here
    $wp_customize->add_section( 'standard_child_header_title' , array(
        'title'      => __( 'Header Title', 'standard_child' ),
        'priority'   => 50,
    ) );
    $wp_customize->add_setting( 'header_title' , array(
        'default'   => 'This is a title!',
        'transport' => 'refresh',
    ) );
            'label'      => __( 'Header Title', 'standard_child' ),
            'section'    => 'standard_child_header_title',
            'settings'   => 'header_title',
            'type'     => 'textarea',
add_action( 'customize_register', 'standard_child_customize_register');

Then you can add a simple h1 to your theme file and import the theme modification built above.

This makes it incredibly easy to modify your theme as shown in this picture below

More coming soon....