Friday, May 20th, 2016
Add to functions.php
function cc_mime_types( $mimes ){
$mimes['svg'] = 'image/svg+xml';
return $mimes;
}
add_filter( 'upload_mimes', 'cc_mime_types' );
Tags: Media support, PHP, SVG, WordPress
Posted in PHP, WordPress | No Comments »
Tuesday, March 8th, 2016
<?php if( get_field('video_url') ):?>
Show this if field exists <?php the_field('video_url');?>
<?php else : ?>
Show this if not
<?php endif;?>
Tags: ACF, Empty fields, PHP, WordPress
Posted in PHP, WordPress | No Comments »
Wednesday, January 6th, 2016
Add this code to your website to show the current year e.g. 2016. Can be used to always show the current year in the date format in a copyright statement.
<?php echo date("Y") ?>
Tags: Copyright, Date, Format, PHP, Year
Posted in PHP | No Comments »
Tuesday, October 13th, 2015
<?php $allow_inside = ($is_logged_in) || substr_count($_SERVER['HTTP_USER_AGENT'],'Googlebot'); ?>
Tags: Allow, Analytics, Blocked, Bot, Google, PHP
Posted in PHP | No Comments »
Monday, October 5th, 2015
<?php
$cityname = get_field('city_name');
$args = array(
'posts_per_page' => '100',
'post_type' => 'neighborhood',
'meta_key' => 'city_n',
'meta_value' => $cityname,
'order' => 'asc'
);
$cityquery = new WP_Query($args);
$i = 1;
while ( $cityquery->have_posts() ) : $cityquery-> the_post();?>
Tags: CPT UI, Custom Fields, Custom Post Types, PHP, WordPress
Posted in PHP, WordPress | No Comments »
Monday, July 27th, 2015
$args = array(
'post_type' => 'page',
'post_parent' => $post->ID,
);
Tags: Child, Parent, PHP, Query, WordPress
Posted in PHP, WordPress | No Comments »