$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>customization - Figuring out how to create "Option Pages" in WordPress admin|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

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

matteradmin8PV0评论

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?

Post a comment

comment list (0)

  1. No comments so far