当前位置: 首页>>代码示例>>PHP>>正文


PHP get_slug函数代码示例

本文整理汇总了PHP中get_slug函数的典型用法代码示例。如果您正苦于以下问题:PHP get_slug函数的具体用法?PHP get_slug怎么用?PHP get_slug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_slug函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: action_counter

function action_counter($action_KEY, $options = NULL)
{
    global $db;
    $slug = get_slug($action_KEY);
    if ($options['date']) {
        $date_condition = ' and Date_Created  >= "' . $options['date'] . '"';
    }
    $sql = 'select COUNT(supporter_KEY) as count from supporter where Source_Details LIKE "http://' . SALSA_URL . '/p/dia/action/public/?action_KEY=' . $action_KEY . '%" ' . $date_condition;
    if ($options['on_list'] == TRUE) {
        $sql = 'select COUNT(s.supporter_KEY) as count from supporter as s, supporter_groups as g where s.Source_Details LIKE "http://' . SALSA_URL . '/p/dia/action/public/?action_KEY=' . $action_KEY . '%"  and g.groups_KEY = ' . SALSA_GROUP_FULL_LIST . ' and g.supporter_KEY = s.supporter_KEY' . $date_condition;
    }
    $R = $db->CacheExecute($sql) or die($db->errorMsg());
    $r = $R->FetchRow();
    if ($r['count'] == 0 && $slug) {
        $sql = 'select COUNT(supporter_KEY) as count from supporter where Source_Details LIKE "' . ACTION_URL . $slug . '%" ' . $date_condition;
        #echo $sql;
        #for supporters that are currently on a list
        if ($options['on_list'] == TRUE) {
            $sql = 'select COUNT(s.supporter_KEY) as count from supporter as s, supporter_groups as g where s.Source_Details LIKE "' . ACTION_URL . $slug . '%" and g.groups_KEY = ' . SALSA_GROUP_FULL_LIST . ' and g.supporter_KEY = s.supporter_KEY' . $date_condition;
        }
        $R = $db->CacheExecute($sql) or die($db->errorMsg());
        $r = $R->FetchRow();
    }
    return $r['count'];
}
开发者ID:radicaldesigns,项目名称:jaguar,代码行数:25,代码来源:action.php

示例2: nav_main

function nav_main($dbc, $path)
{
    //$q = "SELECT * FROM navigation ORDER BY position ASC";
    //$r = mysqli_query($dbc, $q);
    $stmt = $dbc->query('SELECT * FROM navigation ORDER BY position ASC');
    $stmt->setFetchMode(PDO::FETCH_ASSOC);
    while ($nav = $stmt->fetch()) {
        $nav['slug'] = get_slug($dbc, $nav['url']);
        ?>
	

		<li<?php 
        selected($path['call_parts'][0], $nav['slug'], ' class="active"');
        ?>
><a href="<?php 
        echo $nav['url'];
        ?>
"><?php 
        echo $nav['label'];
        ?>
</a></li>

	<?php 
    }
}
开发者ID:mastigos,项目名称:Atom.CMS3,代码行数:25,代码来源:template.php

示例3: display_page_header

