Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Single Post Template: Portfolio Single
- */
- //Pastebin Reference link: Coming Soon
- //Ref post links:
- // http://codex.wordpress.org/Function_Reference/wp_get_attachment_image_src
- // http://wordpress.org/support/topic/auto-use-first-image-in-post-as-featured-image
- // uses http://www.tipsandtricks-hq.com/wordpress-audio-music-player-plugin-4556
- // http://www.billerickson.net/code/wp_query-arguments/
- // http://justintadlock.com/archives/2010/07/10/meta-capabilities-for-custom-post-types
- // http://codex.wordpress.org/Function_Reference/the_author_meta
- // http://codex.wordpress.org/Function_Reference/get_the_author_meta
- // http://codex.wordpress.org/Function_Reference/get_author_posts_url
- // http://codex.wordpress.org/Function_Reference/do_shortcode
- // http://codex.wordpress.org/Function_Reference/wp_video_shortcode
- // http://codex.wordpress.org/Video_Shortcode
- // http://codex.wordpress.org/Function_Reference/wp_audio_shortcode
- // http://codex.wordpress.org/Audio_Shortcode
- // http://oembed.com/
- // http://codex.wordpress.org/Function_Reference/wp_oembed_get
- // http://wordpress.org/support/topic/oembed-and-custom-field
- // http://codex.wordpress.org/Function_Reference/get_the_tags
- function portfolio_single_image() {
- if ( is_singular() && has_post_thumbnail() ) {
- $img = genesis_get_image( array( 'format' => 'html', 'size' => the_post_thumbnail( 'Home Featured' ), 'attr' => array( 'class' => 'aligncenter Home Featured' ) ) );
- }
- }
- // Force content-sidebar layout setting
- add_filter( 'genesis_site_layout', '__genesis_return_sidebar_content' );
- //* Remove the post info function
- remove_action( 'genesis_before_post_content', 'genesis_post_info' );
- $postDate = do_shortcode ('[post_date]'); //reference only
- $postComments = do_shortcode ('[post_comments]'); //reference only
- $postEdit = do_shortcode ('[post_edit]'); //reference only
- remove_action( 'genesis_loop', 'genesis_do_loop' );
- add_action( 'genesis_loop', 'arts_single' );
- function arts_single() {
- //global $paged;
- //global $loop_counter;
- //$loop_counter = 0;
- //global $post;
- //$oldpost = $post;
- $args = array(
- 'posts_per_page' => 1,
- 'post_type' => 'portfolio',
- //'paged' => get_query_var( 'post' ),
- );
- global $my_query;
- $my_query = new WP_Query ( $args );
- genesis_before_post();
- genesis_before_post_title();
- echo '<div class="portfolio-content" itemscope itemtype="http://schema.org/CreativeWork">'; // echo out schema item type
- echo '<h1 class="entry-title" itemprop="name">'; // echo out schema property
- echo ( get_the_title() ); // using post title as schema item property
- echo '</h1>';
- genesis_after_post_title();
- genesis_before_post_content();
- if ($my_query->have_posts()) : // custom query for primary post content
- //$queried_object = get_queried_object();
- //var_dump( $queried_object );
- $postid = get_the_id();
- $postID = get_queried_object()->ID;
- $cats = get_the_category();
- $cat = $cats[0];
- $cat_id = $cat->cat_ID;
- $cat_name = $cat->name;
- $cat_slug = $cat->slug;
- $posttags = get_the_tags();
- $postOembed = ( get_post_meta($postid, '_arts_projectEmbed', true) );
- while ($my_query->have_posts()) : $my_query->the_post(); /*$do_not_duplicate = $post->ID;*/
- // for some reason I had to do this to make the loop work:
- // http://wordpress.stackexchange.com/questions/30694/manually-set-global-post-vars-with-an-id-in-order-to-use-template-tags
- // another ref link: https://codex.wordpress.org/Function_Reference/setup_postdata
- global $post;
- /* Original working hack */
- $post = get_post( $postID, OBJECT );
- setup_postdata( $post );
- $postWhileID = get_the_id();
- $postNewWhileID = get_queried_object()->ID;
- $artist = get_the_author();
- $artistNickName = get_the_author_meta('nickname',get_queried_object()->post_author);
- $artistPostLink = get_author_posts_url( get_the_author_meta( 'ID' ));
- $artistNew = get_the_author_meta('display_name',get_queried_object()->post_author);
- $artistID = get_the_author_meta('ID',get_queried_object()->post_author);
- $artistPosts = get_the_author_posts();
- echo '<div class="post-info">';
- //echo '<p>Post While ID = '.$postWhileID.'</p>';
- //echo '<p>Post Queried Object = '.$postNewWhileID.'</p>';
- echo '<span class="date published time" title="'.do_shortcode ('[post_date]').'</span>';
- echo ' by <a rel="author" href="' . $artistPostLink . '">' .$artist. '</a>';
- echo do_shortcode ('[post_comments]');
- echo ' '.do_shortcode ('[post_edit]');
- echo '</div>'; ?>
- <?php echo '<div class="description" itemprop="description">'; // echo out schema property
- //echo '<p>The Postid is: '.$postid.'</p>';
- //echo '<p>The PostID is: '.$postID.'</p>';
- echo ( wpautop (the_content()) ); // using post content as song description, preserve paragraphs with wpautop
- echo '</div>';
- ?>
- <div class="one-third first" itemprop="image"><?php portfolio_single_image(); ?></div>
- <!--<div class="one-third first" itemprop="image"><?php echo get_the_post_thumbnail($postid, 'Home Featured'); ?></div>-->
- <div class="one-third second">
- <!--<?php echo '<p>The post author is ' . $artist . '</p>'; ?>-->
- <?php if ( get_post_meta($postID, '_arts_projectMP3', true) ) : // verify that custom data exists before output
- $projectMP3 = ( get_post_meta($postID, "_arts_projectMP3", true) );
- echo '<span class="hrlabel">Listen to ' . get_the_title($postID) . ' :</span>'; // section label
- echo '<div itemprop="audio" class="audio">';
- echo do_shortcode ( '[sc_embed_player fileurl="' . $projectMP3 .'"]' );
- echo '</div>';
- endif; ?>
- <?php if ( get_post_meta($postID, '_arts_projectArtist', true) ) : // verify that custom data exists before output
- echo '<p itemprop="creator" class="creator">'; // echo out schema property
- echo '<span class="hrlabel">Artist: </span>'; // section label
- echo ( get_post_meta($postID, "_arts_projectArtist", true) ); // echo custom field
- echo '</p>';
- endif; ?>
- <?php if ( get_post_meta($postID, '_arts_projectAlbum', true) ) : // verify that custom data exists before output
- echo '<p itemprop="inAlbum" class="inAlbum">'; // echo out schema property
- echo '<span class="hrlabel">From Album: </span>'; // section label
- echo ( get_post_meta($postID, "_arts_projectAlbum", true) ); // echo custom field
- echo '</p>';
- endif; ?>
- </div><!-- end one-third second -->
- <div class="one-third">
- <?php if ( get_post_meta($postID, '_arts_projectContributors', true) ) : // verify that custom data exists before output
- echo '<div class="contributor"><span class="hrlabel">Other Contributors:</span>'; // Echo out the div class & title
- echo '<span itemprop="contributor">'; // Echo Schema property
- echo wpautop( get_post_meta( $postID, "_arts_projectContributors", true ) ); // Echo out other contributors entry
- echo '</span></div>'; //Close up itemprop span & div class
- endif; ?>
- </div><!-- end one-third -->
- <?php if ( get_post_meta($postID, '_arts_projectEmbed', true) ) : // verify that custom data exists before output
- echo '<span itemprop="video">'; // Echo Schema property
- echo wp_oembed_get( get_post_meta($postID, '_arts_projectEmbed', true) );
- echo '</span></div>'; //Close up itemprop span & div class
- endif; ?>
- <?php
- //$loop_counter++;
- //</div><!-- end two-thirds -->
- //</div><!-- end portfolio content -->
- //wp_reset_query();
- genesis_after_post_content();
- genesis_before_comments();
- genesis_list_comments();
- genesis_before_comment();
- genesis_after_comment();
- genesis_after_comments();
- genesis_before_pings();
- genesis_after_pings();
- genesis_before_comment_form();
- genesis_comment_form();
- genesis_after_comment_form();
- endwhile;
- wp_reset_postdata();
- genesis_after_endwhile();
- endif;
- genesis_after_loop();
- genesis_after_content_sidebar_wrap();
- //genesis_before_footer();
- // genesis_after_footer();
- }
- //genesis();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement