Support

Account

Home Forums General Issues Post Object, not consistent… Reply To: Post Object, not consistent…

  • Oooof…thought I’d responded to this days ago. My apologies.

    First, $quote is just a text field – a testimonial from a client. Second, I’m not sure how to export the json of the field group. Third, following is the full code for the shortcode. Note that I’ve since made a number of changes as I continued to work on things, but I still haven’t figured out how to get the quotes pulled in so I had temporarily pulled the code entirely. So where it says “Quote goes here”, that’s where the code above was.

    <?php
    //Add Featured Portfolio items shortcode //
    add_shortcode( 'featured_portfolio', 'display_featured_portfolio_items' );
    
    function display_featured_portfolio_items(){
    	
    	ob_start();
    	
    	// Define the query
    	$args = array(
    		'post_type' => 'pixieportfolio',
    		'post_status' => 'publish',
    		'orderby' => 'menu_order',
    		'meta_query'	=> array(
    			array(
    				'key'	  	=> 'featured_portfolio_item',
    				'value'	  	=> '1',
    				'compare' 	=> '=',
    			)
    		),
    		'meta_key' => '_thumbnail_id',
    		'posts_per_page' => 999
    	);
    	
    	$query = new WP_Query( $args );
    	$count = 0;
    
    // Carousel // ?>
    <!--<div class="more-button">
    	<a href="/portfolio-all/" class="btn btn-default btn-lg" type="button" role="button">More Projects</a>
    </div>-->
    
    <div id="featuredCarousel" class="carousel slide" data-ride="carousel" data-pause="hover">
    		
    	<!-- Indicators -->
    	<ol class="carousel-indicators">
    		
    		<?php while($query->have_posts()): $query->the_post(); ?>
    
                <li <?php if($count == 0){ echo 'class="active"';} ?> data-target="#featuredCarousel" data-slide-to="<?php echo $count++; ?>"></li>
    
              <?php endwhile; ?>
    	</ol>
    	
    	<div class="carousel-inner" role="listbox">
    		
    		<?php $count = 0;
    			
    			while ($query->have_posts()) : $query->the_post();
    			$count++;
    			$thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'pp-home-portfolio' );
    			$url = $thumb['0'];
    			$values = get_field('tech_choices');
    			$terms = get_the_terms($post->ID, 'post_tag');
    			$custom = get_post_custom($post->ID);
    			$caption = get_field('caption', '');
    			$client =  get_field('client', '');
    			$project_url = get_field('project_url', '');
    			$date = get_field('date', ''); ?>
    		
    		<!-- Wrapper for slides -->
    		<div class="item <?php if ($count == 1) { echo 'active';} ?>" data-slide-number="<?php echo $count++; ?>" id="<? the_ID(); ?>">
    			<div class="item-image" style="background-image: url(<?=$url?>);" title="<?php the_title() ?>" data-toggle="modal" data-target="#myModal<?php echo $count; ?>"></div>
    			
    			<div class="project-details">
    				<div class="project-detail-border shadow-effect"></div>
    				<div class="project-detail">
    					<div class="top-detail">
    						<h4><?php the_title(); ?></h4>
    						<div class="short-description">
    							<?php $content = get_the_content();
    								echo wp_trim_words( $content , '20' );
    							?>
    						</div>
    					</div>
    					
    					<table class="table project">
    						<tr>
    								<td valign="middle" class="fifty">
    									<?php $terms_as_text = strip_tags( get_the_term_list( $wp_query->post->ID, 'pixie-portfolio-categories', '', ', ', '' ) );
    echo $terms_as_text;?>
    								</td>
    								
    								<td valign="middle" class="fifty">
    									<?php if( $values ) {
    										
    										if(in_array('WordPress', $values )){ ?>
    											<i class="fa fa-wordpress fa-2x" data-toggle="tooltip" title="Wordpress"></i>
    										<?php } if(in_array('HTML-5', $values )){ ?>
    											<i class="fa fa-html5 fa-2x" data-toggle="tooltip" title="HTML-5"></i>
    										<?php } if(in_array('CSS-3', $values )){ ?>
    											<i class="fa fa-css3 fa-2x" data-toggle="tooltip" title="CSS-3"></i>
    										<?php } if(in_array('Sportswear', $values )){ ?>
    											<i class="fa fa-bicycle fa-2x" data-toggle="tooltip" title="Sportswear"></i>
    										<?php } if(in_array('Adobe', $values )){ ?>
    											<i class="fa fa-paint-brush fa-2x" data-toggle="tooltip" title="Adobe"></i>
    										<?php } if(in_array('Code', $values )){ ?>
    											<i class="fa fa-code fa-2x" data-toggle="tooltip" title="Code"></i>
    										<?php } if(in_array('Ecommerce', $values )) { ?>
    											<i class="fa fa-database fa-2x" data-toggle="tooltip" title="MySQL"></i>
    										<?php }
    									} else {} ?>
    									
    								</td>
    							</tr>
    							
    							<tr>
    								<td colspan="2" class="more-info" data-toggle="modal" data-target="#myModal<?php echo $count; ?>">
    									<div class="view-project">View Project</div>
    								</td>
    							</tr>
    					</table>
    				</div>
    			</div>
    		</div>
    		
    		<!-- Modal -->
    		<div id="myModal<?php echo $count; ?>" class="modal fade" role="dialog" aria-labelledby="myModal<?php echo $count; ?>Label">
    			<div class="modal-dialog modal-lg" role="document">
    				
    				<!-- Modal content-->
    				<div class="modal-content">
    					<div class="modal-header">
    						<button type="button" class="close" data-dismiss="modal">&times;</button>
    						<h2 class="modal-title"><?php the_title() ?></h2>
    						<span>
    							<?php if( $terms ): ?>
    							<ul>
    								<?php foreach( $terms as $term ): ?>
    								<li><a href="<?php echo get_term_link( $term ); ?>"><?php echo $term->name; ?></a></li>
    								<?php $icon = get_field('creative_icon', $term->taxonomy . '_' . $term->term_id); echo $icon; ?>
    								<?php endforeach; ?>
    							</ul>
    							<?php endif; ?>
    						</span>
    					</div>
    					<div class="modal-body">
    						<div class="container-fluid">
    							<div class="row">
    								<div class="col-md-8">
    									<div>
    										<p class="post-meta gallery-list">
    											<?php if( $client ): ?>
    											<span class="pixie-date">
    												<span class="title">Client:</span> <?=$client?>
    											</span>
    											<?php endif;
    											
    											if ( $date ): ?>
    											<span class="post-cats">
    												<span class="title">Date:</span> <?=$date?>
    											</span>
    											<?php endif;
    											
    											if ( $values ) { ?>
    											<span class="post-comments">
    												<?php $values = get_field('tech_choices'); ?>
    												<span class="title">Tech used in this project:</span>
    												
    												<?php if(in_array('WordPress', $values )){ ?>
    												<i class="fa fa-wordpress fa-2x" data-toggle="tooltip" data-placement="bottom" title="WordPress"></i>
    												<? }
    													
    												if(in_array('HTML-5', $values )){ ?>
    												<i class="fa fa-html5 fa-2x" data-toggle="tooltip" data-placement="bottom" title="HTML5"></i>
    												<? }
    													
    												if(in_array('CSS-3', $values )){ ?>
    												<i class="fa fa-css3 fa-2x" data-toggle="tooltip" data-placement="bottom" title="CSS3"></i>
    												<? }
    													
    												if(in_array('Sportswear', $values )){ ?>
    												<i class="fa fa-bicycle fa-2x" data-toggle="tooltip" data-placement="bottom" title="Sportswear"></i>
    												<? }
    												
    												if(in_array('Adobe', $values )){ ?>
    												<i class="fa fa-paint-brush fa-2x" data-toggle="tooltip" data-placement="bottom" title="Illustrator and/or Photoshop"></i>
    												<? }
    													
    												if(in_array('Code', $values )){ ?>
    												<i class="fa fa-code fa-2x" data-toggle="tooltip" data-placement="bottom" title="PHP, JQuery, etc."></i>
    												<? }
    													
    												if(in_array('Ecommerce', $values )){ ?>
    												<i class="fa fa-shopping-cart fa-2x" data-toggle="tooltip" data-placement="bottom" title="ECommerce"></i>
    												<? }
    												
    												if(in_array('MySQL', $values )){ ?>
    												<i class="fa fa-database fa-2x" data-toggle="tooltip" data-placement="bottom" title="MySQL"></i>
    												<? } ?>
    											</span>
    											<?php } ?>
    										</p>
    									</div>
    									
    									<?php echo the_content(); ?>
    									
    									<blockquote class="testimonial">
    									
    										QUOTE GOES HERE
    								
    									</blockquote>
    								</div>
    								
    								<div class="col-md-4">
    									<div class="gallery">
    									
    									<?php $thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'darwin-modal-main' );
    									$url = $thumb['0'];
    									$thumb2 = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'large' );
    									$url2 = $thumb2['0'];
    									$c = 0; ?>
    									<a href="<?=$url2?>" class="group" id="port_gal" rel="group<?php echo $c; ?>">
    										<img src="<?=$url?>" width="300" height="300">
    									</a>
    									
    									<?php $images = get_field('gallery_images');
    										if( $images ) {
    											foreach( $images as $image ) {
    									?>
    									<a href="<?php echo $image['sizes']['large'] ?>" class="group" id="port_gal"  rel="group<?php echo $c; ?>">
    										<img src="<?php echo $image['sizes']['darwin-modal-thumb'] ?>" alt="<?php $image['alt'] ?>" />
    									</a>
    											<?php }
    										} ?>
    									</div>
    									
    									<div class="website-button">
    									
    									<?php if ( $project_url ): ?>
    									<a class="btn btn-default" href="<?=$project_url?>" target="_blank" role="button">Visit Website</a>
    									<?php endif; ?>
    									</div>
    								</div>
    								
    							</div>
    						</div>
    					</div>
    					<div class="modal-footer">
    						<button type="button" class="close" data-dismiss="modal">&times;</button>
    					</div>
    				</div>
    			</div>
    		</div>
    		
    		<?php endwhile; ?>
    		
    	</div>
    	<?php wp_reset_query(); ?>
    </div>
    
    <?php return ob_get_clean(); } ?>