function display_page_header($module, $document, $id, $metadata, $current_version, $options = array())
{
    $is_archive = $document->isArchive();
    $mobile_version = c2cTools::mobileVersion();
    $content_class = $module . '_content';
    $lang = $document->getCulture();
    $version = $is_archive ? $document->getVersion() : NULL;
    $slug = '';
    $prepend = _option($options, 'prepend', '');
    $separator = _option($options, 'separator', '');
    $nav_options = _option($options, 'nav_options');
    $item_type = _option($options, 'item_type', '');
    $nb_comments = _option($options, 'nb_comments');
    $creator_id = _option($options, 'creator_id');
    if (!$is_archive) {
        if ($module != 'users') {
            $slug = get_slug($document);
            $url = "@document_by_id_lang_slug?module={$module}&id={$id}&lang={$lang}&slug={$slug}";
        } else {
            $url = "@document_by_id_lang?module={$module}&id={$id}&lang={$lang}";
        }
    } else {
        $url = "@document_by_id_lang_version?module={$module}&id={$id}&lang={$lang}&version={$version}";
    }
    if (!empty($prepend)) {
        $prepend .= $separator;
    }
    echo display_title($prepend . $document->get('name'), $module, true, 'default_nav', $url);
    if (!$mobile_version) {
        echo '<div id="nav_space">&nbsp;</div>';
        sfLoader::loadHelpers('WikiTabs');
        $tabs = tabs_list_tag($id, $lang, $document->isAvailable(), 'view', $version, $slug, $nb_comments);
        echo $tabs;
        // liens internes vers les sections repliables du document
        if ($nav_options == null) {
            include_partial("{$module}/nav_anchor");
        } else {
            include_partial("{$module}/nav_anchor", array('section_list' => $nav_options));
        }
        // boutons vers des fonctions annexes et de gestion du document
        include_partial("{$module}/nav", isset($creator_id) ? array('id' => $id, 'document' => $document, 'creator_id' => $creator_id) : array('id' => $id, 'document' => $document));
        if ($module != 'users') {
            sfLoader::loadHelpers('Button');
            echo '<div id="nav_share" class="nav_box">' . button_share() . '</div>';
        }
    }
    echo display_content_top('doc_content', $item_type);
    echo start_content_tag($content_class);
    if ($merged_into = $document->get('redirects_to')) {
        include_partial('documents/merged_warning', array('merged_into' => $merged_into));
    }
    if ($is_archive) {
        include_partial('documents/versions_browser', array('id' => $id, 'document' => $document, 'metadata' => $metadata, 'current_version' => $current_version));
    }
}
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:55,代码来源:ViewerHelper.php

示例4: create

 public function create()
 {
     $nombre = $_POST['category_name'];
     $slug = get_slug($nombre);
     $existe = $this->category_exist($slug);
     if ($existe) {
         $result = site_url() . 'admin/categorias/?code=6&cat=' . $nombre;
         url_redirect($result);
     } else {
         $data = $this->model('CategoriesModel');
         $result = $data->save($nombre, $slug);
         url_redirect($result);
     }
 }
开发者ID:chokonet,项目名称:alejandrocervantes.me,代码行数:14,代码来源:CategoriesController.php

示例5: create

 public function create()
 {
     $count = 1;
     if (isset($_POST['titulo']) and $_POST['titulo'] != '') {
         $titlulo = $_POST['titulo'];
         $slug = get_slug($titlulo);
         $data = $this->model('PostsModel');
         $existe = $data->slug_exist($slug);
         if ($existe) {
             $slug = $this->cambiaSlug($slug);
         }
         $result = $data->save($_POST, $slug);
         if (isset($_POST['categorias']) and !empty($_POST['categorias']) and isset($result[1])) {
             $this->set_categories($result[1], $_POST['categorias']);
         }
         url_redirect($result[0]);
     }
 }
开发者ID:chokonet,项目名称:alejandrocervantes.me,代码行数:18,代码来源:PostsController.php

示例6: nav_main

function nav_main($dbc, $path)
{
    $q = "SELECT * FROM navigation ORDER BY position ASC";
    $r = mysqli_query($dbc, $q);
    while ($nav = mysqli_fetch_assoc($r)) {
        $nav['slug'] = get_slug($dbc, $nav['url']);
        ?>
    <li<?php 
        selected($path['call_parts'][0], $nav['url'], ' class="active"');
        ?>
><a href="<?php 
        echo $nav['url'];
        ?>
"><?php 
        echo $nav['label'];
        ?>
</a></li>
<?php 
    }
}
开发者ID:pallav1991,项目名称:mca,代码行数:20,代码来源:template.php

示例7: nav_items

