示例#1
0
 function sidebars_body_classes($classes)
 {
     $entry_id = thb_get_page_ID();
     if ($entry_id != 0) {
         $is_sidebar_page = in_array(thb_get_page_template($entry_id), thb_config('core/sidebars', 'templates')) || is_single();
         if ($is_sidebar_page) {
             $sidebar = thb_get_post_meta($entry_id, 'sidebar');
             if ($sidebar != '0' && is_active_sidebar($sidebar)) {
                 $classes[] = 'w-sidebar';
                 // Checking the sidebar position
                 $position = thb_get_post_meta($entry_id, 'sidebar_position');
                 $classes[] = $position;
             }
         }
     } else {
         if (!is_archive() && !is_search() && !is_404()) {
             if (is_active_sidebar('post-sidebar')) {
                 $classes[] = 'w-sidebar';
             }
         }
     }
     return $classes;
 }
示例#2
0
/**
 * Ritorna il template di pagina utilizzato da una risorsa nell'area di amministrazione.
 *
 * @return string
 */
function thb_get_admin_template()
{
    global $pagenow;
    $thb_page_id = 0;
    $post_type = 'post';
    if (!empty($_POST)) {
        if (isset($_POST['post_ID'])) {
            $thb_page_id = absint($_POST['post_ID']);
        }
        if (isset($_POST['post_type'])) {
            $post_type = (string) $_POST['post_type'];
        }
    } elseif (!empty($_GET)) {
        if (isset($_GET['post'])) {
            $thb_page_id = absint($_GET['post']);
        }
        if (isset($_GET['post_type'])) {
            $post_type = (string) $_GET['post_type'];
        }
    }
    if (!$thb_page_id) {
        if ($post_type !== 'post') {
            if ($post_type !== 'page' && $pagenow !== 'edit.php') {
                return 'single-' . $post_type . '.php';
            } else {
                return 'default';
            }
        } else {
            return 'single.php';
        }
    } else {
        return thb_get_page_template($thb_page_id);
    }
}
示例#3
0
 /**
  * Get the admin page template.
  *
  * @return string
  */
 function thb_get_admin_template()
 {
     $thb_page_id = 0;
     if (isset($_GET['post'])) {
         $thb_page_id = (int) $_GET['post'];
     } elseif (defined('POLYLANG_VERSION') && isset($_GET['from_post'])) {
         // Polylang compatibility fix
         $thb_page_id = (int) $_GET['from_post'];
     }
     if (!$thb_page_id) {
         if (isset($_GET['post_type'])) {
             if ($_GET['post_type'] != 'page') {
                 return 'single-' . $_GET['post_type'] . '.php';
             } else {
                 return 'default';
             }
         } else {
             return 'single.php';
         }
     } else {
         return thb_get_page_template($thb_page_id);
     }
 }