GeoDirectory Support Forums Forums GeoDirectory Jobs tweaking of existing snippet – help needed

Viewing 1 post (of 1 total)
  • Author
  • #404641

    m forbes
    Full Member
    Post count: 324

    Hi, I am using this snippet to keep several cpt’s on one page for the Add Listing page, and a separate Add Events page:

    /** 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( 7 );
    			$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> <?php

    I have added a new cpt, Announcements, that I would like to show on the Add Event page. As of now, it is showing on the Add Listing page. Anyone interested in tweaking it?

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

  • How to add a new support ticket

    To open a new support ticket, first select the relevant forum and then click the "New Post" button. Example: You need support for the core plugin? Click on GeoDirectory Core Plugin support and click on the "New Post Button".
  • Support Policy

    Please read the support policy before starting to use the forum.
  • Featured ThirdPartyAddOn

  • Feature Requests

    Is there a theme for which you'd like to see a compatibility package or a new feature that you think would be of great benefit for the GeoDirectory community?

    Submit a feature request : here

    Each month you get 5 votes to distribute. You can choose to use all your votes for one idea you really like, or spread them across between several ideas :)

    We will do our best to create whatever you suggest if it becomes popular, we however reserve the right to reject ideas that we believe could not be realized without revolutionizing the plugin.

  • Are you a developer?

    Make Money with GD Jobs

    Check out the GeoDirectory Jobs Forum, there may be a new client waiting for your services. Only Premium members can access the GD Jobs forum.

    Or selling GD Themes and Addons

    Did you know that you can easily build GeoDirectory Addons and Themes and that there is a rapidly growing market for it? Submit your Add-ons and Themes here
  • Looking for a GD developer?

    We do not provide customization services, but feel free to check out the GeoDirectory Jobs Forum, there may be already a freelance GD expert ready to start working with you. Only Premium members can access the GD Jobs forum. GeoDirectory doesn't endorse any of the developers present in our forums. However we can guarantee that they are all Premium Members just like you. Please ask for references before hiring anyone and use common sense. We don't take responsability for poor quality jobs and/or missed deadlines