function nav_items($dbc, $path)
{
    $q = "SELECT * FROM navigation WHERE status = 1 AND sub = 0 ORDER BY position ASC";
    $r = mysqli_query($dbc, $q);
    while ($nav = mysqli_fetch_assoc($r)) {
        $position = $nav['position'];
        $nav['slug'] = get_slug($dbc, $nav['url']);
        ?>
     
    <li <?php 
        selected($path['call_parts'][0], $nav['slug'], ' class="active"');
        ?>
><a href="<?php 
        echo $nav['url'];
        ?>
"><?php 
        echo $nav['icon'];
        echo stripslashes($nav['label']);
        ?>
</a>
    
    <?php 
        $query = "SELECT `url`, `label`, `icon`, `sub` FROM navigation WHERE `sub` = '{$position}' AND `status` = '1'";
        $result = mysqli_query($dbc, $query);
        if (mysqli_num_rows($result) >= 1) {
            echo "<i class='fa fa-sort-desc menu-caret'></i>";
            echo "<ul class='sub-menu'>";
            while ($numrows = mysqli_fetch_assoc($result)) {
                if ($numrows['sub'] == $position) {
                    echo "<li class='sub-item'><a href='" . $numrows['url'] . "'>" . $numrows['icon'] . "" . stripslashes($numrows['label']) . "</a></li>";
                }
            }
            echo "</ul>";
        }
        ?>
          
    </li>  
<?php 
    }
}
开发者ID:JasonMate,项目名称:Atom-CMS-Project,代码行数:40,代码来源:main-nav.php

示例8: picto_tag

                 echo !$mobile_version ? '</td><td>' : ' - ';
                 $author_info =& $outing['versions'][0]['history_metadata']['user_private_data'];
                 $georef = '';
                 if (!$outing->getRaw('geom_wkt') instanceof Doctrine_Null) {
                     $georef = ($mobile_version ? ' - ' : '') . picto_tag('action_gps', __('has GPS track'));
                 }
                 $images = '';
                 if (isset($outing['nb_images'])) {
                     if ($mobile_version) {
                         $images = ' - ' . picto_tag('picto_images_light') . '&nbsp;' . $outing['nb_images'];
                     } else {
                         $images = picto_tag('picto_images_light', format_number_choice('[1]1 image|(1,+Inf]%1% images', array('%1%' => $outing['nb_images']), $outing['nb_images']));
                     }
                 }
                 $outing_lang = $outing->get('culture');
                 echo link_to($outing->get('name'), '@document_by_id_lang_slug?module=outings&id=' . $outing->get('id') . '&lang=' . $outing_lang . '&slug=' . get_slug($outing), array('hreflang' => $outing_lang)) . (!$mobile_version ? '</td><td>' : '') . $georef . (!$mobile_version ? '</td><td>' : '') . $images . (!$mobile_version ? '</td><td>' : ' - ') . link_to($author_info['topo_name'], '@document_by_id?module=users&id=' . $author_info['id']);
                 echo !$mobile_version ? '</td></tr>' : '</li>';
             }
             echo !$mobile_version ? '</tbody></table>' : '</ul>';
             if (count($routes_outings) > 1) {
                 echo simple_pager_navigation($count, count($routes_outings), 'routings_group_');
             }
             ?>
            </div>
         <?php 
         }
         // routes outings list link
         include_partial('outings/linked_outings', array('id' => $ids, 'module' => 'routes', 'nb_outings' => $nb_routes_outings, 'document' => $document));
     }
 }
 // new outing button
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:31,代码来源:viewSuccess.php

示例9: config_load

/**
 * Load config file
 *
 * @param   string   $path                         the configuration file path
 * @param   boolean  $load_user_configuration_dir  do we have to parse all user configuration files ? No for upgrade for example...
 *
 * @return  array    [ badges , files ]
 */
