Following snippet will add AS Ads Manager textarea field in the WordPress Dashboard.
// create admin area fields
add_action('admin_menu', 'add_global_custom_options');
function add_global_custom_options()
{
add_options_page('AS Ads Manager', 'AS Ads Manager', 'manage_options', 'functions','global_custom_options');
}
function global_custom_options()
{
?>
<div class="wrap">
<h2>AS Ads Manager</h2>
<form method="post" action="options.php">
<?php wp_nonce_field('update-options') ?>
<p><strong>Enter Your Ad Code Here:</strong><br />
<textarea name="as-job-ads" style="width:100%;height:300px" ><?php echo get_option('as-job-ads'); ?></textarea>
</p>
<p><input type="submit" name="Submit" value="Update Ad Code" /></p>
<input type="hidden" name="action" value="update" />
<input type="hidden" name="page_options" value="as-job-ads" />
</form>
</div>
<?php
}
Now If you want to display the content of that textarea in the frontend then you can use the following snippet in your theme’s template files(archive, single post, etc).
<!-- AS Ads-->
<?php echo get_option('as-job-ads') ?>
<!-- AS Ads-->
Need Professional Support for Your Website Problems?
Whether you're facing website issues or struggling with code implementation, our team is here to assist. Hire us to get your website back on track.
Hire Us