WordPress.org

Ready to get started?Download WordPress

Forums

Posts 2 Posts
Connection not showing in front-end in preview (7 posts)

  1. djhsecondnature
    Member
    Posted 1 year ago #

    Since the last update there's no way to proof the connection before it is published. This causes quite an issue for me, is it supposed to do this now? If so, how can I deactivate it?

    http://wordpress.org/extend/plugins/posts-to-posts/

  2. scribu
    Member
    Plugin Author

    Posted 1 year ago #

    I don't understand what you mean by "proof the connection".

    In general, I'm having a hard time understanding what the issue is.

  3. shahed2535
    Member
    Posted 1 year ago #

    Hi

    I installed front end editor in http://www.grandtrustbrokers.com/
    But it is totally inactive in my site.

    Please help to make it work in my site.

  4. scribu
    Member
    Plugin Author

    Posted 1 year ago #

    @shahed2535: This thread is for the Posts 2 Posts plugin. Please open a new thread in the appropriate place (after reading the FAQ).

  5. djhsecondnature
    Member
    Posted 1 year ago #

    Hi sorry, I've re-read my problem and it makes no sense :-p I'll try again.

    The way I use posts 2 posts means it's important for me to view how a connection looks prior to it being published. Before (the update) I could hit preview and it would show the meta data from connected posts as I wanted it, however, now it no longer does that. It will show the post as connected prior to publishing, but any connected information that is grabbed from one post to a connected post only shows after publishing - thus I'm unable to preview (proof) it correctly.

  6. shahed2535
    Member
    Posted 1 year ago #

  7. artemisian
    Member
    Posted 1 year ago #

    We're having the same problem as djhsecondnature.

    We have a custom post type for 'featured product', which we're linking to individual blog posts. Each blog post has a box at the bottom for featured product. When we preview a blog post before it's published, the featured product isn't shown. After the post is published, preview shows the featured post box, but not before, and our writers are unhappy because they'd like to be able to preview the featured product box before publishing the post.

    Can anyone help?

    Here's the code:

    // add connection type
    function my_connection_types() {
    	p2p_register_connection_type( array(
    		'name' => 'posts_to_featured_products',
    		'from' => 'post',
    		'to' => 'featured_products'
    	) );
    }
    add_action( 'p2p_init', 'my_connection_types' );
    
    // add product box after content
    add_action('template_redirect', 'product_conditional_actions');
    function product_conditional_actions() {
    	if( is_single() && !is_singular( 'featured_products' ) ) {
    	add_action('genesis_after_post_content', 'add_featured_product_box');
    	}
    }
    
    function add_featured_product_box() {
    
    	// Find connected pages
    	$connected = new WP_Query( array(
    	  'connected_type' => 'posts_to_featured_products',
    	  'connected_items' => get_queried_object(),
    	  'nopaging' => true,
    	) );
    
    	// Display connected pages
    	if ( $connected->have_posts() ) :
    	?>
    	<div class="featuredproductteaser">
    		<?php while ( $connected->have_posts() ) : $connected->the_post(); ?>
    
    				<?php $producturl=get_post_meta(get_the_ID(), 'product_url', true);
    					if ( $producturl ) { ?>
    
    						<?php if ( has_post_thumbnail() ) { ?>
    							<a href="<?php echo $producturl; ?>" target="_blank">
    								<?php the_post_thumbnail('featured-product-thumb'); ?>
    							</a>
    							<?php } ?>
    						<div class="copy">
    							<h2>Featured resource</h2>
    							<h3><a href="<?php echo $producturl; ?>" target="_blank"><?php the_title(); ?></a></h3>
    							<?php the_excerpt(); ?>
    							<p class="flink"><a href="<?php echo $producturl; ?>" target="_blank">Get it now</a></p>
    						</div>
    
    					<?php } else { ?>
    
    						<?php if ( has_post_thumbnail() ) { ?>
    							<a href="<?php echo $producturl; ?>" target="_blank">
    								<?php the_post_thumbnail('featured-product-thumb'); ?>
    							</a>
    							<?php } ?>
    						<div class="copy">
    							<h2>Featured resource</h2>
    							<h3><a href="<?php the_permalink(); ?>" target="_blank"><?php the_title(); ?></a></h3>
    							<?php the_excerpt(); ?>
    							<p class="flink"><a href="<?php the_permalink(); ?>" target="_blank">Get it now</a></p>
    						</div>
    
    				<?php } ?>
    
    		<?php endwhile; ?>
    	</div>
    	<?php
    	// Prevent weirdness
    	wp_reset_postdata();
    
    	endif;
    
    	}

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.