Deprecated filter contextual_help
is used in wp-content\plugins\posts-to-posts\vendor\scribu\scb-framework\AdminPage.php
on line 138
Suggestion: Replace with get_current_screen()->add_help_tab()
Regards,
Charlie
]]>Fatal error: Call to a member function isError() on a non-object in /home/[…]/public_html/wp-content/plugins/really-simple-csv-importer/rs-csv-importer.php on line 386
(Note that I haven’t edited rs-csv-importer.php at all.) Is there a different way I should be adding that additional code to make P2P connections work, or an alternate method that works?
Thank you!
https://www.ads-software.com/plugins/really-simple-csv-importer/
]]>Fatal error: Call to a member function connect() on a non-object in ...
Here is the code I am using:
p2p_type( 'dogs_to_cats' )->connect( $form_id, $parent_post_id, array('date' => current_time('mysql')) );
both $form_id
and $parent_post_id
return the proper id respectively. Anyone have a thought on why I would all the sudden get this error? This is where it fires (which has worked fine until recently.
add_filter('frm_after_create_entry', 'create_object_connections', 50, 2);
https://www.ads-software.com/plugins/posts-to-posts/
]]>https://www.ads-software.com/plugins/posts-to-posts/
]]>One of the fields I’m using is for “position,” a drop-down with 'values' => range(1, 100)
. I’d like to get the minimum value of all values connected to a given song – so for the example song linked above, the minimum would be 43.
I know I can use <?php echo p2p_get_meta( get_post()->p2p_id, 'position', true ); ?>
to get all of the connected values, but how can I get only the minimum of those values?
Hopefully someone here can help – thank you if so.
https://www.ads-software.com/plugins/posts-to-posts/
]]>I wish to add some conditional html on an archive page if a ‘product’ post type has a ‘special offer’ post type connected to it. Inside my products archive loop I have this:
<?php if ( p2p_connection_exists( 'offers_to_products', array( 'from' => 'special-offers', 'to' => 'products' ) ) ) {
echo "Fish";
} else {
echo "Fingers";
}?>
But only ever get a negative result. Am I missing something?
https://www.ads-software.com/plugins/posts-to-posts/
]]>When running a query using connected_type, connected_items, connected_direction, etc., is there a way to narrow down the posts that Posts 2 Posts returned to such posts which are tagged with one or more specific terms from a custom taxonomy?
Essentially what I’m looking for is a tax_query
functionality that applies to the connected posts.
Something like the following (see the connected_tax_query
) would be ideal, but I haven’t found a way to achieve this yet:
$posts = get_posts(array(
'post_type' => 'post_type_a',
'connected_type' => 'post_type_b',
'connected_items' => $list_of_narrowed_down_candidates,
'connected_direction' => 'to',
'connected_tax_query => array( etc. ),
'nopaging' => true,
'suppress_filters' => false
));
Is this possible, or what would be the best way to implement this?
https://www.ads-software.com/plugins/posts-to-posts/
]]>I’m using Posts 2 Posts to connect two custom post types, Songs and Charts, to create a ranked chart/list of songs (similar to the Billboard charts). Each time a song appears on a chart, it’s given a “position” between 1 and 100 (‘values’ => range(1, 100)). I successfully used connection metadata to set that up and add a “chart history” section for each song. Now I’d like to determine a few stats for each song:
– its chart peak, aka the lowest number it gets on any chart
– the number of weeks it charted, aka the number of charts on which it appears
– on each chart, its position on the chart before it (so I have “last week”/”this week” figures)
I imagine I could output an array of positions for each song, from which I could pull the minimum and a count, but I’m not familiar enough with PHP to figure it out and the wiki, while helpful elsewhere, doesn’t go into much detail on connection metadata. Any ideas on how to produce those numbers?
If it’s necessary for a better understanding of my question, here’s a link to a test chart on my dev site: https://kurttrowbridge.com/kurtdev/charts/test-chart/
Thank you for any help you can offer!
https://www.ads-software.com/plugins/posts-to-posts/
]]>First of all, awesome plugin! I’ve used it a couple of times for some basic custom-post type connections and it’s worked out great! I’m currently developing an event listings website, and am using two connected post-types: Artists and Events. I currently have a Complete Listings section that’s displaying each artist alphabetically, and the events connected to that artists by event date (the meta value). See: https://puu.sh/bBDrN/9e645a5f0e.png.
My client recently asked if we can organize the Complete Listings, showing artists that have the most recent event dates first but still having their shows grouped together. For example, if you look at the screenshot above, they would like the Hey Rosetta! box to show before the Adam Baldwin box, because they have a show on the 17th, compared to the 27th.
Here’s my current code for the Complete Listings:
<div class="col-md-9">
<h2>Complete Listings</h2>
<?php
$my_query = new WP_Query( array(
'post_type' => 'base_artists',
'order' => 'ASC',
'orderby' => 'name',
'posts_per_page' => -1,
) );
p2p_type( 'events_to_artists' )->each_connected( $my_query, array(), 'events' );
while ( $my_query->have_posts() ) : $my_query->the_post();
$link = get_permalink($post->ID);
$connected = new WP_Query( array(
'connected_type' => 'events_to_artists',
'connected_items' => $post,
'order' => 'ASC',
'orderby' => 'meta_value_num',
'meta_key' => '_base_event_date',
'meta_query' => array(
array(
'key' => '_base_event_date',
'value' => time(),
'type' => 'NUMERIC',
'compare' => '>'
)),
) );
if ($connected->have_posts() ):
?>
<!-- Show Listing -->
<div class="listing col-md-12" id="<?php the_title() ;?>">
<h3><?php the_title(); ?><?php $special_guest = get_post_meta( $post->ID, '_base_special_guest', true ); ?> <?php if(!empty($special_guest)): ?>w/ special guests <?php echo $special_guest ;?><?php endif; ?></h3>
<div class="row">
<div class="band-small col-sm-2">
<div class="img-responsive"><?php the_post_thumbnail('band-small'); ?></div>
</div>
<div class="listing-table col-sm-10">
<table class="table table-striped table-condensed table-hover">
<tbody>
<?php
if ( $connected->have_posts() ) :
while ( $connected->have_posts() ) : $connected->the_post();
?>
<?php
$venue_name = get_post_meta( $post->ID, '_base_event_venue_name', true );
$venue_address = get_post_meta( $post->ID, '_base_event_venue_address', true );
$venue_city = get_post_meta( $post->ID, '_base_event_venue_city', true );
$venue_province = get_post_meta( $post->ID, '_base_event_venue_province', true );
$date = get_post_meta( $post->ID, '_base_event_date', true );
$doors = get_post_meta( $post->ID, '_base_event_time_door', true );
$start = get_post_meta( $post->ID, '_base_event_time_start', true );
$advance_price = get_post_meta( $post->ID, '_base_event_advance_price', true );
$purchase_link = get_post_meta( $post->ID, '_base_event_purchase_link', true );
$door_price = get_post_meta( $post->ID, '_base_event_door_price', true );
$event_type = get_post_meta( $post->ID, '_base_event_type', true );
$maps = get_post_meta( $post->ID, '_base_event_map', true );
?>
<tr>
<td class="market"><?php echo $venue_city ;?>, <?php echo $venue_province ;?></td>
<td class="date"><?php echo date('M. j', $date ) ;?></td>
<td class="venue"><?php echo $venue_name ;?></td>
<td class="more"><a href="<?php echo $link ;?>" class="more">More info...</a></td>
<td class="buy"><a href="<?php echo $purchase_link ;?>" class="btn btn-danger">Buy Tickets</a></td>
</tr>
<?php
endwhile;
wp_reset_postdata();
endif;
?>
</tbody>
</table>
</div>
</div>
</div> <!-- End Show Listing -->
<?php
endif;
endwhile;
?>
</div> <!-- End Complete Listings -->
We are stumped at what the best way to re-write this would be. Any help would be greatly appreciated.
Thanks,
Andy
https://www.ads-software.com/plugins/posts-to-posts/
]]>...,"slug-one;slug-two",...
. It’s a plugin stolen completely from this example by the author of RS CSV Importer, so big hurrah for him.
https://www.ads-software.com/plugins/really-simple-csv-importer/
]]>