This snippet allows you to show the current local time, in the language the WordPress installation has been configured to use. Instructions Add this snippet in your theme files, where you want to show current time, localized. < ?php echo date_i18n(‘j F’, time()); ?> Relevant link: https: //codex.wordpress.org/Formatting_Date_and_Time
By default, WordPress allows authors/users to see all images uploaded to a WordPress site’s media library. This could be a problem if your site has users with individual images/galleries. This WordPress snippet will allow you to restrict WordPress media library access to user’s own uploads.
This WordPress snippet will allow you to show the image caption for the featured image in your WordPress posts without using a plugin.
Here is a little snippet that enables you to display the total numbers of WordPress posts for a specific custom post type. The following code will get the total number of published posts in a custom post type and display it in your theme.
This snippet will allow you to insert WordPress shortcodes into your theme-/templates – using WordPress built-in function do_shortcode()
This snippet will let you define a new custom default excerpt length for the WordPress excerpts output. The following example will set the default excerpt length to 20 characters.
This WordPress snippet will let you show a list of post by a specific user. This is useful if you for example want to show a list of posts from a specific user on Custom Post Types etc.
Custom post types are not included in the WordPress search results by default – adding this snippet to you functions.php creates a function that allows specific custom post types to be queried and searched by WordPress.
Sometimes you would want to output content based on WordPress meta fields – and use conditions (statements) based on wether or not the meta fields has data etc. In this example we are using a meta field with the name: “youtube-video-id” and value: “abcd1234”.
Did you know that you can use WordPress built-in “mobile detect” function wp_is_mobile to create a simple shortcode that can hide certain parts of your content from mobile visitors and-/or desktop visitors.