本文整理汇总了PHP中get_post_type函数的典型用法代码示例。如果您正苦于以下问题:PHP get_post_type函数的具体用法?PHP get_post_type怎么用?PHP get_post_type使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_post_type函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: enqueueScripts
/**
* Enqueue admin scripts & styles
*/
function enqueueScripts()
{
if (get_post_type() == 'wpdmpro' || in_array(wpdm_query_var('page'), array('settings', 'emails', 'wpdm-stats', 'templates', 'importable-files', 'wpdm-addons', 'orders', 'pp-license'))) {
wp_enqueue_script('jquery');
wp_enqueue_script('jquery-form');
wp_enqueue_script('jquery-ui-core');
wp_enqueue_script('jquery-ui-tabs');
wp_enqueue_script('jquery-ui-datepicker');
wp_enqueue_script('jquery-ui-slider');
wp_enqueue_script('jquery-ui-sortable');
wp_enqueue_script('jquery-ui-timepicker', WPDM_BASE_URL . 'assets/js/jquery-ui-timepicker-addon.js', array('jquery', 'jquery-ui-core', 'jquery-ui-datepicker', 'jquery-ui-slider'));
wp_enqueue_style('icons', plugins_url() . '/download-manager/assets/css/icons.css');
wp_enqueue_script('thickbox');
wp_enqueue_style('thickbox');
wp_enqueue_script('media-upload');
wp_enqueue_media();
wp_enqueue_script('jquery-choosen', plugins_url('/download-manager/assets/js/chosen.jquery.min.js'), array('jquery'));
wp_enqueue_style('choosen-css', plugins_url('/download-manager/assets/css/chosen.css'));
wp_enqueue_style('jqui-css', plugins_url('/download-manager/assets/jqui/theme/jquery-ui.css'));
wp_enqueue_script('wpdm-bootstrap', plugins_url('/download-manager/assets/bootstrap/js/bootstrap.min.js'), array('jquery'));
wp_enqueue_script('wpdm-admin', plugins_url('/download-manager/assets/js/wpdm-admin.js'), array('jquery'));
wp_enqueue_style('font-awesome', WPDM_BASE_URL . 'assets/font-awesome/css/font-awesome.min.css');
wp_enqueue_style('wpdm-bootstrap', plugins_url('/download-manager/assets/bootstrap/css/bootstrap.css'));
wp_enqueue_style('wpdm-bootstrap-theme', plugins_url('/download-manager/assets/bootstrap/css/bootstrap-theme.min.css'));
wp_enqueue_style('wpdm-admin-styles', plugins_url('/download-manager/assets/css/admin-styles.css'));
}
}
开发者ID:wilxsv,项目名称:prevensionPublicLibrary,代码行数:30,代码来源:class.WordPressDownloadManagerAdmin.php
示例2: wa_meta_delete_post
function wa_meta_delete_post($post_id)
{
if (get_post_type($post_id) == 'shop_order') {
global $wpdb;
$wpdb->query($wpdb->prepare("\n\t\t\t\t\tDELETE FROM " . $wpdb->prefix . "wa_product_orders\n\t\t\t\t\tWHERE order_id = %d\n\t\t\t\t", $post_id));
}
}
开发者ID:lenguyenitc,项目名称:donations,代码行数:7,代码来源:class-wa-table-orders.php
示例3: the_quiz_button
function the_quiz_button($button, $quiz_id)
{
global $post;
$quiz_id = get_the_ID();
$user_id = get_current_user_id();
$flag = 1;
if (in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins')))) {
$pid = get_post_meta($quiz_id, 'vibe_quiz_product', true);
if (isset($pid) && is_numeric($pid) && get_post_type($pid) == 'product') {
$product_taken = wc_customer_bought_product('', $user_id, $pid);
if (!$product_taken) {
$pid = get_permalink($pid);
$check = vibe_get_option('direct_checkout');
$check = intval($check);
if (isset($check) && $check) {
$pid .= '?redirect';
}
$flag = 0;
$html = '<a href="' . $pid . '"class="button create-group-button full"> ' . __('Take this Quiz', 'vibe') . '</a>';
} else {
$flag = 1;
}
}
}
if (in_array('paid-memberships-pro/paid-memberships-pro.php', apply_filters('active_plugins', get_option('active_plugins'))) && is_user_logged_in()) {
$membership_ids = vibe_sanitize(get_post_meta($quiz_id, 'vibe_quiz_membership', false));
if (!pmpro_hasMembershipLevel($membership_ids, $user_id) && isset($membership_ids) && count($membership_ids) >= 1) {
$membership_taken = get_user_meta($user_id, $quiz_id, true);
if (!$membership_taken) {
$pmpro_levels_page_id = get_option('pmpro_levels_page_id');
$link = get_permalink($pmpro_levels_page_id);
$html = '<a href="' . $link . '"class="button create-group-button full"> ' . __('Take this Quiz', 'vibe') . '</a>';
$flag = 0;
} else {
$flag = 1;
}
}
}
if (in_array('wplms-mycred-addon/wplms-mycred-addon.php', apply_filters('active_plugins', get_option('active_plugins')))) {
$points = get_post_meta($quiz_id, 'vibe_quiz_mycred_points', true);
$mycred = mycred();
$balance = $mycred->get_users_cred($user_id);
if ($balance < $points) {
$flag = 0;
$html = '<a href="#"class="button create-group-button full"> ' . __('Take this Quiz', 'vibe') . '<span>' . __('<br/>Not enough points.', 'vibe') . '</span></a>';
}
if (!$mycred->has_entry('purchase_quiz', $quiz_id, $user_id)) {
$flag = 1;
$deduct = -1 * $points;
$mycred->update_users_balance($user_id, $deduct);
$mycred->add_to_log('purchase_quiz', $user_id, $deduct, __('Student subscibed to quiz', 'wplms-mycred'), $quiz_id);
} else {
$flag = 1;
}
}
if (!$flag) {
return $html;
}
return $button;
}
开发者ID:VibeThemes,项目名称:wplms_sell_quiz,代码行数:60,代码来源:sell_quiz.php
示例4: widget
function widget($args, $instance)
{
global $yarpp;
if (!is_singular()) {
return;
}
extract($args);
// compatibility with pre-3.5 settings:
if (isset($instance['use_template'])) {
$instance['template'] = $instance['use_template'] ? $instance['template_file'] : false;
}
if ($yarpp->get_option('cross_relate')) {
$instance['post_type'] = $yarpp->get_post_types();
} else {
if ('page' == get_post_type()) {
$instance['post_type'] = array('page');
} else {
$instance['post_type'] = array('post');
}
}
$title = apply_filters('widget_title', $instance['title']);
echo $before_widget;
if (!$instance['template']) {
echo $before_title;
echo $title;
echo $after_title;
}
$instance['domain'] = 'widget';
$yarpp->display_related(null, $instance, true);
echo $after_widget;
}
开发者ID:ni-hao,项目名称:myhomework,代码行数:31,代码来源:class-widget.php
示例5: vw_render_categories
function vw_render_categories($classes = '')
{
$categories = get_the_category();
$html = '';
if (is_sticky()) {
$html .= '<div class="label label-sticky ' . $classes . '" title="' . __('Sticky Post', 'envirra') . '"><i class="icon-entypo-megaphone"></i></div>';
}
if ('post' == get_post_type()) {
if ('1' == get_post_meta(get_the_id(), 'vw_enable_review', true)) {
$avg_score = get_post_meta(get_the_id(), 'vw_review_average_score', true);
$html .= '<div class="label label-review ' . $classes . '" title="' . __('Classificação', 'envirra') . '"><i class="icon-entypo-star"></i> ' . $avg_score . '</div>';
} else {
// Show post format if not a review
if ('gallery' == get_post_format()) {
$html .= '<div class="label label-light ' . $classes . '" title="' . __('Gallery Post', 'envirra') . '"><i class="icon-entypo-picture"></i></div>';
} else {
if ('video' == get_post_format()) {
$html .= '<div class="label label-light ' . $classes . '" title="' . __('Video Post', 'envirra') . '"><i class="icon-entypo-play"></i></div>';
} else {
if ('audio' == get_post_format()) {
$html .= '<div class="label label-light ' . $classes . '" title="' . __('Audio Post', 'envirra') . '"><i class="icon-entypo-note-beamed"></i></div>';
}
}
}
}
}
if ($categories) {
foreach ($categories as $category) {
$html .= '<a class="label ' . $classes . '" href="' . get_category_link($category->term_id) . '" title="' . esc_attr(sprintf(__("Ver Artigos na Categoria %s", 'envirra'), $category->name)) . '" rel="category">' . $category->cat_name . '</a>';
}
}
echo $html;
}
开发者ID:JJProductionsPT,项目名称:SdTVv2,代码行数:33,代码来源:template-tags.php
示例6: woocommerce_order_get_items
function woocommerce_order_get_items($items)
{
if (isset($_GET['post']) && get_post_type($_GET['post']) == 'shop_order') {
global $sitepress_settings;
foreach ($items as $index => $item) {
foreach ($item as $key => $item_data) {
if ($key == 'product_id') {
$tr_product_id = apply_filters('translate_object_id', $item_data, 'product', false, $sitepress_settings['admin_default_language']);
if (!is_null($tr_product_id)) {
$items[$index][$key] = $tr_product_id;
$items[$index]['name'] = get_the_title($tr_product_id);
}
}
if ($key == 'variation_id') {
$tr_variation_id = apply_filters('translate_object_id', $item_data, 'product_variation', false, $sitepress_settings['admin_default_language']);
if (!is_null($tr_variation_id)) {
$items[$index][$key] = $tr_variation_id;
}
}
if (substr($key, 0, 3) == 'pa_') {
global $wpdb, $woocommerce_wpml;
//attr is taxonomy
$term_id = $woocommerce_wpml->products->wcml_get_term_id_by_slug($key, $item_data);
$tr_id = apply_filters('translate_object_id', $term_id, $key, false, $sitepress_settings['admin_default_language']);
if (!is_null($tr_id)) {
$translated_slug = $wpdb->get_var($wpdb->prepare("\r\n SELECT t.slug FROM {$wpdb->terms} t JOIN {$wpdb->term_taxonomy} x ON x.term_id = t.term_id WHERE t.term_id = %d AND x.taxonomy = %s", $tr_id, $key));
$items[$index][$key] = $translated_slug;
}
}
}
}
}
return $items;
}
开发者ID:mahirziyaokan,项目名称:woocommerce-multilingual,代码行数:34,代码来源:orders.class.php
示例7: load_main_scripts
function load_main_scripts()
{
wp_register_script('scripts', get_template_directory_uri() . '/assets/js/scripts.js', array('jquery'), filemtime(get_template_directory() . '/assets/js/scripts.js'), true);
// Loads in the footer with cache busting
wp_register_script('collapsible', get_template_directory_uri() . '/assets/js/jquery.collapsible.min.js', array('jquery'), 1.0, true);
wp_register_script('modernizer', get_template_directory_uri() . '/assets/js/modernizr-2.6.1-respond-1.1.0.min.js');
wp_register_script('magnific', get_template_directory_uri() . '/assets/js/jquery.magnific.min.js', array('jquery'));
wp_register_script('select', get_template_directory_uri() . '/assets/js/bootstrap-select.min.js', array('jquery'));
wp_register_script('dropdown', get_template_directory_uri() . '/assets/js/bootstrap-dropdown.js', array('jquery'), 1.0, true);
wp_register_script('fitvids', get_template_directory_uri() . '/assets/js/jquery.fitvids.js', array('jquery'), 1.0, true);
wp_register_script('tabaccord', get_template_directory_uri() . '/assets/js/easyResponsiveTabs.js', array('jquery'), 1.0, true);
//wp_register_script( 'placeholders', get_template_directory_uri() . '/assets/js/Placeholders.js', array( 'jquery' ), 1.0, true );
//wp_register_script( 'glossary', get_template_directory_uri() . '/assets/js/jquery.zglossary.min.js', array( 'jquery' ), 1.0, true );
wp_enqueue_script('modernizer');
wp_enqueue_script('scripts');
wp_enqueue_script('select');
wp_enqueue_script('dropdown');
wp_enqueue_script('magnific');
wp_enqueue_script('fitvids');
//wp_enqueue_script( 'placeholders' );
wp_enqueue_script('tabaccord');
if (is_page() or get_post_type() == 'state' or get_post_type() == 'faq') {
wp_enqueue_script('collapsible');
}
if (!is_front_page() or !is_post_type_archive('glossary')) {
wp_enqueue_script('glossary');
}
if (is_page_template('page-templates/template-video-gallery.php')) {
// load only on video gallery
wp_enqueue_script('lazyYT', get_template_directory_uri() . '/assets/js/lazyYT.js', array('jquery'), 1.0, true);
// lazy load youtube
}
}
开发者ID:61pixels,项目名称:incnow,代码行数:33,代码来源:functions.php
示例8: sync_post_module_custom_data
function sync_post_module_custom_data($custom_data, $post)
{
if (post_type_supports(get_post_type($post), 'publicize')) {
$custom_data['cpt_publicizeable'] = true;
}
return $custom_data;
}
开发者ID:moushegh,项目名称:blog-source-configs,代码行数:7,代码来源:publicize.php
示例9: ushipnetwork_entry_footer
/**
* Prints HTML with meta information for the categories, tags and comments.
*/
function ushipnetwork_entry_footer()
{
// Hide category and tag text for pages.
if ('post' === get_post_type()) {
$byline = sprintf(esc_html_x('by %s', 'post author', 'ushipnetwork'), '<span class="author vcard"><a class="url fn n" href="' . esc_url(get_author_posts_url(get_the_author_meta('ID'))) . '">' . esc_html(get_the_author()) . '</a></span>');
echo '<div class="byline">' . '<div class="authorship">' . $byline . '</div>' . '<div class="share">';
include "share.php";
echo '</div>' . '</div>';
$posttags = get_the_tags();
$count = 0;
$separator = ', ';
$output = '';
if (!empty($posttags)) {
echo '<span class="tag-list">tags: ';
foreach ($posttags as $posttag) {
$count++;
if ($count <= 2) {
$output .= '<a href="' . esc_url(get_tag_link($posttag->term_id)) . '" alt="' . esc_attr(sprintf(__('View all posts in %s', 'textdomain'), $posttag->name)) . '">' . esc_html($posttag->name) . '</a>' . $separator;
}
}
echo trim($output, $separator);
}
echo '</span>';
}
edit_post_link(sprintf(esc_html__('Edit %s', 'ushipnetwork'), the_title('<span class="screen-reader-text">"', '"</span>', false)), '<span class="edit-link">', '</span>');
}
开发者ID:rmikeska,项目名称:ushipnetwork,代码行数:29,代码来源:template-tags.php
示例10: trashHook
/**
* Trash hook - make sure child pages of trashed page are visible
*/
public function trashHook($post_id)
{
$post_type = get_post_type($post_id);
if ($post_type == 'page') {
$this->resetToggles($post_id);
}
}
开发者ID:erkmen,项目名称:wpstartersetup,代码行数:10,代码来源:class-np-posttypes.php
示例11: title_publication_input
/**
* @link http://www.ukm.my/template
*
* @package WordPress
* @subpackage ukmtheme
* @since 4.0
*
* @author Jamaludin Rajalu
*
* Custom Post Type: Publication
*/
function title_publication_input($title)
{
if (get_post_type() == 'publication') {
$title = __('Enter publication name here', 'ukmtheme');
}
return $title;
}
开发者ID:RobbiNespu,项目名称:ukmtheme,代码行数:18,代码来源:post-type-publication.php
示例12: appletree_post_meta
/**
* Displays meta information for a post
* @return void
*/
function appletree_post_meta()
{
if (get_post_type() == 'post') {
echo sprintf(__('Posted %s in %s%s by %s. ', 'appletreesg.com'), get_the_time(get_option('date_format')), get_the_category_list(', '), get_the_tag_list(__(', <b>Tags</b>: ', 'appletreesg.com'), ', '), get_the_author_link());
}
edit_post_link(__(' (edit)', 'appletreesg.com'), '<span class="edit-link">', '</span>');
}
开发者ID:scarecrow2003,项目名称:appletree,代码行数:11,代码来源:functions.php
示例13: kkthemes_archive_title
function kkthemes_archive_title()
{
$tag_style = '';
$header_image = get_header_image();
if (!empty($header_image)) {
$tag_style = 'background-image: url(' . esc_url($header_image) . ');';
}
?>
<div class="uk-panel uk-panel-box uk-panel-space uk-text-large uk-text-center tm-branded-panel uk-margin-large-bottom" style="<?php
echo $tag_style;
?>
">
<h1 class="uk-article-title" itemprop="headline">
<?php
single_cat_title('') || post_type_archive_title('');
?>
</h1>
<?php
if (is_featured_item()) {
$post_type = get_post_type();
echo '<p>' . get_post_type_object($post_type)->description . '</p>';
} else {
echo category_description();
}
?>
</div>
<?php
}
开发者ID:kkthemes,项目名称:kkthemes,代码行数:28,代码来源:index.php
示例14: basey_content_after_output
/**
* After content
* @return void
*/
function basey_content_after_output()
{
?>
</div>
<?php
if (get_post_type(get_the_ID()) == 'post') {
?>
<div class="uk-width-medium-3-10">
<div class="uk-panel uk-panel-box">
<?php
dynamic_sidebar('basey-sidebar');
?>
</div>
</div>
<?php
}
?>
</div>
</div>
</section>
<div id="offcanvas-menu" class="uk-offcanvas">
<div class="uk-offcanvas-bar uk-offcanvas-bar-flip">
<?php
wp_nav_menu(array('menu' => 'primary', 'theme_location' => 'primary', 'depth' => 2, 'container' => '', 'menu_class' => 'uk-nav uk-nav-offcanvas uk-nav-parent-icon', 'items_wrap' => '<ul id="%1$s" class="%2$s" data-uk-nav>%3$s</ul>', 'fallback_cb' => 'basey_offcanvas_menu::fallback', 'walker' => new basey_offcanvas_menu()));
?>
</div>
</div>
<?php
}
开发者ID:kokokokokokoko,项目名称:basey-theme,代码行数:34,代码来源:output.php
示例15: nav_menu_add_classes2
function nav_menu_add_classes2($items, $args)
{
//print_r($items);
global $post;
$i = 0;
$j = false;
$a = false;
foreach ($items as $item) {
$i++;
if (is_single() && get_post_type() == 'interesting-fact') {
//get parent page ID by checking which page uses interesting fatcs page template
$pages = get_pages(array('meta_key' => '_wp_page_template', 'meta_value' => 'page-templates/interesting_facts.php', 'lang' => pll_current_language('slug')));
$parent_page_id = $pages[0]->ID;
if ($item->object_id == $parent_page_id) {
// $item->classes[] = 'current_page_parent';
$item->classes[] = 'current_menu_item';
$j = $i - 1;
$a = $item->ID;
}
}
}
if ($j) {
// $items[$j]->classes[] = 'current_page_parent';
$items[1]->classes[] = 'current_page_ancestor';
}
if ($a) {
echo $a;
}
return $items;
}
开发者ID:uoyknaht,项目名称:kc,代码行数:30,代码来源:not_used_functions.php
示例16: wpbo_get_popup
/**
* Get the active popup for a given post, if any
*
* @since 2.0
*
* @param int $post_id Post ID
*
* @return bool|int
*/
function wpbo_get_popup($post_id = 0)
{
$post_id = wpbo_get_post_id($post_id);
$popup_id = false;
if (!$post_id) {
return false;
}
// Get the global popups / posts relationships
$relationships = get_option('wpbo_popup_relationships', array());
// Get current post type
$post_type = get_post_type($post_id);
/**
* If this post ID is found in the relationships then it means it has a popup attached.
*/
if (is_array($relationships) && array_key_exists($post_id, $relationships) && 'publish' == get_post_status($relationships[$post_id])) {
return (int) $relationships[$post_id];
} else {
// Check if there is a popup for the current post type first of all
$popup_id = wpbo_get_post_type_popup($post_type);
if (false === $popup_id) {
$popup_id = wpbo_get_sitewide_popup();
}
}
return $popup_id;
}
开发者ID:simfatic,项目名称:BetterOptin,代码行数:34,代码来源:functions-popup.php
示例17: remove_view_row_action
function remove_view_row_action($actions)
{
if (get_post_type() === 'bs_slide') {
unset($actions['view']);
}
return $actions;
}
开发者ID:ArgiaCyber,项目名称:alfath,代码行数:7,代码来源:class-alfath-slide.php
示例18: update_sale_price
function update_sale_price($post_id)
{
if (get_post_type($post_id) == $this->post_type) {
$price = STRental::get_price($post_id);
update_post_meta($post_id, 'sale_price', $price);
}
}
开发者ID:HatchForce,项目名称:bachtraveller,代码行数:7,代码来源:class.cruise.php
示例19: the_content
function the_content($content)
{
// Don't show on custom page templates
if (is_page_template()) {
return $content;
}
// Don't show on Stacked slides
if (get_post_type() == 'slide') {
return $content;
}
global $wp_current_filter;
if (in_array('get_the_excerpt', (array) $wp_current_filter)) {
return $content;
}
$cce_options = get_option('cce_options');
$show_on_posts = isset($cce_options['show_loveit_button_on']['post']) ? $cce_options['show_loveit_button_on']['post'] : FALSE;
$show_on_pages = isset($cce_options['show_loveit_button_on']['page']) ? $cce_options['show_loveit_button_on']['page'] : FALSE;
if (is_singular('post') && $show_on_posts) {
$content .= $this->do_likes('loveit-after-content');
}
if (is_page() && !is_front_page() && $show_on_pages) {
$content .= $this->do_likes('loveit-after-content');
}
//Under consideration: if(( is_front_page() || is_home() || is_category() || is_tag() || is_author() || is_date() || is_search()) && $options['add_to_other'] ) $content .= $this->do_likes();
return $content;
}
开发者ID:codecookies,项目名称:cc-essentials,代码行数:26,代码来源:cce-loveit.php
示例20: lp_preview_iframe
function lp_preview_iframe()
{
$lp_variation = isset($_GET['lp-variation-id']) ? $_GET['lp-variation-id'] : '0';
$postid = $_GET['post_id'];
$variations = get_post_meta($postid, 'lp-ab-variations', true);
$variations_array = explode(",", $variations);
$post_type_is = get_post_type($postid);
?>
<link rel="stylesheet" href="<?php
echo LANDINGPAGES_URLPATH . 'css/customizer-ab-testing.css';
?>
" />
<style type="text/css">
#variation-list {
position: absolute;
top: 0px;
left:0px;
padding-left: 5px;
}
#variation-list h3 {
text-decoration: none;
border-bottom: none;
}
#variation-list div {
display: inline-block;
}
#current_variation_id, #current-post-id {
display: none !important;
}
<?php
if ($post_type_is !== "landing-page") {
echo "#variation-list {display:none !important;}";
}
开发者ID:jyotiprava,项目名称:45serverbackup,代码行数:33,代码来源:module.customizer.php
注:本文中的get_post_type函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论