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
# run in root directory you want WordPress installed in | |
curl -LO https://wordpress.org/latest.zip | |
unzip latest.zip | |
mv wordpress/* . | |
rmdir wordpress | |
rm latest.zip |
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 | |
$object = 'treatments'; // CPT TYPE | |
$output = 'objects'; | |
$taxonomies = get_object_taxonomies( $object, $output ); | |
$exclude = array( 'post_tag', 'post_format' ); | |
if ( $taxonomies ) { | |
foreach ( $taxonomies as $taxonomy ) { |
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 | |
/* | |
* Loop through Categories and Display Posts within | |
https://wordimpress.com/loop-through-categories-and-display-posts-within/ | |
*/ | |
$post_type = 'treatments'; | |
// Get all the taxonomies for this 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 | |
if( false != get_the_term_list( $post->ID, 'brands' ) ) { | |
echo 'Brand: ' . get_the_term_list($post->ID,'brands', ' ', ' ', '' ) . "<br />"; | |
} | |
?> |
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_terms = get_terms('custom_taxonomy'); | |
foreach($custom_terms as $custom_term) { | |
wp_reset_query(); | |
$args = array('post_type' => 'custom_post_type', | |
'tax_query' => array( | |
array( | |
'taxonomy' => 'custom_taxonomy', | |
'field' => 'slug', | |
'terms' => $custom_term->slug, |
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
// MAINTENANCE MODE | |
function wp_maintenance_mode(){ | |
if(!current_user_can('edit_themes') || !is_user_logged_in()){ | |
wp_die('<h1 style="color:black">Site Name - We\'ll be back soon</h1><br />We are performing scheduled maintenance. Our website will be back shortly.', 'Title (Maintenance Mode)'); | |
} | |
} | |
add_action('get_header', 'wp_maintenance_mode'); | |
// Comment the last line to start/stop maintenance mode |
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 | |
$cache_file = getcwd() . '/media/latest_gram.json'; | |
$cache_life = '120'; //caching time, in seconds | |
if ( !file_exists($cache_file) or ( time() - filemtime($cache_file) >= $cache_life ) ) { | |
file_put_contents( $cache_file, file_get_contents('https://api.instagram.com/v1/users/self/media/recent/?access_token=xxx&count=1') ); | |
} | |
$json = file_get_contents( $cache_file ); | |
$ig_array = json_decode( $json ); | |
?> |
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 if (get_field('custom-field') != NULL) : ?> | |
<p>This is my value: <?php the_field('custom-field'); ?></p> | |
<?php endif; ?> |
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
// array of CPTs (add more or less as required) | |
$myarray = array('custompost1','custompost2','custompost3'); | |
$terms = get_the_terms( $post->ID , $myarray ); | |
// init counter | |
$i = 1; | |
foreach ( $terms as $term ) { | |
$term_link = get_term_link( $term, $myarray ); | |
if( is_wp_error( $term_link ) ) | |
continue; |
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
[text* your-name placeholder "name"] | |
[email* your-email placeholder "email"] | |
[textarea* your-message class:comment-form] | |
[honeypot your-website validautocomplete:true move-inline-css:true] | |
[submit "Send"] |
OlderNewer