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


PHP ThemexCore::getPostRelations方法代码示例

本文整理汇总了PHP中ThemexCore::getPostRelations方法的典型用法代码示例。如果您正苦于以下问题:PHP ThemexCore::getPostRelations方法的具体用法?PHP ThemexCore::getPostRelations怎么用?PHP ThemexCore::getPostRelations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ThemexCore的用法示例。


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

示例1: getAnswerStatistics

 /**
  * Gets answer statistics
  *
  * @access public
  * @param int $ID
  * @param int $user
  * @return array
  */
 public static function getAnswerStatistics($ID, $user)
 {
     $answers = array();
     $quiz = ThemexCore::getPostRelations(0, $ID, 'quiz_lesson', true);
     if (!empty($quiz)) {
         $relations = explode(' ; ', ThemexCore::getUserRelations($user, $quiz, 'answers', true) . ' ');
         foreach ($relations as $relation) {
             $answer = array();
             $relation = explode(' , ', $relation);
             if (count($relation) == 3) {
                 $answer['question'] = themex_value($relation, 0);
                 $answer['answer'] = themex_value($relation, 1);
                 $answer['result'] = themex_value($relation, 2);
                 $answers[] = $answer;
             }
         }
     }
     return $answers;
 }
开发者ID:rinodung,项目名称:wordpress-demo,代码行数:27,代码来源:themex.course.php

示例2: renderPageTitle

 /**
  * Renders page title
  *
  * @access public
  * @return void
  */
 public static function renderPageTitle()
 {
     global $post;
     $type = get_post_type();
     $out = wp_title('', false);
     if (is_single()) {
         if ($type == 'post') {
             $categories = wp_get_post_terms($post->ID, 'category');
             if (!empty($categories)) {
                 $out = $categories[0]->name;
             }
         } else {
             if (in_array($type, array('lesson', 'quiz'))) {
                 if ($type == 'lesson') {
                     $out = __('Lesson', 'academy');
                     $lesson = $post->ID;
                 } else {
                     $out = __('Quiz', 'academy');
                     $lesson = ThemexCore::getPostRelations($post->ID, 0, 'quiz_lesson', true);
                 }
                 $course = ThemexCore::getPostRelations($lesson, 0, 'lesson_course', true);
                 if ($course != 0) {
                     $out = get_the_title($course);
                 }
             } else {
                 $types = get_post_types(null, 'objects');
                 $out = $types[$type]->labels->name;
             }
         }
     } else {
         if (is_tax()) {
             $out = single_term_title('', false);
         } else {
             if (get_query_var('author')) {
                 if (get_query_var('author') == get_current_user_id()) {
                     $out = __('My Profile', 'academy');
                 } else {
                     $out = __('Profile', 'academy');
                 }
             }
         }
     }
     if (empty($out)) {
         $out = __('Archives', 'academy');
     }
     echo $out;
 }
开发者ID:rinodung,项目名称:wordpress-demo,代码行数:53,代码来源:themex.interface.php

示例3: getRelatedPost

 /**
  * Gets related post
  *
  * @access public
  * @param int $ID
  * @param mixed $type
  * @param bool $single
  * @return array
  */
 public static function getRelatedPost($ID, $type, $single = false)
 {
     $order = new WC_Order($ID);
     $products = $order->get_items();
     if (!empty($products)) {
         $ID = wp_list_pluck($products, 'product_id');
     }
     $relations = array_merge(array(0), ThemexCore::getPostRelations(0, $ID, $type));
     $posts = get_posts(array('numberposts' => -1, 'post_type' => array('course', 'plan'), 'post__in' => $relations));
     if (!empty($posts)) {
         if ($order->user_id) {
             foreach ($posts as &$post) {
                 $post->post_author = $order->user_id;
             }
         }
         if ($single) {
             $posts = reset($posts);
         }
     }
     return $posts;
 }
开发者ID:haythameyd,项目名称:powrly,代码行数:30,代码来源:themex.woo.php

示例4: filterLessonColumns

 /**
  * Filters lesson columns
  *
  * @access public
  * @param mixed $query
  * @return mixed
  */
 public static function filterLessonColumns($query)
 {
     global $pagenow;
     if (is_admin() && $pagenow == 'edit.php' && isset($_GET['lesson_course'])) {
         $lessons = ThemexCore::getPostRelations(0, intval($_GET['lesson_course']), 'lesson_course');
         if (!empty($lessons)) {
             $query->set('post__in', $lessons);
         }
     }
     return $query;
 }
开发者ID:rinodung,项目名称:wordpress-demo,代码行数:18,代码来源:themex.lesson.php

示例5: get_header

<?php

get_header();
the_post();
ThemexLesson::refresh(ThemexCore::getPostRelations($post->ID, 0, 'quiz_lesson', true), true);
ThemexCourse::refresh(ThemexLesson::$data['course'], true);
$layout = ThemexCore::getOption('lessons_layout', 'right');
if ($layout == 'left') {
    ?>
<aside class="sidebar column fourcol">
	<?php 
    get_sidebar('lesson');
    ?>
</aside>
<div class="column eightcol last">
<?php 
} else {
    ?>
<div class="eightcol column">
<?php 
}
?>
	<h1><?php 
the_title();
?>
</h1>
	<?php 
the_content();
?>
	<div class="quiz-listing">
		<form id="quiz_form" action="<?php 
开发者ID:rinodung,项目名称:wordpress-demo,代码行数:31,代码来源:single-quiz.php

示例6: renderBackground

 /**
  * Renders background
  *
  * @access public
  * @return void
  */
 public static function renderBackground()
 {
     global $post;
     $out = '';
     if (ThemexCore::getOption('background_type', 'fullwidth') != 'tiled') {
         $background = ThemexCore::getOption('background_image', THEME_URI . 'images/bgs/site_bg.jpg');
         if (is_page()) {
             $background = ThemexCore::getPostMeta($post->ID, 'page_background', $background);
         } else {
             if (is_singular('course')) {
                 $background = ThemexCore::getPostMeta($post->ID, 'course_background', $background);
             } else {
                 if (is_singular('lesson')) {
                     $course = ThemexCore::getPostRelations($post->ID, 0, 'lesson_course', true);
                     if ($course != 0) {
                         $background = ThemexCore::getPostMeta($course, 'course_background', $background);
                     }
                 }
             }
         }
         $out = '<img src="' . $background . '" class="fullwidth" alt="" />';
     }
     echo $out;
 }
开发者ID:haythameyd,项目名称:powrly,代码行数:30,代码来源:themex.style.php


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