How to add custom post meta field in WordPress Theme

Tutorials No Comments

If you are developing WordPress Themes or starting to customize your WordPress site, you will often find, that you need a custom post meta field when you are customizing posts in WordPress Themes. It can be a simple label, text field or a more advanced one, like an option to add the widely popular Revolution Slider. The main advantage of this approach is that each post can have a unique Slider and you will save your user/buyer some time due to it’s simplicity. No more tedious shortcodes for Slideshows.

Add custom post meta field

The first step is to add an extra field in each post, through which will the user choose the appropriate Slider.

Open the file function.php in theme’s directory and add the following code which will create the extra field.

ID);
if (isset($pmc_data[“post_slider”][0])){
$post_slider = $pmc_data[“post_slider”][0];
} else{
$post_slider = “”;
}
?>




getArrSliders();
if(!empty($arrSliders)){ ?>

BEST SELLING WP BLOG THEME

MARKET FOR CREATIVES

OptinMonster

OPTIN MONSTER NEWSLETTER

OptinMonster

Our Sponsors