• I would highly recommend you add Custom Post Type support under your “Show on” options. This can be achieved fairly easily by adding the following lines of code to the appropriate files:

    //admin/admin.php - function show_on_setting() - line 709
    <?php foreach(get_post_types(array('public'=>true, '_builtin' => false)) as $type){ ?>
    <li>
            <span><input id='social_on_<?php echo $type ?>' name='wp_social_ring_options[social_on_<?php echo $type ?>]' type='checkbox' value="1" <?php checked($this->options["social_on_$type"], 1); ?> /></span>
            <span><?php _e(get_post_type_object($type)->label,WP_SOCIAL_RING) ?></span>
        </li>
    <?php } ?>
    
    //admin/admin.php - function validate_options() - line 742
    foreach(get_post_types(array('public'=>true, '_builtin' => false)) as $type){
        $valid["social_on_$type"] = (isset( $input["social_on_$type"])) ? 1 : 0;
    }
    
    //includes/library.php - function set_default_options() - line 78
    foreach(get_post_types(array('public'=>true, '_builtin' => false)) as $type){
        if(!isset($this->options["social_on_$type"])) {
            $this->options["social_on_$type"] = 0;
        }
    }
    
    //includes/library.php - function print_check() - line 575
    function print_check() {
        $current_type = get_post_type();
        if(is_single() && $current_type == "post") {
            return $this->options['social_on_posts'];
        }
        if(is_page() && $current_type == "page") {
            return $this->options['social_on_pages'];
        }
        if(is_home()) {
            return $this->options['social_on_home'];
        }
        if(is_category()) {
            return $this->options['social_on_category'];
        }
        if(is_archive()) {
            return $this->options['social_on_archive'];
        }
        if(is_single() && isset($this->options["social_on_$current_type"])) {
            return $this->options["social_on_$current_type"];
        }
        return 0;
    }

    Testing on my end yielded satisfactory results. All in all, keep up the great work.

Viewing 1 replies (of 1 total)
  • Hey nice improvement!!

    One question…is there any way to avoid social button in certain page? I mean…do it independently, or per-page…

    thanks!!

Viewing 1 replies (of 1 total)
  • The topic ‘Suggested Custom Post Type Support’ is closed to new replies.