Im battling to add a description / introduction field to the top of the archive of my custom post type. I manage easy with with ACF's option page, but I would like to do without ACF.

I have managed, halfway, but i think my code is messy... The description/introduction does displays on the frontend, but in the admin, the textarea's layout is not funny: I can't get it to display full-width and some odd spaces are added once I hit save. Please help me out :)

See 2x screenshots. enter image description hereenter image description here

Is there a better way to simply add a custom field where users can add a description which will the display at the top of custom post type page; Very much the same as one can add a description for a taxonomy.

This is my code:

add_action( 'admin_menu', 'tsumtour_add_admin_menu' );
add_action( 'admin_init', 'tsumtour_settings_init' );
function tsumtour_add_admin_menu(  ) { 
    add_submenu_page( 'edit.php?post_type=tour', 'Tour', 'Intro', 'manage_options', 'tour', 'tsumtour_options_page' );
function tsumtour_settings_init(  ) { 
    register_setting( 'pluginPage', 'tsumtour_settings' );
        __( 'Introduction', 'tsum_tour' ), 
        __( '', 'tsum_tour' ), 
function tsumtour_textarea_field_0_render(  ) { 
    $options = get_option( 'tsumtour_settings' );
    <textarea cols='80' rows='15' name='tsumtour_settings[tsumtour_textarea_field_0]'> 
        <?php echo $options['tsumtour_textarea_field_0']; ?>
  • 1
    I'm not sure if this is what you're asking, as the pic is of admin and not of the archive page which you refer to. I answered something similar for an archive page recently wordpress.stackexchange.com/a/235713/94267 – Andy Macaulay-Brook Sep 25 '16 at 11:57
  • Thank you for your help; I have added another screenshot and tried to explain a bit better. All I really want is the same way one can add a description to a taxonomy / category; I would like users to be able to add ONE description which will then display on the archive page of that CPT and also on the taxonomy pages, in this case: Region. Thank you. – schalkjoubert Sep 27 '16 at 6:10
  • Would you please edit your question, and add the missing tsumtour_settings_section_callback() and tsumtour_options_page functions? – Dave Romsey May 24 '17 at 20:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.