Skip to content

Instantly share code, notes, and snippets.

View michaelbrazell's full-sized avatar

Mike Murray michaelbrazell

View GitHub Profile
<?php
/**
* The template used for displaying page content in page.php
*
* @package doc
*/
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
@michaelbrazell
michaelbrazell / wordpress_conditional.php
Created July 16, 2014 01:58
Using a conditional for a custom field in a Wordpress theme
<?php
// Assign the custom field to a variable
$her_final_word = get_post_meta($post->ID, 'her_final_word', true);
// Check if variable is not empty
if($her_final_word !='') {
// True: Print the variable
?><p><?php echo $her_final_word; ?></p><?php
}
else {
// Default text that will appear
/**
* A dashboard widget that lists out pages in a heirarchy
* Add this to the end of your "Functions.php" file in your theme directory
*
* This function is hooked into the 'wp_dashboard_setup' action below.
*/
function site_map_edit() {
wp_add_dashboard_widget(
'site_map_edit', // Widget slug.