Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #843442

    Ray201
    Participant

    wordpress 4.4.2
    x-theme 4.3.4
    x-theme child 1.0.0

    having a problem when including shortcode as part of shortcode output.

    #843444

    Ray201
    Participant
    This reply has been marked as private.
    #843446

    Ray201
    Participant

    The shortcode I am trying to use is for the pop over tooltip info box. You can find this in the direct access portion of the code

    <?php
    
    function nd_beach_access(){
    
    	wp_enqueue_script( 'beach-access-js' );
    	global $wpdb;
    	$display_form  = '<center>';
    	$display_form .= '<div class="baWrapper clearfix">';
    	$display_form .= '<form id="beach-access-form" class="form-inline" action='.admin_url("admin-ajax.php").' name="search_beach" method="POST" style=" margin-bottom: 25px;">';
    	$display_form .= '<div class="col-md-3 col-xs-12 form-group">';
    	$display_form .= '<label class="sr-only" for="search_address"></label>';
    	$display_form .= '<input type="text" class="form-control" placeholder="Enter address number" id="search_address" name="search_address">';
    	$display_form .= '</div>';
    	$display_form .= '<div class="col-md-3 col-xs-12 form-group">';
    	$display_form .= '<label class="sr-only" for="search_direction"></label>';
    	$display_form .= '<select class="form-control"  id="search_direction" name="search_direction"><option value="">None</option><option value="n">N</option><option value="s">S</option><option value="w">W</option><option value="e">E</option></select>';
    	$display_form .= '</div>';
    	$display_form .= '<div class="col-md-3 col-xs-12 form-group">';
    	$display_form .= '<label class="sr-only" for="search_street"></label>';
    	$display_form .= '<input type="text" class="form-control" placeholder="Enter street name" id="search_street" name="search_street">';
    	$display_form .= '</div>';
    	$display_form .= '<div class="col-md-3 col-xs-12 form-group">';
    	$display_form .= '<label class="sr-only" for="search_road"></label>';
    	$display_form .= '<select name="search_road" class="form-control">';
    	$display_form .= '<option value="" selected>Road,Blvd.,Way,Etc..</option>';
    	$res = $wpdb->get_results("select distinct road from beach_data where road != ''");
    	foreach($res as $road) {
    		$display_form .= '<option value='.$road->road.'>';
    		$display_form .= $road->road;
    		$display_form .= '</option>';
    	}
    	$display_form .= '</select>';
    	$display_form .= '<input type="hidden" name="action" value="beach_access_ajax_filter">';
    	$display_form .= '</div>';
    	$display_form .= '<div class="col-md-4 col-md-offset-4 col-xs-5">';
    	$display_form .= '<button type="submit" class="x-btn x-btn-square text-center btn-space btn-block x-btn-regular" value="search" name="search">SEARCH <i class="x-icon-search" data-x-icon=""></i></button>';
    	$display_form .= '</div>';
    	$display_form .= '</form>';
    	$display_form .= '</div>';
    	$display_form .= '</center>';
    	$display_form .= '<p style="float:left;margin-bottom:25px;">*Information deemed reliable but not guaranteed.</p>';
    	$display_form .= ' <div id="beach-access-results" class="col-xs-12" style="margin-bottom:42px;""></div>';
    	$display_form .= '<div><a id="more-beach-results-button" class="x-btn x-btn-square x-btn-regular" style="display:none" href="javascript:void(0);"></a></div>';
    	
    
    	return $display_form;
    
    }
    add_shortcode( 'beach-access', 'nd_beach_access' );
    
    add_action( 'wp_ajax_beach_access_ajax_filter', 'beach_access_ajax_filter_handler' );
    add_action( 'wp_ajax_nopriv_beach_access_ajax_filter', 'beach_access_ajax_filter_handler' );
    
    function beach_access_ajax_filter_handler() {
    	if (isset($_POST['page'])) {
    		global $wpdb;
    		$search_address   = $_POST['search_address'];
    		$search_direction = $_POST['search_direction'];
    		$search_street    = $_POST['search_street'];
    		$search_road      = $_POST['search_road'];
    		$page             = $_POST['page'] - 1;
    		$where            = '1=1 ';
    		$address          = '';
    
    		if ($search_address != '') {
    			$address .= "$search_address ";
    			$where .= "and address_number ='" . $search_address . "'";
    		}
    		
    		if ($search_direction != '') {
    			if (strtoupper($search_direction) == 'NORTH') {
    				$direction = 'n';
    			} else if (strtoupper($search_direction) == 'EAST') {
    				$direction = 'e';
    			} else if (strtoupper($search_direction) == 'WEST') {
    				$direction = 'w';
    			} else if (strtoupper($search_direction) == 'SOUTH') {
    				$direction = 's';
    			} else {
    				$direction = $search_direction;
    			}
    			
    			$address .= "$search_direction ";
    			$where .= "and direction like '" . $direction . "'";
    		}
    		
    		if ($search_street != '') {
    			$address .= "$search_street ";
    			$where .= "and street_name like '" . $search_street . "'";
    		}
    		
    		if ($search_road != '') {
    			$address .= "$search_road ";
    			$where .= "and road like '" . $search_road . "'";
    		}
    
    		$offset = $page * 20;
    		
    		$results = $wpdb->get_results("select * from beach_data where $where LIMIT $offset, 20");
    		if ($results) {
    			
    			// echo "<h2>Search Results for '".$address."'</h2>";
    			
    			foreach ($results as $result) {
    				if ($result) {
    					echo "<h3 class='address_title text-left' style='font-weight:bold;margin-top:25px'>" . $result->address_number . " " . $result->direction . " " . $result->street_name . " " . $result->road . "</h3>"; ?>
    					<table width="90%">
    						<tr>
    							<td width="40%"><b>Nearest Public Access : </b></td>
    							<td><?php
    							echo $result->nearest_public_access; ?></td>
    						</tr>
    						<tr>
    							<td><b><?php echo do_shortcode( '[extra href="#example" title="Direct Access" info="popover" info_place="top" info_trigger="hover" info_content=The property owner owns land directly on the beach." ]'	. "Direct Access" . "[/extra]" ) ?> : </b></td>
    							<td><?php
    							if ((trim($result->direct_access) != 'No')) echo "Yes - " . $result->direct_access;
    							else echo $result->direct_access;
    							?></td>
    						</tr>
    						<tr>
    							<td><b>Deeded Access? : </b></td>
    							<td><?php
    								if (trim($result->deeded_access) != 'No') echo "Yes - " . $result->deeded_access;
    								else echo $result->deeded_access;
    							?></td>
    						</tr>
    						<tr>
    							<td><b>Easement Access? : </b></td>
    							<td><?php
    								if (trim($result->easement_access) != 'No') echo "Yes - " . $result->easement_access;
    								else echo $result->easement_access;
    							?></td>
    						</tr>
    						<tr>
    							<td><b>Platted Access? : </b></td>
    							<td><?php
    							if (trim($result->plated_access) != 'No') echo "Yes - " . $result->plated_access;
    							else echo $result->plated_access;
    							?></td>
    						</tr>
    						<tr>
    							<td><b>Association Access? : </b></td>
    							<td><?php
    							if (trim($result->association_access) != 'No') echo "Yes - " . $result->association_access;
    							else echo $result->association_access;
    							?></td>
    						</tr> 
    						<tr>
    							<td colspan="2"><b>Notes : </b><?php
    							echo $result->public_notes;
    							?></td>
    							</tr>
    					</table>        
    	 <?php
    				}
    			}
    		}
    		else {
    			echo "<br><h3 style='margin-top:21px;'>No More Results Found</h3>";
    		}
    
    		die();
    	}
    }
    ?>
    #843844

    Friech
    Moderator

    Hi There,

    Thanks for writing in! The do_shortcode line of your code works fine on my end. It seems like you might be having an issue with your customization. Regretfully, this particular customization request is outside the scope of our support as this is not related to an issue with the theme and instead has to do with your customization of it. As such, you will need to investigate this particular issue on your own or seek help from a developer should you not feel comfortable making these changes yourself. If you have any further questions about the theme, we are more than happy to provide you with assistance on these inquiries.

    https://vid.me/e/O6cs

    Thank you for your understanding.

    #846440

    Ray201
    Participant

    It is working for me as well on other pages however not on this one, where it is being included in shortcode. X Theme shortcode should be able to be included in other shortcode seamlessly.

    #846546

    Rupok
    Member

    Hi there,

    Thanks for updating. I don’t think there is any issue with do_shortcode function and there is simply no way to prevent this function by a theme. So the issue is related with your code and regretfully we can’t assist on any custom development.

    Hope this makes sense.

    Cheers!