Hi,
I am not sure, but wondering if the recent update affected the snippet I have in functions that places all cpt’s on one “add listing” page. It has been working well for a few years, until I just looked today! I have not added any recent cpt’s. Only change has been the recent GD update(s).
It is suppose to have Events show on it’s own add page (and still does), but events cpt now shows in the array on “add listings” page (radio button options), and one of the cpt’s that was there (health), is no longer.
Here is the snippet:
/** Add Listing w all CPTs minus events */
add_action(‘geodir_before_detail_fields’, ‘geodir_add_listing_before_detail_fields’, 0);
function geodir_add_listing_before_detail_fields(){
global $post;
$current_posttype = geodir_get_current_posttype();
$geodir_allow_posttype = get_option(‘geodir_allow_posttype_frontend’);
$post_types = geodir_get_posttypes(‘object’);
$addlisting_links = ”;
if ($current_posttype!=”gd_events”) {
//test if the key is in the array
// if (in_array(“gd_event”, $geodir_allow_posttype)) {
// echo “trovato evento”;
//
//$filtraevento = array( 1 );
//
//
// }
//remove the position 1 (gd events from the new array)
$filtraevento = array( 6 );
$filtrato = array_diff_key( $geodir_allow_posttype, array_flip( $filtraevento ) );
foreach($post_types as $key => $postobj){
if(is_array($filtrato) && in_array($key, $filtrato) && count($filtrato) > 1){
$name = $postobj->labels->singular_name;
$checked = ”;
if($current_posttype == $key)
$checked = ‘checked=”checked”‘;
$add_link = geodir_get_addlisting_link( $key );
$addlisting_links .= ‘<div style=”display:block;line-height:30px; margin-right:14px; float:left;”>’;
$addlisting_links .= ‘<input type=”radio” ‘.$checked.’ value=”‘.$add_link.'” title=”‘.ucfirst($name).'” name=”geodir_select_add_listing[]” onchange=”javascript:window.location=this.value;” >’.ucfirst($name);
$addlisting_links .= ‘</div>’;
}
}
if($addlisting_links != ”) {
if($current_posttype != “gd_event”) {
?>
<h5><?php _e(‘Select Listing Type’, GEODIRECTORY_TEXTDOMAIN); ?></h5>
<div class=”geodir_form_row clearfix”>
<div id=”geodir_showposttypes” class=”geodir_showposttypes”>
<?php echo $addlisting_links;?>
</div>
</div> <?php
}
}
}
}
First post on subject:
https://wpgeodirectory.com/support/topic/help-with-coding/#post-8566
An issue a few years later (2015, yikes!):
https://wpgeodirectory.com/support/topic/the-add-listing-pageformatting-sidebars-on-add-listing-page/
In the latter it was explained about the cpt array, how do I find what the array/order is?
Thank you, I know this is customization, but it’s a pretty cool one!