WordPress.org

Forums

Post Tags and Categories for Pages
Complete/ change Post Tags and Categories for Pages (4 posts)

  1. Mick83
    Member
    Posted 1 year ago #

    Hello,
    I try to add to your plugin, a choice of options Tags or / and Cat.

    So I added this code before :
    <?php
    function ptcfp_create_menu() {
    add_options_page('Activ Tags/Cat Pages', 'Activ Tags/Cat Pages', 'administrator', __FILE__, 'ptcfp_settings_page');
    add_action('admin_init', 'register_ptcfpsettings');
    }
    add_action('admin_menu', 'ptcfp_create_menu');
    function register_ptcfpsettings() {
    register_setting('ptcfp-settings-group', 'ptcfp_add_tags');
    register_setting('ptcfp-settings-group', 'ptcfp_add_cat');
    }
    function ptcfp_settings_page() {
    $ptcfp_add_tags = get_option('ptcfp_add_tags');
    $ptcfp_add_cat = get_option('ptcfp_add_cat');
    if (empty($ptcfp_add_tags)){
    update_option('ptcfp_add_tags', 'no');
    $ptcfp_add_tags = get_option('ptcfp_add_tags');
    }
    if (empty($ptcfp_add_cat)){
    update_option('ptcfp_add_cat', 'no');
    $ptcfp_add_cat = get_option('ptcfp_add_cat');
    }
    ?>
    <div class="wrap">
    <h2>Activation des mots-clés et/ou catégorie pour les pages</h2>
    <form method="post" action="options.php">
    <?php settings_fields( 'ptcfp-settings-group' ); ?>
    <table class="form-table">
    <tr valign="top">
    <th scope="row">Mots-clés pour les pages ?</th>
    <td>
    <select name="ptcfp_add_tags" />
    <option value="yes" <?php echo $ptcfp_add_tags == 'yes'?'selected="selected"':''; ?>>Oui</option>
    <option value="no" <?php echo $ptcfp_add_tags == 'no'?'selected="selected"':''; ?>>Non</option>
    </select>
    </td>
    </tr>
    <tr valign="top">
    <th scope="row">Catégorie pour les pages ?</th>
    <td>
    <select name="ptcfp_add_cat" />
    <option value="yes" <?php echo $ptcfp_add_cat == 'yes'?'selected="selected"':''; ?>>Oui</option>
    <option value="no" <?php echo $ptcfp_add_cat == 'no'?'selected="selected"':''; ?>>Non</option>
    </select>
    </td>
    </tr>
    </table>
    <p class="submit">
    <input type="submit" name="submit-ptcfp" class="button-primary" value="<?php _e('Save Changes') ?>" />
    </p>
    </form>
    </div>
    <?php
    }
    class PTCFP {
    ...
    $ptcfp = new PTCFP();
    ?>

    I can not spend the parameters $ptcfp_add_tags and $ptcfp_add_cat in class PTCFP to then test the option.

    How?
    I'm still a beginner.
    Thank you in advance.
    Michel

    http://wordpress.org/plugins/post-tags-and-categories-for-pages/

  2. curtismchale
    Member
    Plugin Author

    Posted 1 year ago #

    As I understand it you are trying to add an options panel to the plugin so that a user can choose to add the Tags and Categories (one or both or either).

    I don't have any interest in adding that to the plugin.

    If you want to add a settings page then you should follow this tutorial by Tom (http://wp.tutsplus.com/tutorials/the-complete-guide-to-the-wordpress-settings-api-part-1/).

    I don't provide support for features that I have no interest in.

  3. Mick83
    Member
    Posted 1 year ago #

    Hello Curtis,

    You are severe with me, but I will work the subject.
    It is true that this option has no interest, but it is an opportunity to study some classes in plugins.
    Otherwise your plugin, coded in basic PHP works fine with the option.

    Pleasure.
    Thank.
    Michel

    (I am french)

  4. curtismchale
    Member
    Plugin Author

    Posted 1 year ago #

    Sorry you feel that way, I'm just being honest. I won't ever add the feature.

    I did take the time to find you a great tutorial on the subject so that you could accomplish what you want.

    I just don't have the extra time in my day to assist you to learn how to build this.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Post Tags and Categories for Pages
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.