WP NAV
WordPress

<?php wp_nav_menu( array( 'theme_location' => 'primary-menu', 'container' => '', 'items_wrap' => '<ul>%3$s</ul>' ) ); ?>

Search Count
WordPress

<?php echo $wp_query->found_posts; ?> Search Result(s) For "<?php the_search_query(); ?>"

Template Part
WordPress

<?php get_template_part( 'partials/nav' ); ?>

WordPress Home URL
WordPress

<?php echo home_url(); ?>

Responsive Youtube
WordPress

add_filter('embed_oembed_html', function ($html, $url, $attr, $post_id) {
	if(strpos($html, 'youtube.com') !== false || strpos($html, 'youtu.be') !== false){
  		return '<div class="responsive-embed-container embed-responsive-16by9">' . $html . '</div>';
	} else {
	 return $html;
	}
}, 10, 4);
.responsive-embed-container {
	position: relative;
	display: block;
	overflow: hidden;
	height: 0;
	max-width: 100% !important;
}
.embed-responsive-16by9 {
  	padding-bottom: 56.25%;
	aspect-ratio: 16 / 9;
}
.responsive-embed-container iframe, .responsive-embed-container object, .responsive-embed-container embed {
	position: absolute;
	left: 0;
	top: 0;
	height: 100%;
	width: 100%;
}

Button Shortcode
WordPress


/* button */
add_shortcode( 'custom-button', 'custom_button_shortcode' );
function custom_button_shortcode( $atts ) {
extract( shortcode_atts(
array(
'title' => 'title',
'url' => ''
),
$atts
));
return '<a target="' . $target . '" class="" href="' . $url . '">' . $title . '</a>';
}

[custom-button title="#" url="#"]

Do Shortcode
WordPress

<?php echo do_shortcode('[shortcode]'); ?>

CPT Loop
WordPress


<?php query_posts('post_type=POSTTYPE&posts_per_page=5'); if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<h1><?php the_title(); ?></h1>
<?php the_content(); ?>
<?php endwhile; wp_reset_query(); ?>

Featured Image URL
WordPress


$featured_img_url = get_the_post_thumbnail_url(get_the_ID(),'IMGSIZE');

Trim Words
WordPress

echo wp_trim_words( get_the_content(), 100 ); // post content
echo wp_trim_words( get_the_excerpt(), 100 ); // post excerpt
echo wp_trim_words( get_the_title(), 100 ); // post title