$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();
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
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();
1) Register the menu in your functions.php file (Primary is the ID for the menu, Primary Menu is the name and Theme-name is the name of your theme)
register_nav_menus( array(
'main_menu' => 'Main Navigation',
'footer_menu' => 'Footer Menu',
'legal_menu' => 'Legal Menu',
));
2) Enter this in to the location in your theme file where the menu will go (normally header.php)
<?php wp_nav_menu( array( 'theme_location' => 'primary' ) );?>