Add ID to output only for first option

Instead of using an if check, use filter_var() so that any boolean-ish value can be passed in the shortcode attribute; e.g., yes, no, on, off, true, false, 0, 1. $no = filter_var( $no, FILTER_VALIDATE_BOOLEAN ); Now, $no is either true or false (boolean). Sorry, I see $no is actually a number. My mistake. if ( … Read more

Theme editing “post thumbnail” help

Well, I have set the featured image or any other from post with this code: Get the image $image_id=get_post_thumbnail_id(get_the_ID()); $image_url = wp_get_attachment_image_src($image_id,’full’); $image_url=$image_url[0]; Set the image as background <div id=”full” class=”full float-left” style=”background-image:url(<?php get_image_url(); ?>);”> Your content here. </div> Next, one example I made few years ago taking the image from random post, the image … Read more

How to Display Most View Post in the template file?

The function getPostViews() is retrieving the total number of views for each post while setPostViews() increases the post views counter each time post is viewed. You need to call setPostViews() somewhere in your single.php and then use below code to retrieve posts on basis of posts view count. $args = Array( ‘post_type’ => ‘post’, ‘posts_per_page’ … Read more

Will dequeueing in child theme functions.php file prevent Google Fonts from loading?

Dequeueing the enqueued style will be sufficient. But you need to be careful to dequeue it after it is enqueued. It is enqueued at the default priority of 10, so make sure that when you hook into wp_enqueue_scripts you do so at a higher/later priority. add_action( ‘wp_enqueue_scripts’, ‘wpse_escutcheon_scripts’, 11 ); function wpse_escutcheon_scripts() { wp_dequeue_style( ‘escutcheon-fonts’ … Read more