本文整理汇总了PHP中get_portfolio_page_link函数的典型用法代码示例。如果您正苦于以下问题:PHP get_portfolio_page_link函数的具体用法?PHP get_portfolio_page_link怎么用?PHP get_portfolio_page_link使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_portfolio_page_link函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: thb_breadcrumb
function thb_breadcrumb()
{
global $post, $wp_query;
$id = $wp_query->get_queried_object_id();
echo '<aside class="breadcrumb">';
if (!is_front_page()) {
echo '<a href="';
echo home_url();
echo '">' . __('Home', THB_THEME_NAME);
echo "</a>";
}
if (is_singular('portfolio')) {
$portfolio_main = get_post_meta($post->ID, 'portfolio_main', TRUE);
if ($portfolio_main) {
$portfolio_link = get_permalink($portfolio_main);
} else {
$portfolio_link = get_portfolio_page_link(get_the_ID());
}
echo '<span>/</span> <a href="' . $portfolio_link . '">' . __('Portfolio', THB_THEME_NAME) . '</a>';
echo '<span>/</span>' . get_the_title();
}
if (is_home()) {
echo '<span>/</span>' . __('Blog', THB_THEME_NAME);
}
if (is_page() && !is_front_page()) {
$parents = array();
$parent_id = $post->post_parent;
while ($parent_id) {
$page = get_page($parent_id);
$parents[] = '<span>/</span><a href="' . get_permalink($page->ID) . '" title="' . get_the_title($page->ID) . '">' . get_the_title($page->ID) . '</a>';
$parent_id = $page->post_parent;
}
$parents = array_reverse($parents);
echo join(' ', $parents);
echo '<span>/</span>' . get_the_title();
}
if (is_single() && !is_singular('portfolio')) {
$categories = get_the_category();
if ($categories) {
foreach ($categories as $cat) {
$cats[] = '<a href="' . get_category_link($cat->term_id) . '" title="' . $cat->name . '">' . $cat->name . '</a>';
}
echo '<span>/</span>' . join(', ', $cats);
}
echo '<span>/</span>' . ShortenText(get_the_title(), 40);
}
if (is_archive()) {
if (class_exists('woocommerce') && is_woocommerce() && is_shop()) {
echo '<span>/</span>' . get_the_title(wc_get_page_id('shop'));
} else {
echo '<span>/</span>' . thb_which_archive();
}
}
if (is_search()) {
echo '<span>/</span>' . thb_which_archive();
}
echo '</aside>';
}
示例2: while
while (have_posts()) {
the_post();
?>
<?php
$layout = get_post_meta($post->ID, 'portfolio_layout', true);
$format = get_post_meta($post->ID, 'portfolio_type', true);
$portfolio_main = get_post_meta($post->ID, 'portfolio_main', TRUE);
$meta = get_the_term_list($post->ID, 'project-category', '<span>', '</span>, <span>', '</span>');
$meta = preg_replace('/<a href=\\"(.*?)\\">(.*?)<\\/a>/', "\\2", $meta);
$attributes = get_post_meta($post->ID, 'portfolio_attributes', TRUE);
?>
<?php
if ($portfolio_main) {
$portfolio_link = get_permalink($portfolio_main);
} else {
$portfolio_link = get_portfolio_page_link(get_the_ID());
}
?>
<?php
if ($layout == 'layout2') {
?>
<article <?php
post_class('post blog-post portfolio-post');
?>
id="post-<?php
the_ID();
?>
">
<div class="row">
<div class="small-12 medium-7 columns">
<?php
示例3: nectar_page_header
//.........这里部分代码省略.........
$project_cat = strtolower($term->name);
}
$page = get_page_by_title_search($project_cat);
if (empty($page)) {
$page = array('0' => (object) array('ID' => 'nothing'));
}
$page_link = verify_portfolio_page($page[0]->ID);
//if a page has been found for the category
if (!empty($page_link) && $back_to_all_override == 'default') {
$portfolio_link = $page_link;
?>
<div id="portfolio-nav">
<ul>
<li id="all-items"><a href="<?php
echo $portfolio_link;
?>
"><i class="icon-salient-back-to-all"></i></a></li>
</ul>
<ul class="controls">
<li id="prev-link"><?php
be_next_post_link('%link', '<i class="icon-salient-left-arrow-thin"></i>', TRUE, null, 'project-type');
?>
</li>
<li id="next-link"><?php
be_previous_post_link('%link', '<i class="icon-salient-right-arrow-thin"></i>', TRUE, null, 'project-type');
?>
</li>
</ul>
</div>
<?php
} else {
$portfolio_link = get_portfolio_page_link(get_the_ID());
if (!empty($options['main-portfolio-link'])) {
$portfolio_link = $options['main-portfolio-link'];
}
if ($back_to_all_override != 'default') {
$portfolio_link = get_page_link($back_to_all_override);
}
?>
<div id="portfolio-nav">
<ul>
<li id="all-items"><a href="<?php
echo $portfolio_link;
?>
"><i class="icon-salient-back-to-all"></i></a></li>
</ul>
<ul class="controls">
<?php
if (!empty($options['portfolio_same_category_single_nav']) && $options['portfolio_same_category_single_nav'] == '1') {
// get_posts in same custom taxonomy
$terms = get_the_terms($post->id, "project-type");
$project_cat = null;
if (empty($terms)) {
$terms = array('1' => (object) array('name' => 'nothing', 'slug' => 'none'));
}
foreach ($terms as $term) {
$project_cat = strtolower($term->slug);
}
$postlist_args = array('posts_per_page' => -1, 'orderby' => 'menu_order title', 'order' => 'ASC', 'post_type' => 'portfolio', 'project-type' => $project_cat);
$postlist = get_posts($postlist_args);
// get ids of posts retrieved from get_posts
$ids = array();
foreach ($postlist as $thepost) {
示例4: project_single_controls
function project_single_controls()
{
global $options;
global $post;
$back_to_all_override = get_post_meta($post->ID, 'nectar-metabox-portfolio-parent-override', true);
if (empty($back_to_all_override)) {
$back_to_all_override = 'default';
}
//attempt to find parent portfolio page - if unsuccessful default to main portfolio page
$terms = get_the_terms($post->id, "project-type");
$project_cat = null;
$portfolio_link = null;
$single_nav_pos = !empty($options['portfolio_single_nav']) ? $options['portfolio_single_nav'] : 'in_header';
if (empty($terms)) {
$terms = array('1' => (object) array('name' => 'nothing', 'slug' => 'none'));
}
foreach ($terms as $term) {
$project_cat = strtolower($term->name);
}
$page = get_page_by_title_search($project_cat);
if (empty($page)) {
$page = array('0' => (object) array('ID' => 'nothing'));
}
$page_link = verify_portfolio_page($page[0]->ID);
//if a page has been found for the category
if (!empty($page_link) && $back_to_all_override == 'default') {
$portfolio_link = $page_link;
?>
<div id="portfolio-nav">
<ul>
<li id="all-items"><a href="<?php
echo $portfolio_link;
?>
"><i class="icon-salient-back-to-all"></i></a></li>
</ul>
<ul class="controls">
<?php
if ($single_nav_pos == 'after_project') {
?>
<li id="prev-link"><?php
be_next_post_link('%link', '<i class="icon-angle-left"></i> <span>' . __("Previous Project", NECTAR_THEMEN_NAME) . '</span>', TRUE, null, 'project-type');
?>
</li>
<li id="next-link"><?php
be_previous_post_link('%link', '<span>' . __('Next Project', NECTAR_THEMEN_NAME) . '</span><i class="icon-angle-right"></i>', TRUE, null, 'project-type');
?>
</li>
<?php
} else {
?>
<li id="prev-link"><?php
be_next_post_link('%link', '<i class="icon-salient-left-arrow-thin"></i>', TRUE, null, 'project-type');
?>
</li>
<li id="next-link"><?php
be_previous_post_link('%link', '<i class="icon-salient-right-arrow-thin"></i>', TRUE, null, 'project-type');
?>
</li>
<?php
}
?>
</ul>
</div>
<?php
} else {
$portfolio_link = get_portfolio_page_link(get_the_ID());
if (!empty($options['main-portfolio-link'])) {
$portfolio_link = $options['main-portfolio-link'];
}
if ($back_to_all_override != 'default') {
$portfolio_link = get_page_link($back_to_all_override);
}
?>
<div id="portfolio-nav">
<ul>
<li id="all-items"><a href="<?php
echo $portfolio_link;
?>
" title="<?php
echo __('Back to all projects', NECTAR_THEME_NAME);
?>
"><i class="icon-salient-back-to-all"></i></a></li>
</ul>
<ul class="controls">
<?php
if (!empty($options['portfolio_same_category_single_nav']) && $options['portfolio_same_category_single_nav'] == '1') {
// get_posts in same custom taxonomy
$terms = get_the_terms($post->id, "project-type");
$project_cat = null;
if (empty($terms)) {
$terms = array('1' => (object) array('name' => 'nothing', 'slug' => 'none'));
}
//.........这里部分代码省略.........
示例5: nectar_page_header
//.........这里部分代码省略.........
$project_cat = strtolower($term->name);
}
$page = get_page_by_title_search($project_cat);
if (empty($page)) {
$page = array('0' => (object) array('ID' => 'nothing'));
}
$page_link = verify_portfolio_page($page[0]->ID);
//if a page has been found for the category
if (!empty($page_link) && $back_to_all_override == 'default') {
$portfolio_link = $page_link;
?>
<div id="portfolio-nav">
<ul>
<li id="all-items"><a href="<?php
echo $portfolio_link;
?>
"><i class="icon-salient-back-to-all"></i></a></li>
</ul>
<ul class="controls">
<li id="prev-link"><?php
be_next_post_link('%link', '<i class="icon-salient-left-arrow-thin"></i>', TRUE, null, 'project-type');
?>
</li>
<li id="next-link"><?php
be_previous_post_link('%link', '<i class="icon-salient-right-arrow-thin"></i>', TRUE, null, 'project-type');
?>
</li>
</ul>
</div>
<?php
} else {
$portfolio_link = get_portfolio_page_link(get_the_ID());
if (!empty($options['main-portfolio-link'])) {
$portfolio_link = $options['main-portfolio-link'];
}
if ($back_to_all_override != 'default') {
$portfolio_link = get_page_link($back_to_all_override);
}
?>
<div id="portfolio-nav">
<ul>
<li id="all-items"><a href="<?php
echo $portfolio_link;
?>
"><i class="icon-salient-back-to-all"></i></a></li>
</ul>
<ul class="controls">
<?php
if (!empty($options['portfolio_same_category_single_nav']) && $options['portfolio_same_category_single_nav'] == '1') {
?>
<li id="prev-link"><?php
be_next_post_link('%link', '<i class="icon-salient-left-arrow-thin"></i>');
?>
</li>
<li id="next-link"><?php
be_previous_post_link('%link', '<i class="icon-salient-right-arrow-thin"></i>');
?>
</li>
<?php
} else {
?>
<li id="prev-link"><?php
next_post_link('%link', '<i class="icon-salient-left-arrow-thin"></i>');
示例6: nectar_recent_projects
function nectar_recent_projects($atts, $content = null)
{
extract(shortcode_atts(array("title_labels" => 'false', 'project_style' => '', 'heading' => '', 'page_link_text' => '', 'page_link_url' => '', 'hide_controls' => 'false', 'lightbox_only' => '0', 'number_to_display' => '6', 'full_width' => 'false', 'category' => 'all'), $atts));
global $post;
global $options;
global $nectar_love;
$options = get_option('salient');
$title_label_output = null;
$recent_projects_title_text = !empty($options['carousel-title']) ? $options['carousel-title'] : 'Recent Work';
$recent_projects_link_text = !empty($options['carousel-link']) ? $options['carousel-link'] : 'View All Work';
$portfolio_link = get_portfolio_page_link(get_the_ID());
if (!empty($options['main-portfolio-link'])) {
$portfolio_link = $options['main-portfolio-link'];
}
//project style
if (empty($project_style) && $full_width == 'true') {
$project_style = '2';
} elseif (empty($project_style) && $full_width == 'false') {
$project_style = '1';
}
$full_width_carousel = $full_width == 'true' ? 'true' : 'false';
//incase only all was selected
if ($category == 'all') {
$category = null;
}
$projects_to_display = intval($number_to_display) == 0 ? '6' : $number_to_display;
if (!empty($heading)) {
if ($full_width_carousel == 'true') {
$title_label_output = '<h2>' . $heading . '</h2>';
} else {
$title_label_output = '<h2>' . $heading . '<a href="' . $page_link_url . '" class="button"> / ' . $page_link_text . '</a></h2>';
}
}
//keep old label option to not break legacy users
if ($title_labels == 'true') {
$title_label_output = '<h2>' . $recent_projects_title_text . '<a href="' . $portfolio_link . '" class="button"> / ' . $recent_projects_link_text . '</a></h2>';
}
$portfolio = array('posts_per_page' => $projects_to_display, 'post_type' => 'portfolio', 'project-type' => $category);
$the_query = new WP_Query($portfolio);
if ($full_width_carousel == 'true') {
$arrow_markup = '<div class="controls"><a class="portfolio-page-link" href="' . $page_link_url . '"><i class="icon-salient-back-to-all"></i></a>
<a class="carousel-prev" href="#"><i class="icon-salient-left-arrow-thin"></i></a>
<a class="carousel-next" href="#"><i class="icon-salient-right-arrow-thin"></i></a></div>';
} else {
$arrow_markup = '<a class="carousel-prev" href="#"><i class="icon-angle-left"></i></a>
<a class="carousel-next" href="#"><i class="icon-angle-right"></i></a>';
}
if ($hide_controls == 'true') {
$arrow_markup = null;
}
?>
<?php
if ($the_query->have_posts()) {
$default_style = $project_style == '1' ? 'default-style' : null;
$recent_projects_content = '<div class="carousel-wrap recent-work-carousel ' . $default_style . '" data-full-width="' . $full_width_carousel . '">
<div class="carousel-heading"><div class="container">' . $title_label_output . $arrow_markup . '</div></div>
<ul class="row portfolio-items text-align-center carousel" data-scroll-speed="800" data-easing="easeInOutQuart">';
}
//standard layout
if ($project_style == '1') {
if ($the_query->have_posts()) {
while ($the_query->have_posts()) {
$the_query->the_post();
$featured_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
$video_embed = get_post_meta($post->ID, '_nectar_video_embed', true);
$video_m4v = get_post_meta($post->ID, '_nectar_video_m4v', true);
$media = null;
$date = null;
$love = $nectar_love->add_love();
$custom_project_link = get_post_meta($post->ID, '_nectar_external_project_url', true);
$the_project_link = !empty($custom_project_link) ? $custom_project_link : get_permalink();
//video
if (!empty($video_embed) || !empty($video_m4v)) {
if (!empty($video_embed) && floatval(get_bloginfo('version')) < "3.6") {
$media .= '<a href="#video-popup-' . $post->ID . '" class="pretty_photo">' . __("Watch Video", NECTAR_THEME_NAME) . ' </a> ';
$media .= '<div id="video-popup-' . $post->ID . '">';
$media .= '<div class="video-wrap">' . stripslashes(htmlspecialchars_decode($video_embed)) . '</div>';
$media .= '</div>';
} else {
$media .= '<a href="' . get_template_directory_uri() . '/includes/portfolio-functions/video.php?post-id=' . $post->ID . '&iframe=true&width=854" class="pretty_photo" >' . __("Watch Video", NECTAR_THEME_NAME) . '</a> ';
}
} else {
$media .= '<a href="' . $featured_image[0] . '" class="pretty_photo">' . __("View Larger", NECTAR_THEME_NAME) . '</a> ';
}
$project_excerpt = get_post_meta($post->ID, '_nectar_project_excerpt', true);
if (!empty($project_excerpt)) {
$date = '<p>' . $project_excerpt . '</p>';
} elseif (!empty($options['portfolio_date']) && $options['portfolio_date'] == 1) {
$date = '<p>' . get_the_date() . '</p>';
}
$project_img = '<img src="' . get_template_directory_uri() . '/img/no-portfolio-item-small.jpg" alt="no image added yet." />';
if (has_post_thumbnail()) {
$project_img = get_the_post_thumbnail($post->ID, 'portfolio-thumb', array('title' => ''));
}
//custom thumbnail
$custom_thumbnail = get_post_meta($post->ID, '_nectar_portfolio_custom_thumbnail', true);
//.........这里部分代码省略.........
示例7: portfolio_front_page
function portfolio_front_page()
{
global $wpGrade_Options, $post;
//show only 3 on the home page by default
$number = 6;
// if ($wpGrade_Options->get('homepage_portfolio_limit'))
// {
// $number = absint($wpGrade_Options->get('homepage_portfolio_limit'));
// }
//the width/height ratio of the sizes
$portfolio_ratios = array('long' => 2.592, 'tall' => 0.649, 'small' => 1.299);
//the patterns for 6 portfolio items, 3 per row, with 9 columns grid
$portfolio_patterns = array(array('small', 'long', 'big', 'tall'), array('big', 'tall', 'small', 'long'), array('long', 'small', 'small', 'big', 'small'), array('long', 'small', 'tall', 'big'), array('small', 'big', 'small', 'long', 'small'), array('long', 'small', 'tall', 'big'));
//$featured_query = new WP_Query( array('post_type' => 'portfolio', 'posts_per_page' => $number));
$query_args = array('post_type' => 'portfolio', 'posts_per_page' => $number, 'meta_key' => '_senna_portfolio_featured', 'orderby' => 'meta_value date', 'meta_query' => array('relation' => 'AND', array('key' => '_senna_portfolio_featured', 'compare' => '=', 'value' => 'on')));
$featured_projects = get_posts($query_args);
// if we don't have enough featured posts we fill them with reqular posts
if (count($featured_projects) < $number) {
$squery_args = array('post_type' => 'portfolio', 'posts_per_page' => $number - count($featured_projects), 'orderby' => 'date', 'meta_query' => array('relation' => 'OR', array('key' => '_senna_portfolio_featured', 'compare' => '!=', 'value' => 'on'), array('key' => '_senna_portfolio_featured', 'compare' => 'NOT EXISTS', 'value' => '')));
$regular_projects = get_posts($squery_args);
$featured_projects = array_merge($featured_projects, $regular_projects);
}
?>
<div class="row portfolio_frontpage portfolio_items">
<?php
/* Start the Loop */
$counter = 0;
foreach ($featured_projects as $key => $post) {
setup_postdata($post);
?>
<?php
if ($counter < $number) {
?>
<article id="post-<?php
the_ID();
?>
" <?php
post_class();
?>
>
<ul>
<?php
// get the big image
$video_markup = get_post_format() == 'video' ? '<div class="video_icon"><span></span></div>' : '';
$video_class = get_post_format() == 'video' ? 'video_type' : '';
$video_poster = get_post_meta(get_the_ID(), '_senna_video_poster', true);
if (!empty($video_poster)) {
global $wpdb;
$uploads_dir_info = wp_upload_dir();
$temp_poster = str_replace($uploads_dir_info['baseurl'] . '/', '', $video_poster);
$featured_image_id = $wpdb->get_var($wpdb->prepare("SELECT wposts.ID FROM {$wpdb->posts} wposts, {$wpdb->postmeta} wpostmeta WHERE wposts.ID = wpostmeta.post_id AND wpostmeta.meta_key = '_wp_attached_file' AND wpostmeta.meta_value = '%s' AND wposts.post_type = 'attachment'", $temp_poster));
if (!empty($featured_image_id)) {
//get the rest of the gallery without the featured image
$attachments = get_posts(array('post_type' => 'attachment', 'post_mime_type' => 'image', 'posts_per_page' => -1, 'post_parent' => get_the_ID(), 'exclude' => $featured_image_id));
} else {
//get the gallery
$attachments = get_posts(array('post_type' => 'attachment', 'post_mime_type' => 'image', 'posts_per_page' => -1, 'post_parent' => get_the_ID()));
}
} elseif (has_post_thumbnail(get_the_ID())) {
$featured_image_id = get_post_thumbnail_id(get_the_ID());
//get the rest of the gallery without the featured image
$attachments = get_posts(array('post_type' => 'attachment', 'post_mime_type' => 'image', 'posts_per_page' => -1, 'post_parent' => get_the_ID(), 'exclude' => $featured_image_id));
} else {
//get all the images in the gallery
$attachments = get_posts(array('post_type' => 'attachment', 'post_mime_type' => 'image', 'posts_per_page' => -1, 'post_parent' => get_the_ID()));
//we use the first image in the gallery for the big one
if (!empty($attachments[0])) {
$featured_image_id = $attachments[0]->ID;
//delete the first image from the array
array_shift($attachments);
}
}
if (!empty($attachments)) {
//make an array with images url, width, height and ratio of width/height
$attachment_images = array();
foreach ($attachments as $attachment) {
$attachment_images[$attachment->ID] = wp_get_attachment_image_src($attachment->ID, 'full');
$attachment_images[$attachment->ID]['ratio'] = $attachment_images[$attachment->ID][1] / $attachment_images[$attachment->ID][2];
}
//lets go through the pattern and find the right images for each position
$pattern_counter = 0;
foreach ($portfolio_patterns[$counter % 6] as $pattern) {
//if it's not the big one, we've found that earlier
if ($pattern != 'big') {
//if we still have images
if (!empty($attachment_images)) {
//put the "Portfolio" box
if ($counter == 0 && $pattern == 'long') {
echo '<li class="' . $pattern . ' text big-portfolio" >
<a href="' . get_portfolio_page_link() . '">
<div class="title"><div>' . $wpGrade_Options->get('homepage_portfolio_title') . '</div></div>
//.........这里部分代码省略.........
示例8: wpgrade_content_nav
/**
* Display navigation to next/previous pages when applicable
*
* @since wpGrade 1.0
*/
function wpgrade_content_nav($nav_id)
{
global $wp_query, $post;
// Don't print empty markup on single pages if there's nowhere to navigate.
if (is_single()) {
$previous = is_attachment() ? get_post($post->post_parent) : get_adjacent_post(false, '', true);
$next = get_adjacent_post(false, '', false);
if (!$next && !$previous) {
return;
}
}
// Don't print empty markup in archives if there's only one page.
if ($wp_query->max_num_pages < 2 && (is_home() || is_archive() || is_search())) {
return;
}
$nav_class = ' paging-navigation';
if (is_single()) {
$nav_class = ' post-navigation';
}
?>
<nav role="navigation" id="<?php
echo $nav_id;
?>
" class="<?php
echo $nav_class;
?>
">
<?php
if (is_single()) {
// navigation links for single posts
?>
<?php
next_post_link('%link', '<i class="icon-chevron-left"></i>');
?>
<?php
echo '<a href="' . get_portfolio_page_link() . '"><i class="icon-th"></i></a>';
?>
<?php
previous_post_link('%link', '<i class="icon-chevron-right"></i>');
?>
<?php
} elseif ($wp_query->max_num_pages > 1 && (is_home() || is_archive() || is_search())) {
// navigation links for home, archive, and search pages
?>
<?php
if (get_next_posts_link()) {
?>
<div class="nav-previous"><?php
next_posts_link(__('<span class="meta-nav">«</span> Older posts', wpGrade_txtd));
?>
</div>
<?php
}
?>
<?php
if (get_previous_posts_link()) {
?>
<div class="nav-next"><?php
previous_posts_link(__('Newer posts <span class="meta-nav">»</span>', wpGrade_txtd));
?>
</div>
<?php
}
?>
<?php
}
?>
</nav><!-- #<?php
echo $nav_id;
?>
-->
<?php
}