Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save cobaltapps/fd91abb1b793e75d0b9e8432c78382b8 to your computer and use it in GitHub Desktop.
Save cobaltapps/fd91abb1b793e75d0b9e8432c78382b8 to your computer and use it in GitHub Desktop.
An example of some basic HTML structure with some do_action code to help illustrate how WordPress action hooks work.
<!-- Example of a basic HTML structure and some action hook calls
to help show how action hooks are setup in specific locations,
ready to be hooked into with the add_action call. -->
<body>
<!-- Generally hooks that are created by the theme
start with their theme name at the beginning of
the hook name, in this generic case "theme_". -->
<?php do_action( 'theme_hook_before_container' ); ?>
<container>
<?php do_action( 'theme_hook_before_content' ); ?>
<article>
<?php do_action( 'theme_hook_before_content_heading' ); ?>
<h1>A Heading</h1>
<?php do_action( 'theme_hook_after_content_heading' ); ?>
<p>Some content.</p>
<?php do_action( 'theme_hook_after_entry_content' ); ?>
</article>
<?php do_action( 'theme_hook_after_content' ); ?>
</container>
<?php do_action( 'theme_hook_after_container' ); ?>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment