Пример #1
0
function simple_links_load()
{
    Simple_Links_Categories::get_instance();
    Simple_Links_WP_Links::init();
    add_action('init', array('Simple_Link', 'register_sl_post_type'));
    if (is_admin()) {
        Simple_Links_Settings::init();
        Simple_Links_Sort::init();
        Simple_Links_Visual_Shortcodes::init();
    }
}
Пример #2
0
 /**
  * Retrieve the proper links based on argument set earlier
  *
  * @return obj
  *
  * @since 1.7.14
  */
 protected function getLinks()
 {
     $this->query_args['post_type'] = Simple_Link::POST_TYPE;
     $this->query_args['posts_per_page'] = $this->query_args['numberposts'];
     $this->query_args['posts_per_archive_page'] = $this->query_args['numberposts'];
     // If we are retrieving a single category and ordering by menu order
     // we need to use our special retrieval method to maintain order by that category
     if ($this->query_args['orderby'] == 'menu_order' && !empty($this->query_args['tax_query'][0]['terms']) && count($this->query_args['tax_query'][0]['terms']) == 1) {
         $links = Simple_Links_Categories::get_instance()->get_links_by_category($this->query_args['tax_query'][0]['terms'][0], $this->query_args['numberposts'], $this->args['include_child_categories']);
     } else {
         $links = get_posts($this->query_args);
     }
     $links = apply_filters('simple_links_object', $links, $this->args, $this);
     //backwards compatible
     $links = apply_filters('simple_links_' . $this->args['type'] . '_links_object', $links, $this->args);
     $links = apply_filters('simple_links_' . $this->args['type'] . '_links_object_' . $this->args['id'], $links, $this->args);
     return $this->links = $links;
 }
Пример #3
0
 /**
  * Get Links By Category
  *
  * Called via ajax to replenish the links ordering list when a category is selected.
  * We do it honor a 200 links limit per category as well.
  *
  * @return void
  */
 public function ajax_get_links_by_category()
 {
     $links = Simple_Links_Categories::get_instance()->get_links_by_category($_POST['category_id']);
     require SIMPLE_LINKS_DIR . 'admin-views/draggable-links.php';
     die;
 }