Use of wp_print_footer_scripts hook in WP

The wp_print_footer_scripts hook in WordPress allows developers to add custom scripts or code to the footer of their website. This is particularly useful for including JavaScript or other functionality that needs to be loaded after the main content of the page. Here’s how you can use the wp_print_footer_scripts hook: Understanding the Hook:The wp_print_footer_scripts action is triggered inside the wp_footer action. It provides no… Continue reading Use of wp_print_footer_scripts hook in WP

How to get the name of the image fetched in WordPress using WP inBulit-function

In WordPress, when you fetch an image, you typically retrieve its metadata, which includes various information about the image, such as its title, alt text, URL, etc. To get the name of the image (assuming you’re working within a WordPress loop or have access to the image data), you can use the following code: <?php… Continue reading How to get the name of the image fetched in WordPress using WP inBulit-function

Detect when the reader is in a mobile device – WordPress

In WordPress, wp_is_mobile() is a function that is used to determine whether the current user agent (web browser) is accessing the site using a mobile device. This function checks if the user is browsing the site from a mobile device and returns a boolean value accordingly. Here’s an example of how you might use wp_is_mobile()… Continue reading Detect when the reader is in a mobile device – WordPress

How To Get a List of All Active Plugins Programmatically

To get a list of all active plugins programmatically in WordPress, you can use the WordPress API functions. WordPress provides functions that allow you to retrieve information about active plugins. You can use either the get_option function or the wp_get_active_and_valid_plugins function. Here’s how you can use both methods: Method 1: Using get_option: Using wp_get_active_and_valid_plugins: Both… Continue reading How To Get a List of All Active Plugins Programmatically

Why wp_enqueue_style() not Working?

First step is to ensure you are using the correct path of the CSS file. For the responsive Directory use Example: The second step is to ensure that wp_head() is being called on the page you are displaying. It can be placed in your header template (in between <head></head tags) or on top of archives/post files etc.… Continue reading Why wp_enqueue_style() not Working?

How to enqueue style.css file in WordPress theme

It is best to combine all enqueued scripts and styles into a single function, and then call them using the wp_enqueue_scripts action. add_theme_scripts() → Any name can be used for naming the function get_stylesheet_uri() → This function automatically finds the style.css file in the theme folder and outs its URL.

Blog related WP-functions

Some useful WordPress functions used for Blog Development: get_post_permalink() To get the post link get_permalink($post->ID)To get the corresponding Blog link get_the_post_thumbnail_url(get_the_ID())To get the post thumbnail image URL get_the_title()To get the Title of the Post get_the_excerpt()To get the expert Text