customization - Figuring out how to create "Option Pages" in WordPress admin

admin2025-06-06  10

I'm having a static front page, in which I plan to have the little bits like text, buttons, and other plain stuff editable through wp-admin.

I plan to make it simple, just like in "Settings > General" (options-general.php), with input values to fill by the users. However, I've been encountering difficulties to achieve that.

I've been following the tutorial from Tutsplus but they hooked into the_content instead, with only one value. Which seems to be inserted into wp_options in the MySQL table. I want to put it into a separate, new table. For example, wp_frontpage.

Here is the mostly unaltered code in views/settings.php

<div class="wrap">

<h1><?php echo esc_html( get_admin_page_title() ); ?></h1>

<form method="post" action="<?php echo esc_html( admin_url( 'admin-post.php' ) ); ?>">

    <div id="universal-message-container">
        <h2>Front</h2>

        <div class="options">
            <p>
                <label>What message would you like to display above each post?</label>
                <br />
                <input type="text" name="acme-message"
                value="<?php echo esc_attr( $this->deserializer->get_value( 'tutsplus-custom-data' ) ); ?>"
                />
            </p>
    </div><!-- #universal-message-container -->

    <?php
        wp_nonce_field( 'acme-settings-save', 'acme-custom-message' );
        submit_button();
    ?>

</form>

I tried looking at the official guide:

But apparently the page is obsolete since it didn't do anything.

Any guide to do this?

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1749197307a317179.html

最新回复(0)