This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
~~~~PROPER WAY OF ADDING CHILD THEME CSS FILE ~~~~ | |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ | |
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' ); | |
function theme_enqueue_styles() { | |
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' ); | |
$options = get_option('wpdc_options'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Template Name: Sub-pages Template | |
*/ | |
get_header(); | |
global $more; | |
$is_page_builder_used = et_pb_is_pagebuilder_used( get_the_ID() ); ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php /* | |
Template Name: ORDERS Template | |
*/ ?> | |
<?php get_header(); ?> | |
<?php | |
global $wpdb; | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* WordPress Template Hierarchy as of WordPress 4.4 | |
is_404() ---------------------------------------------------------------------------------------------------> 404.php | |
is_search() ------------------------------------------------------------------------------------------------> search.php | |
is_front_page() --------------------------------------------------------------------------------------------> front-page.php | |
is_home() --------------------------------------------------------------------------------------------------> home.php | |
is_attachment() ---------> {mime_type}.php ------------> attachment.php ----------------\ | |
is_single() -------------> single-{post_type}.php -----> single-{post_type}-{slug}.php --> single.php -----\ | |
is_page() ---------------> page-{slug}.php ------------> page-{id}.php ------------------> page.php --------> singular.php | |
is_post_type_archive() --> archive-{post_type}.php ------------------------------------------------------\ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* =============================================================================================== | |
============================ CUSTOM POST TYPE ================================================== | |
================================================================================================*/ | |
add_action( 'init', 'pegasus_cpt_init' ); | |
function pegasus_cpt_init() { | |
/*============================ | |
======= Portfolio Post Type ======== |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* put this in functions.php */ | |
function list_hooked_functions( $tag=false ){ | |
global $wp_filter; | |
if ( $tag ) { | |
$hook[ $tag ] = $wp_filter[ $tag ]; | |
if ( !is_array( $hook[$tag] ) ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
EC2_INSTANCE_ID="`wget -q -O - http://169.254.169.254/latest/meta-data/instance-id || die \"wget instance-id has failed: $?\"`" | |
test -n "$EC2_INSTANCE_ID" || die 'cannot obtain instance-id' | |
EC2_AVAIL_ZONE="`wget -q -O - http://169.254.169.254/latest/meta-data/placement/availability-zone || die \"wget availability-zone has failed: $?\"`" | |
test -n "$EC2_AVAIL_ZONE" || die 'cannot obtain availability-zone' | |
EC2_REGION="`echo \"$EC2_AVAIL_ZONE\" | sed -e 's:\([0-9][0-9]*\)[a-z]*\$:\\1:'`" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function wcatl_api() { | |
if ( !empty( $_GET['wcatl'] ) ) { | |
try { | |
$input = file_get_contents( 'php://input' ); | |
$post = json_decode( $input, TRUE ); | |
if ( !empty( $post['post-id'] ) ) { | |
error_log( sprintf( 'New Post Published %s', $post['post-id'] ) ); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function wcatl2016_api() { | |
if ( !empty( $_GET['wcatl2016'] ) ) { | |
switch( strtolower( $_GET['wcatl2016'] ) ) { | |
case 'get-users': | |
$response = wcatl2016_api_get_users(); | |
break; | |
case 'add-user': | |
$response = wcatl2016_api_create_user(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function restricted_content_filter( $content ) { | |
if ( !current_user_can( 'administrator' ) && is_content_restricted() ) { | |
$content = 'Restricted!'; | |
} | |
return $content; | |
} | |
add_filter( 'the_content', 'restricted_content_filter' ); | |
add_filter( 'the_excerpt', 'restricted_content_filter' ); |