Head Meta Data Shortcodes

Below, you’ll find a detailed guide on how to add the Head Meta Data Shortcodes to your WordPress website, including their parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the Head Meta Data Plugin shortcodes not to show or not to work correctly.

Before starting, here is an overview of the Head Meta Data Plugin and the shortcodes it provides:

Plugin Icon
Head Meta Data

"Head Meta Data is a WordPress plugin designed to manage and enhance the meta data of your website. It seamlessly injects essential SEO-friendly meta tags into your site's header."

★★★★☆ (18) Active Installs: 20000+ Tested with: 6.3.2 PHP Version: 5.6.20
Included Shortcodes:
  • [head_meta_data]
  • [hmd_custom]

Head Meta Data [head_meta_data] Shortcode

The ‘head_meta_data’ shortcode is a function in PHP that retrieves and displays content. This shortcode is used within WordPress plugins. This shortcode calls the ‘hmd_shortcode’ function, which fetches meta data via the ‘hmd_display_content’ function. It then replaces any greater than or less than symbols with their HTML entities, ensuring the content is displayed correctly.

Shortcode: [head_meta_data]

Examples and Usage

Basic Example – Provides a simple way to display meta data using the ‘head_meta_data’ shortcode.

[head_meta_data /]

PHP Function Code

In case you have difficulties debugging what causing issues with [head_meta_data] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode('head_meta_data','hmd_shortcode');

Shortcode PHP function:

function hmd_shortcode() {
	
	$get_meta_data = hmd_display_content();
	
	$the_meta_data = str_replace(array('>', '<'), array('&gt;','&lt;'), $get_meta_data);
	
	return $the_meta_data;
	
}

Code file location:

head-meta-data/head-meta-data/head-meta-data.php

Head Meta Data [hmd_custom] Shortcode

The ‘hmd_custom’ shortcode from the Head Meta Data plugin is used to retrieve and display custom data stored in the plugin’s options. The function ‘hmd_custom_shortcode’ checks if there’s any custom data set in the plugin’s options. If there is, it retrieves this data, replaces any greater than or less than symbols with their HTML entities, and returns the modified data. This allows for safe display of the custom data on the frontend.

Shortcode: [hmd_custom]

Examples and Usage

Basic example – A straightforward usage of the ‘hmd_custom’ shortcode without any parameters.

[hmd_custom /]

PHP Function Code

In case you have difficulties debugging what causing issues with [hmd_custom] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode('hmd_custom','hmd_custom_shortcode');

Shortcode PHP function:

function hmd_custom_shortcode() {
	
	global $hmd_options;
	
	if ($hmd_options['hmd_custom'] !== '') {
		
		$get_custom_data = $hmd_options['hmd_custom'];
		
		$the_custom_data = "\t\t" . str_replace(array('>', '<'), array('&gt;','&lt;'), $get_custom_data);
		
		return $the_custom_data;
		
	}
	
}

Code file location:

head-meta-data/head-meta-data/head-meta-data.php

Conclusion

Now that you’ve learned how to embed the Head Meta Data Plugin shortcodes, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *