echo of_get_option('veecard_bio_vcard'); ?> " class="vcard"><?php _e("Download CV", "site5framework"); ?> </a> <!-- --><?php //} ?> </div> <!-- .main-container --> <div class="main-container"> <nav> <a href="#top-menu" id="menu-button">Menu</a> <div id="top-menu"> <?php site5_main_nav(); ?> </div> </nav> <div class="main clearfix"> <?php if (is_home() === false && is_post_type('resume') === false) { get_template_part('part', 'bio'); } ?>
function the_featured_image() { $id = get_the_id(); if (has_post_thumbnail($id)) { // Has one. Echo the img src. $imgsrc = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), full); return $imgsrc[0]; } else { // Guess at a good one. if (is_post_type('find_your_nearest')) { return get_stylesheet_directory_uri() . "/img/location-header-default.jpg"; } else { // Echo default image return get_stylesheet_directory_uri() . "/img/wca-resident-1.jpg"; } } }
<?php /** * Function to make it possible to query on is_post_type() * * source: http://wordpress.stackexchange.com/a/22166/2015 */ function is_post_type($type) { global $wp_query; if ($type == get_post_type($wp_query->post->ID)) { return true; } return false; } /** * EXAMPLE * Now you can enqueue styles or scripts only for a specific Custom Post Type */ if (is_single() && is_post_type('cpt-name')) { // the script and/or style you want to enqueue }
<?php if ($wp_query->max_num_pages > 1) { ?> <div class="clearboth"></div> <?php if (is_post_type("event")) { $page_class = ''; } elseif (is_post_type("testimonial")) { $page_class = ''; } else { $page_class = 'page-pagination-full'; } ?> <?php if (is_plugin_active('wp-pagenavi/wp-pagenavi.php')) { ?> <div class="page-pagination <?php echo $page_class; ?> "> <?php wp_pagenavi(); ?> </div> <?php
function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', $instance['title']); if (empty($title)) { $title = false; } global $post; $agent = $post->ID; $sort_by = $instance['sort_by']; $count = intval($instance['count']); $agent_args = array('post_type' => 'property', 'posts_per_page' => $count, 'meta_query' => array(array('key' => 'REAL_HOMES_agents', 'value' => $agent, 'compare' => '='))); // Show only Featured Properties $agent_args['meta_query'][] = array('key' => 'REAL_HOMES_featured', 'value' => 1, 'compare' => '=', 'type' => 'NUMERIC'); //Order by if ($sort_by == "random") { $agent_args['orderby'] = "rand"; } else { $agent_args['orderby'] = "date"; } $agent_query = new WP_Query($agent_args); if (is_post_type('agent')) { echo $before_widget; if ($title) { echo $before_title; echo $title; echo $after_title; } if ($agent_query->have_posts()) { ?> <ul class="featured-properties"> <?php while ($agent_query->have_posts()) { $agent_query->the_post(); ?> <li> <?php if (has_post_thumbnail()) { ?> <figure> <a href="<?php the_permalink(); ?> "> <?php the_post_thumbnail('grid-view-image'); ?> </a> </figure> <?php } ?> <h4><a href="<?php the_permalink(); ?> " title="<?php the_title(); ?> "><?php the_title(); ?> </a></h4> <p><?php framework_excerpt(7); ?> <a href="<?php the_permalink(); ?> "><?php _e('Read More', 'framework'); ?> </a></p> <span class="price"><?php property_price(); ?> </span> </li> <?php } ?> </ul> <?php wp_reset_query(); } else { ?> <ul class="featured-properties"> <?php echo '<li>'; _e('No Featured Property Found Under Agent ', 'framework'); the_title(); echo '.</li>'; ?> </ul> <?php } echo $after_widget; } }
<?php if (is_post_type("accommodation")) { load_template(get_template_directory() . '/single-accommodation.php'); } elseif (is_post_type("event")) { load_template(get_template_directory() . '/single-events.php'); } elseif (is_post_type("gallery")) { load_template(get_template_directory() . '/single-gallery.php'); } else { load_template(get_template_directory() . '/single-default.php'); }
function wpbo_feed_content($content) { if (is_post_type('match')) { global $post; $type = get_post_meta($post->ID, 'wpbo-type', true); $content = '<p>The following '; if ($type == 'highlander') { $content .= 'Highlander (9v9)'; } else { $content .= 'Normal (6v6)'; } $content .= ' PUG is scheduled for '; $content .= date('l, jS \\o\\f F', get_post_meta($post->ID, 'wpbo-date', true)); $content .= '. </p><p>'; $content .= get_post_meta($post->ID, 'wpbo-info', true); $content .= '</p>'; } return $content; }
global $_theme_bottom_sidebar; $_theme_layout = $_theme_side_sidebar = $_theme_bottom_sidebar = ''; if (is_singular()) { $_theme_layout = get_post_meta(get_the_ID(), 'layout', true); $_theme_side_sidebar = get_post_meta(get_the_ID(), 'side_bar', true); $_theme_bottom_sidebar = get_post_meta(get_the_ID(), 'bottom_bar', true); } if (empty($_theme_layout)) { if (is_page()) { $_theme_layout = get_option('default_pages_layout', 3); } else { $_theme_layout = get_option('default_blog_layout', 1); } } if (empty($_theme_side_sidebar)) { if (is_category() || is_single() && is_post_type('post')) { $_theme_side_sidebar = get_option('blog_side_sidebar', 'disable'); } else { $_theme_side_sidebar = get_option('default_side_sidebar', 'disable'); } } if (empty($_theme_bottom_sidebar)) { if (is_portfolio()) { $_theme_bottom_sidebar = get_option('portfolio_bottom_sidebar', 'disable'); } elseif (is_category()) { $_theme_bottom_sidebar = get_option('blog_bottom_sidebar', 'disable'); } elseif (is_tax('gallery')) { $_theme_bottom_sidebar = get_option('gallery_bottom_sidebar', 'disable'); } else { $_theme_bottom_sidebar = get_option('default_bottom_sidebar', 'disable'); }
} // end if ?> <?php } elseif (is_tax('conferences')) { ?> <?php if (have_posts()) { while (have_posts()) { the_post(); ?> <?php if (is_post_type('events')) { ?> <article class="row"> <header class="small-12 columns"> <a href="<?php the_permalink(); ?> " title="<?php the_title(); ?> "><?php the_post_thumbnail(); ?>
<?php } ?> <?php /* Start the Loop */ while (have_posts()) { the_post(); $match = wpbo_match_data($post->ID); ?> <?php /* How to Display posts in the Gallery Category */ ?> <?php if (is_post_type('match')) { ?> <div id="post-<?php the_ID(); ?> " <?php post_class(); ?> > <h2 class="entry-title"><a href="<?php the_permalink(); ?> " title="<?php printf(esc_attr__('Permalink to %s', 'twentyten'), the_title_attribute('echo=0')); ?> " rel="bookmark"><?php
function qns_continue_reading_link() { // Don't Display Read More Button On Search Results / Archive Pages if (is_post_type("accommodation")) { $btn_text = __('Details', 'qns'); } else { $btn_text = __('Read More', 'qns'); } if (!is_search() && !is_archive()) { return ' <p><a href="' . get_permalink() . '"' . __(' class="button2">' . $btn_text . ' »</a></p>', 'qns'); } }
function insert_og_in_head() { if (is_post_type('property')) { global $post; if (has_excerpt($post->ID)) { $description = strip_tags(get_the_excerpt()); } else { $description = str_replace("\r\n", ' ', substr(strip_tags(strip_shortcodes($post->post_content)), 0, 160)); } if (empty($description)) { $description = get_bloginfo('description'); } echo '<meta property="og:title" content="' . get_the_title() . '"/>'; echo '<meta property="og:description" content="' . $description . '" />'; echo '<meta property="og:type" content="article"/>'; echo '<meta property="og:url" content="' . get_permalink() . '"/>'; echo '<meta property="og:site_name" content="' . get_bloginfo('name') . '"/>'; if (has_post_thumbnail($post->ID)) { $thumbnail_src = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full'); echo '<meta property="og:image" content="' . esc_attr($thumbnail_src[0]) . '"/>'; } } }