Skip to content

Instantly share code, notes, and snippets.

View Stiofan's full-sized avatar

Stiofan O'Connor Stiofan

  • AyeCode Ltd
  • Ireland
View GitHub Profile
@Stiofan
Stiofan / gist:f232d7429b14ad0bf883
Created June 17, 2015 18:54
Add stuff after search button
add_action('geodir_after_search_button','my_html_after_search_button',10);
function my_html_after_search_button(){
echo "Hello World";
}
@Stiofan
Stiofan / gist:1f2748d04c4c933c302b
Last active August 29, 2015 14:23
Move Edit Post, Upgrade Listing, Favourite, Business Owner to below the categories, address, phone and website boxes.
/*
* This is a simple example of how to move sidebar elements around, it assumes the array has not already been filtered.
*/
add_filter('geodir_detail_page_sidebar_content','geodir_detail_page_sidebar_content_move',10,1);
function geodir_detail_page_sidebar_content_move($order_arr){
// Set temp values for the sections
$temp_edit_section = $order_arr[3];
$temp_info_section = $order_arr[5];
@Stiofan
Stiofan / gist:2f8e62723a5e9307b88b
Created July 13, 2015 18:11
Remove rating and rating number from listing page
add_filter('geodir_is_reviews_show','my_remove_rating_listing_page',10,2);
function my_remove_rating_listing_page($is_display,$view){
if($view=='listview'){
return false;
}
return $is_display;
}
@Stiofan
Stiofan / gist:58be73460bd1c658317a
Created July 15, 2015 16:53
Allow other HTML tags to be used in other fields
// This example allows iframes on the custom field "video1"
add_filter('geodir_save_post_key',"my_allow_html_tags",10,2);
function my_allow_html_tags($tags, $pkey){
// $pkey is "geodir_" followed by the field HTML variable name, eg: "geodir_video1"
if($pkey=='geodir_video1'){ $tags .= "<iframe>";}
return $tags;
}
@Stiofan
Stiofan / change_map_options.php
Last active May 25, 2019 02:36
GeoDirectory Change Map Options
<?php
/*
Here we can chnage any map options, this example removes the buttns to chnage map view from satalite/road etc.
The filter works per map, you wil need to get the map ID from the source code "geodir_map_options_{$map_canvas_name}"
In the example below my map ID is "geodir_map_v3_home_map_3"
*/
add_filter("geodir_map_options_geodir_map_v3_home_map_3","my_theme_change_map_options",10,1);
function my_theme_change_map_options($options){
$options['mapTypeControl']=false;
@Stiofan
Stiofan / snippet.php
Last active August 27, 2015 16:53
Replace file upload link text
<?php
// Replace 'menu' in "geodir_show_geodir_menu" with the html varibale of your custom field
add_filter("geodir_show_geodir_menu","myTheme_change_menu_title", 10,2);
function myTheme_change_menu_title($html, $variables_array){
if($parts = explode('target="_blank">',$html)){
$html = $parts[0].'target="_blank">Click Here for Our Menu</a></div></div>';
}
return $html;
}
@Stiofan
Stiofan / simple-contact-form.html
Last active August 29, 2015 21:38
Simple contact form
<div id="gd_contact_form">
<form id="form" class="form" accept-charset="UTF-8" enctype="application/x-www-form-urlencoded" method="post">
<div class="content">
<div id="section0">
<input id="name" style="display: none;" type="text" placeholder="Your Name (required)" />
<div class="field"><input id="gd_name" required="" type="text" placeholder="Your Name (required)" /></div>
<div class="field"><input id="gd_email" required="" type="email" placeholder="Your Email (required)" /></div>
<div class="field"><input id="gd_subject" type="text" placeholder="Subject" /></div>
<div class="field"><textarea id="gd_message" placeholder="Your Message" wrap="hard" required></textarea></div>
<input id="gd_send" class="button download-btn" name="Send" type="submit" value="Send" />
@Stiofan
Stiofan / simple-contact-css.css
Created August 29, 2015 18:16
Simple Contact form CSS
/* CONTACT FORM CSS */
.form{
max-width: 100%;
min-width: 25%;
border-width: 2px;
border-color: #CCCCCC;
border-radius: 0px;
color: #222222;
font-size: 14px;
margin: 0px;
@Stiofan
Stiofan / simple-contact-php.php
Created August 29, 2015 18:53
Simple Contact Form PHP
<?php
add_action( 'wp_ajax_gd_contact_form_send', 'gd_contact_form_send' );
add_action( 'wp_ajax_nopriv_gd_contact_form_send', 'gd_contact_form_send' );
function gd_contact_form_send(){
if(isset($_POST['gd_name'])){$gd_name = esc_attr($_POST['gd_name']);}else{die('error');}
if(isset($_POST['gd_email'])){$gd_email = esc_attr($_POST['gd_email']);}else{die('error');}
if(isset($_POST['gd_subject'])){$gd_subject = esc_attr($_POST['gd_subject']);}else{$gd_subject='';}
if(isset($_POST['gd_message'])){$gd_message = esc_attr($_POST['gd_message']);}else{die('error');}
@Stiofan
Stiofan / file.php
Last active September 7, 2015 18:59
Add field to the send enquiry form
<?php // <-- You probably dont need this line if adding to a php file already
add_action('geodir_after_inquiry_form_field', 'add_website_to_contact_form',10,1);
function add_website_to_contact_form($location){
if($location=='inq_phone'){
?>
<div class="row clearfix">
<div class="geodir_popup_heading">
<label><?php _e('Website', 'geodirectory');?> :</label></div>
<div class="geodir_popup_field">