Upgrade to Pro — share decks privately, control downloads, hide ads and more …

How to writing extensible WordPress code

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
Avatar for Mark Wilkinson Mark Wilkinson
September 19, 2018

How to writing extensible WordPress code

Our Co-founder and WordPress developer, Mark Wilkinson spoke to the WordPress Cheltenham meetup group about writing extensible WordPress code. This is code that others can extend and modify in a safe way.

Before viewing this slide deck, it is worth making sure you understand how WordPress hooks work. This is a blog post we previously wrote which may be of use.

https://highrise.digital/blog/wordpress-hooks-action-filters/

Avatar for Mark Wilkinson

Mark Wilkinson

September 19, 2018
Tweet

More Decks by Mark Wilkinson

Other Decks in Education

Transcript

  1. How to write extensible WordPress code Mark Wilkinson Co-founder and

    developer at Highrise Digital https://highrise.digital @wpmark
  2. function hd_title_here( $title, $post ) { if ( 'post' ===

    get_post_type( $post ) ) { $title = 'Article Title'; } return $title; } add_filter( 'enter_title_here', 'hd_title_here', 10, 2 );
  3. while ( $job_posts->have_posts() ) : $job_posts->the_post(); do_action( ‘hd_before_job_post’ ); ?>

    <h1><?php the_title(); ?></h1> <?php do_action( ‘hd_after_job_post’ ); endwhile;
  4. function hd_job_post_content( $post ) { ?> <h1><?php the_title(); ?></h1> <?php

    } add_action( ‘hd_job_post’, ‘hd_job_post_content’, 10, 1 );
  5. function hd_sub_title( $post_id = 0 ) { return apply_filters( ‘hd_sub_title’,

    get_post_meta( $post_id, ‘subtitle’, true ), $post_id ); }
  6. Mark Wilkinson Co-founder & developer at Highrise Digital T: @wpmark

    & @highrisedigital W: markwilkinson.me & highrise.digital