コード例 #1
0
 /**
  * Determines whether the widget should show or not.
  *
  * @since 1.3.0
  * @access private
  *
  * @param $instance
  * @param WP_Widget $widget
  * @param $args
  *
  * @return bool
  */
 function widget_visibility($instance, $widget, $args)
 {
     if (isset($instance['jc-sectionwidget-hide-sections']) && ($current_post = get_post()) && jc_site_section()) {
         if (in_array(jc_site_section(), $instance['jc-sectionwidget-hide-sections'])) {
             return false;
         }
     }
     return $instance;
 }
コード例 #2
0
/**
 * Tricks the wpnavmenu in the sidebar to thinking the current section ID is the current post ID.
 *
 * @since 1.3.0
 * @access private
 */
function jc_section_program_set_queried_object_ID()
{
    global $wp_query;
    static $queried_ID;
    if (!$queried_ID) {
        $queried_ID = (int) $wp_query->queried_object_id;
        $wp_query->queried_object_id = (int) jc_site_section();
    } else {
        $wp_query->queried_object_id = $queried_ID;
    }
}
 /**
  * Modifies the admin bar.
  *
  * @since v1.0.0
  * @access private
  */
 function modify_admin_bar()
 {
     /** @param WP_Admin_Bar $admin_bar */
     global $wp_admin_bar;
     if (jc_userroles_current_role() != 'site_section_manager') {
         return;
     }
     if (!$this->site_sections || !in_array(jc_site_section(), $this->site_sections)) {
         $wp_admin_bar->remove_node('edit');
         $wp_admin_bar->remove_node('jc_edit_section');
     }
 }
コード例 #4
0
/**
 * Replaces the RIGHT sidebar with the section sidebar, if applicable.
 *
 * @since 1.3.0
 * @access private
 *
 * @param string $sidebar_ID Current sidebar ID.
 */
function jc_section_replace_right_sidebar($sidebar_ID)
{
    if (!($section_ID = jc_site_section())) {
        return $sidebar_ID;
    }
    if (is_registered_sidebar("section-right-sidebar-{$section_ID}")) {
        return "section-right-sidebar-{$section_ID}";
    }
    return $sidebar_ID;
}