Saturday, December 13th, 2014
$terms = wp_get_post_terms( $post->ID , 'type' );
if ( $terms != null ){
foreach( $terms as $term ) {
$args = array(
'post_type' => 'portfolio',
'posts_per_page' => '3',
'tax_query' => array (
array (
'taxonomy' => 'type',
'field' => 'slug',
'terms' => $term->slug
)
)
);
}}
$query = new WP_Query($args);
$i = 1;
while ( $query->have_posts() ) : $query->
the_post();
Posted in PHP, WordPress | No Comments »
Saturday, December 13th, 2014
Code not escaping properly – download this this file.
/* Add Button Shortcode */
function button($atts, $content = null) {
extract(shortcode_atts(array(
"link" => '#',
"style" => 'btn-primary'
), $atts));
return ''.$content.'';
}
add_shortcode("button", "button");
[button link="http://google.com"]Clicky clicky[/button]
Custom shortcode which includes php file example here
Posted in PHP, WordPress | No Comments »
Saturday, December 13th, 2014
Use this to make an element include padding in to it’s width/height.
@media screen {
*, *:after, *:before {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box; } }
Posted in CSS | No Comments »
Saturday, December 13th, 2014
A WordPress query that can be amended – like below for different post types/amount of posts/categories etc – codex info here
$args = array(
'post_type' => 'post',
'posts_per_page' => '16',
'orderby' => 'rand'
);
$query = new WP_Query($args);
$i = 1;
while ( $query->have_posts() ) : $query-> the_post();
Posted in PHP, WordPress | No Comments »