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 Search Form - Shortcode | |
-------------------------------------------------- */ | |
/* | |
* USAGE: | |
* Post Content: [shortcode_search] | |
* Template: echo do_shortcode("[shortcode]"); | |
*/ |
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 | |
/* Get Image URL from Image ID | |
-------------------------------------------------- */ | |
$media_image_id = XXX; // Specify the Image ID | |
$media_image_attributes = wp_get_attachment_image_src( $media_image, 'medium' ); // Get 'medium' image URL | |
echo '<img src="'. $media_image_attributes[0] .'" width="'. $media_image_attribute[1] .'" height="'. $media_image_attribute[2] .'"> |
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 | |
/* Create a WordPress Foreach Loop | |
-------------------------------------------------- */ | |
$wordpress_loop_argument = array( | |
'post_type' => 'custom_post_type', | |
'posts_per_page' => -1, | |
'orderby' => 'date', | |
'order' => 'ASC' | |
); |
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 | |
/* Create a WordPress While Loop | |
-------------------------------------------------- */ | |
$wordpress_loop_argument = array( | |
'post_type' => 'custom_post_type', | |
'posts_per_page' => -1, | |
'orderby' => 'date', | |
'order' => 'ASC' | |
); |
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 | |
/* Get Post Info by Slug | |
-------------------------------------------------- */ | |
// Set the Post Slug | |
$custom_post_slug = get_page_by_path( 'custom-post-slug-url', 'OBJECT', 'custom_post_type' ); | |
// Post ID | |
$custom_post_ID = $custom_post_slug->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
// --- WP-API | Display all custom post metadata that start with 'xxx_' --- // | |
function wmi_past_poss_custom_metadata( $post_response, $post, $context ) { | |
$meta = get_post_custom( $post['ID'] ); | |
$custom_fields = array(); | |
foreach ( $meta as $key => $value ) { | |
// Replace 'xxx_' with any custom metakey prefix (ie. '_' for private metakey's) | |
if ( 'xxx_' !== substr( $key, 0, 1 ) ) { | |
$custom_fields[ $key ] = $value; | |
} | |
} |
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 | |
/* Enqueue Wordpress Scripts and Styles | |
-------------------------------------------------- */ | |
function wp_enqueue_scripts_styles() { | |
// Javascript - Register Scripts | |
wp_register_script( 'bootstrap-script', get_template_directory_uri() . '/bootstrap/js/bootstrap.min.js', array( 'jquery' ), '3.2', true ); // -- From Parent Theme | |
wp_register_script( 'documents-script', get_stylesheet_directory_uri() . '/bootstrap/docs/docs.min.js', array( 'bootstrap-script' ), '3.2', true ); // -- From Child Theme | |
wp_register_script( 'bootlint-script', 'http://maxcdn.bootstrapcdn.com/bootlint/0.3.0/bootlint.min.js', array( 'angularjs-bootstrap-script' ), '0.3.0', true ); // -- From an External URL |