WordPress.org

Forums

Post Tags and Categories for Pages
[resolved] Complete Post Tags and Categories for Pages (2 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 atcp_create_menu() {
    add_options_page('Activ Tags/Cat Pages', 'Activ Tags/Cat Pages', 'administrator', __FILE__, 'ptcfp_settings_page');
    	add_action('admin_init', 'register_atcpsettings');
    }
    add_action('admin_menu', 'ptcfp_create_menu');
    function register_atcpsettings() {
    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($atcp_add_tags)){
    update_option('ptcfp_add_tags', 'no');
    $ptcfp_add_tags	= get_option('ptcfp_add_tags');
    }
    if (empty($ptcfp_add_cat)){
    update_option('atcp_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();
    ?>

    [Please use the backticks when posting code here]

    I can not spend the parameters $atcp_add_tags and $atcp_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. Mick83
    Member
    Posted 1 year ago #

    See other "Complete Post Tags and Categories for Pages" message because it contains errors.
    thank you

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.