function config_load($load_user_configuration_dir = true)
{
    $badges = false;
    $files = false;
    // Read config file
    $config = get_config_file();
    if (is_null($config)) {
        return array($badges, $files);
    }
    // Get badges
    $badges = $config['badges'];
    // Set user constant
    foreach ($config['globals'] as $cst => $val) {
        if ($cst == strtoupper($cst)) {
            @define($cst, $val);
        }
    }
    // Set unset constants
    load_default_constants();
    // Set time limit
    @set_time_limit(MAX_SEARCH_LOG_TIME + 2);
    // Append files from the USER_CONFIGURATION_DIR
    if ($load_user_configuration_dir === true) {
        if (is_dir(PML_CONFIG_BASE . DIRECTORY_SEPARATOR . USER_CONFIGURATION_DIR)) {
            $dir = PML_CONFIG_BASE . DIRECTORY_SEPARATOR . USER_CONFIGURATION_DIR;
            $userfiles = new RegexIterator(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir, RecursiveDirectoryIterator::SKIP_DOTS), RecursiveIteratorIterator::SELF_FIRST, RecursiveIteratorIterator::CATCH_GET_CHILD), '/^.+\\.(json|php)$/i', RecursiveRegexIterator::GET_MATCH);
            foreach ($userfiles as $userfile) {
                $filepath = realpath($userfile[0]);
                $c = get_config_file($filepath);
                if (!is_null($c)) {
                    foreach ($c as $k => $v) {
                        $fileid = get_slug(str_replace(PML_CONFIG_BASE, '', $filepath) . '/' . $k);
                        $config['files'][$fileid] = $v;
                        $config['files'][$fileid]['included_from'] = $filepath;
                    }
                }
            }
        }
    }
    // Oups, there is no file... abort
    if (!isset($config['files'])) {
        return array($badges, $files);
    }
    // Try to generate the files tree if there are globs...
    $files_tmp = $config['files'];
    $files = array();
    foreach ($files_tmp as $fileid => $file) {
        $path = $file['path'];
        $count = max(1, @(int) $file['count']);
        $gpaths = glob($path, GLOB_MARK | GLOB_NOCHECK);
        if (count($gpaths) == 0) {
        } else {
            if (count($gpaths) == 1) {
                $files[$fileid] = $file;
                $files[$fileid]['path'] = $gpaths[0];
            } else {
                $new_paths = array();
                $i = 1;
                foreach ($gpaths as $path) {
                    $new_paths[$path] = filemtime($path);
                }
                // The most recent file will be the first
                arsort($new_paths, SORT_NUMERIC);
                // The first file id is the ID of the configuration file then others files are suffixed with _2, _3, etc...
                foreach ($new_paths as $path => $lastmodified) {
                    $ext = $i > 1 ? '_' . $i : '';
                    $files[$fileid . $ext] = $file;
                    $files[$fileid . $ext]['oid'] = $fileid;
                    $files[$fileid . $ext]['odisplay'] = $files[$fileid . $ext]['display'];
                    $files[$fileid . $ext]['path'] = $path;
                    $files[$fileid . $ext]['display'] .= ' > ' . basename($path);
                    if ($i >= $count) {
                        break;
                    }
                    $i++;
                }
            }
        }
    }
    // Remove forbidden files
    if (Sentinel::isAuthSet()) {
        // authentication is enabled on this instance
        $username = Sentinel::getCurrentUsername();
        $final = array();
        // Anonymous access only
        if (is_null($username)) {
            foreach ($files as $fileid => $file) {
                $a = $fileid;
                // glob file
                if (isset($files[$fileid]['oid'])) {
                    $a = $files[$fileid]['oid'];
                }
//.........这里部分代码省略.........
开发者ID:expressive-analytics,项目名称:docker-dt-standard.php,代码行数:101,代码来源:global.inc.php

示例10: Export

 /**
  * returns a GPX, KML or GeoJSON version of the document geometry with some useful additional informations in best possible lang
  */
 protected function Export($module, $id, $lang, $format, $version = null)
 {
     if (!$id) {
         $this->setErrorAndRedirect('Could not understand your request', "@default_index?module={$module}");
     }
     if (!empty($version)) {
         $document = $this->getDocument($id, $lang, $version);
     }
     if (empty($document)) {
         $document = Document::find('Document', $id, array('module', 'geom_wkt'));
     }
     if (!$document || $document->get('module') != $module) {
         $this->setErrorAndRedirect('Document does not exist', "@default_index?module={$module}");
     }
     if ($document->get('geom_wkt')) {
         sfLoader::loadHelpers(array('General'));
         $doc = DocumentI18n::findNameDescription($id, $lang);
         // document can exist (id) but not in required lang (id, lang)
         if ($doc) {
             $this->name = $doc->get('name');
             $this->description = $doc->get('description');
             $this->slug = get_slug($doc);
         } else {
             $this->name = 'C2C::' . ucfirst(substr($module, 0, strlen($module) - 1)) . " {$id}";
             $this->description = "";
             $this->slug = "";
         }
         $response = $this->getResponse();
         switch ($format) {
             case 'gpx':
                 $this->points = gisQuery::getEWKT($id, true, $module, $version);
                 $this->setTemplate('../../documents/templates/exportgpx');
                 $response->setContentType('application/gpx+xml');
                 break;
             case 'kml':
                 $this->points = gisQuery::getEWKT($id, true, $module, $version);
                 $this->setTemplate('../../documents/templates/exportkml');
                 $response->setContentType('application/vnd.google-earth.kml+xml');
                 break;
             case 'json':
                 $this->geojson = gisQuery::getGeoJSON($id, $module, $version, 6);
                 $this->setTemplate('../../documents/templates/exportjson');
                 $response->setContentType('application/json');
                 break;
         }
         $this->setLayout(false);
     } else {
         sfLoader::loadHelpers('General');
         $this->setErrorAndRedirect('This document has no geometry', "@document_by_id_lang_slug?module={$module}&id={$id}&lang={$lang}&slug=" . get_slug($document));
     }
 }
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:54,代码来源:actions.class.php

示例11: _h

<ul class="nav navbar-nav"><li class="dropdown" title="<?php 
        _h('Select a log file to display');
        ?>
"><a href="#" class="dropdown-toggle" data-toggle="dropdown"><span id="file_selector"></span></a><ul class="dropdown-menu"><?php 
        $notagged = '';
        $tagged = '';
        foreach (config_extract_tags($files) as $tag => $f) {
            if ($tag === '_') {
                foreach ($f as $file_id) {
                    $selected = isset($_GET['i']) && $_GET['i'] === $file_id ? ' active' : '';
                    $notagged .= '<li id="file_' . $file_id . '" data-file="' . $file_id . '" class="file_menup' . $selected . '"><a class="file_menu" href="#" title="';
                    $notagged .= isset($files[$file_id]['included_from']) ? h(sprintf(__('Log file #%s defined in %s'), $file_id, $files[$file_id]['included_from'])) : h(sprintf(__('Log file #%s defined in main configuration file'), $file_id));
                    $notagged .= '">' . $files[$file_id]['display'] . '</a></li>';
                }
            } else {
                $tagged .= '<li class="tag-' . get_slug($tag) . '"><a href="#">' . h($tag);
                if (TAG_DISPLAY_LOG_FILES_COUNT === true) {
                    $tagged .= ' <small class="text-muted">(' . count($f) . ')</small>';
                }
                $tagged .= '</a>';
                $tagged .= '<ul class="dropdown-menu">';
                foreach ($f as $file_id) {
                    $selected = isset($_GET['i']) && $_GET['i'] === $file_id ? ' active' : '';
                    $tagged .= '<li id="file_' . $file_id . '" data-file="' . $file_id . '" class="file_menup' . $selected . '"><a class="file_menu" href="#" title="';
                    $tagged .= isset($files[$file_id]['included_from']) ? h(sprintf(__('Log file #%s defined in %s'), $file_id, $files[$file_id]['included_from'])) : h(sprintf(__('Log file #%s defined in main configuration file'), $file_id));
                    $tagged .= '">' . $files[$file_id]['display'] . '</a></li>';
                }
                $tagged .= '</ul>';
                $tagged .= '</li>';
            }
        }
开发者ID:expressive-analytics,项目名称:docker-dt-standard.php,代码行数:31,代码来源:index.php

示例12: bloginfo

bloginfo('stylesheet_directory');
?>
/application.css">
  <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
  <script type="text/javascript" src="<?php 
bloginfo('stylesheet_directory');
?>
/theme.js"></script>

  <?php 
wp_head();
?>
</head>

<body <?php 
body_class(get_slug());
?>
>
  <div id="bg-fade"></div>

  <div id="navbar">
    <?php 
wp_nav_menu(array('container_class' => 'menu', 'theme_location' => 'header-menu'));
?>
  </div>

  <header>
    <h1 id="logo">
      <a href="<?php 
echo home_url('/');
?>
开发者ID:amiel,项目名称:bellinghamcircusguild,代码行数:31,代码来源:header.php

示例13: include_partial

    include_partial('documents/welcome', array('sf_cache_key' => $id . '_' . $culture . '_' . $lang, 'title' => $title, 'description' => $abstract, 'default_open' => true));
    include_partial('documents/wizard_button', array('sf_cache_key' => ($is_connected ? 'connected' : 'not_connected') . '_' . $culture));
    if ($has_images && $has_map) {
        $image_url_params = $sf_data->getRaw('image_url_params');
        $image_url_params = implode('&', $image_url_params);
        $custom_title_link = 'images/list';
        $custom_rss_link = 'images/rss';
        if (!empty($image_url_params)) {
            $custom_title_link .= '?' . $image_url_params;
            $custom_rss_link .= '?' . $image_url_params;
        }
        include_partial('images/latest', array('items' => $latest_images, 'culture' => $culture, 'default_open' => true, 'custom_title_link' => $custom_title_link, 'custom_rss_link' => $custom_rss_link, 'home_section' => false));
    }
    include_partial('documents/prepare', array('sf_cache_key' => $culture, 'default_open' => true));
    if ($is_moderator) {
        $tabs = tabs_list_tag($id, $document->getCulture(), $document->isAvailable(), 'view', $is_not_archive ? NULL : $document->getVersion(), get_slug($document), $nb_comments);
        echo $tabs;
    }
    include_partial('portals/nav', array('id' => $id, 'document' => $document));
    echo '<div id="nav_share" class="nav_box">' . button_share() . '</div>';
}
echo display_content_top('home');
echo start_content_tag('portals_content', true);
if ($merged_into = $document->get('redirects_to')) {
    include_partial('documents/merged_warning', array('merged_into' => $merged_into));
}
if (!$is_not_archive) {
    include_partial('documents/versions_browser', array('id' => $id, 'document' => $document, 'metadata' => $metadata, 'current_version' => $current_version));
}
if ($has_map && !$mobile_version) {
    $map_filter = $sf_data->getRaw('map_filter');
开发者ID:snouhaud,项目名称:camptocamp.org,代码行数:31,代码来源:viewSuccess.php

示例14: define

<?php

define('DS', DIRECTORY_SEPARATOR);
define('BASE_DIR', dirname(__FILE__) . DS);
define('SITE_ROOT', '');
require_once BASE_DIR . 'Libs' . DS . 'autoload.php';
require_once BASE_DIR . 'configs' . DS . 'incs.php';
require_once BASE_DIR . 'helpers' . DS . 'incs.php';
//-------------------------------------------------------
Util::$template_path = BASE_DIR . 'templates' . DS;
//-------------------------------------------------------
$notFound = false;
$db = new Db($db_config);
$sql_menus = "SELECT `id`, `menu_title`, `page_title`, `slug` FROM `pages` WHERE `active` = 1 AND `is_menu` = 1 AND `is_home` = 0";
$sql_home = "SELECT `id`, `menu_title`, `page_title`, `slug` FROM `pages` WHERE `active` = 1 AND `is_menu` = 1 AND `is_home` = 1";
$slug = get_slug();
$home = $db->row($sql_home);
if ($slug == "") {
    if (!is_null($home)) {
        $slug = $home['slug'];
    } else {
        $notFound = true;
    }
}
$sql_page = sprintf("SELECT * FROM `pages` WHERE `slug` = '%s'", $db->escString($slug));
$page = $db->row($sql_page);
if (is_null($page)) {
    $notFound = true;
}
//-------------------------------------------------------
if ($notFound) {
开发者ID:rajuthapa8086,项目名称:cms,代码行数:31,代码来源:index.php

示例15: defineLookupOrder


//.........这里部分代码省略.........
         // taxonomy-[taxonomy]-[term-slug]
         // taxonomy-[taxonomy]
         // taxonomy-[post-type]
         // taxonomy
         // archive-[post-type]
         // [post-type]
         // archive
         $term = get_queried_object();
         if (!empty($term->slug)) {
             $result[] = 'taxonomy-' . $term->taxonomy . '-' . $term->slug;
             $result[] = 'taxonomy-' . $term->taxonomy;
         }
         if ($query_post_type) {
             $result[] = 'taxonomy-' . $query_post_type;
         }
         $result[] = 'taxonomy';
         if ($query_post_type) {
             $result[] = 'archive-' . $query_post_type;
             $result[] = $query_post_type;
         }
         $result[] = 'archive';
     } elseif ($wp_query->is_date()) {
         // date-[post-type]
         // date
         // archive-[post-type]
         // [post-type]
         // archive
         if ($query_post_type) {
             $result[] = 'date-' . $query_post_type;
         }
         $result[] = 'date';
         if ($query_post_type) {
             $result[] = 'archive-' . $query_post_type;
             $result[] = $query_post_type;
         }
         $result[] = 'archive';
     } elseif ($wp_query->is_archive()) {
         // archive-[post-type]
         // [post-type]
         // archive
         if ($query_post_type) {
             $result[] = 'archive-' . $query_post_type;
             $result[] = $query_post_type;
         }
         $result[] = 'archive';
     } elseif ($wp_query->is_page()) {
         // page-[parent-slug]-[post-slug]
         // page-[post-slug]
         // [page-template-name]
         // page
         // singular
         if ($post->post_parent) {
             if ($parent_slug = get_slug($post->post_parent)) {
                 $result[] = 'page-' . $parent_slug . '-' . $post_slug;
             }
         }
         $result[] = 'page-' . $post_slug;
         // page templates can have their unique names, let's add them before the fallback
         if ($page_template_name = get_page_template_name($post->ID)) {
             $result[] = $page_template_name;
         }
         $result[] = 'page';
         $result[] = 'singular';
     } elseif ($wp_query->is_attachment()) {
         // single-attachment-[slugfied-long-mime-type]
         // single-attachment-[slugfied-short-mime-type]
         // single-attachment
         // attachment
         // single
         // singular
         // slugfied-long-mime-type = image-jpeg
         // slugfied-short-mime-type = jpeg
         if (!empty($post->post_mime_type)) {
             $result[] = 'single-attachment-' . \Bond\to_slug($post->post_mime_type);
             $mime = explode('/', $post->post_mime_type);
             if (count($mime) > 1) {
                 $result[] = 'single-attachment-' . \Bond\to_slug($mime[1]);
             }
             $result[] = 'single-attachment-' . $mime[0];
         }
         $result[] = 'single-attachment';
         $result[] = 'attachment';
         $result[] = 'single';
         $result[] = 'singular';
     } elseif ($wp_query->is_single()) {
         // single-[post-type]-[post-slug]
         // single-[post-type]
         // [post-type]
         // single
         // singular
         $result[] = 'single-' . $post_type . '-' . $post_slug;
         $result[] = 'single-' . $post_type;
         $result[] = $post_type;
         $result[] = 'single';
         $result[] = 'singular';
     }
     // everything is handled, allow a filter and go
     $result = apply_filters($this->hooks_prefix . '/lookup_order', $result);
     return $result;
 }
开发者ID:andrefelipe,项目名称:bond,代码行数:101,代码来源:Bond.php


注:本文中的get_slug函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。