This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static function check_conditionals() { | |
$boxed = 'boxed'; | |
$layout = 'normal'; | |
$feature = 'hide'; | |
$f_position = 'above'; | |
$comments = 'hide'; | |
$navigation = 'hide'; | |
$title = 'normal'; | |
$sidebar = 'disable'; | |
$sidebar_id = static::PRIMARY_SIDEBAR_SLUG; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ( ! defined( 'ABSPATH' ) ) { | |
exit; // Exit if accessed directly | |
} | |
global $post; | |
$user = uwp_get_displayed_user(); | |
if ( has_post_thumbnail() ) { | |
$thumb_url = get_the_post_thumbnail_url( get_the_ID(), 'medium' ); | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Disable Bayesian average method to sort by ratings. | |
* | |
* See https://www.google.com/search?q=bayesian+rating+sorting | |
*/ | |
function gd_snippet_200611_disable_use_bayesian( $use_bayesian = true, $table = '' ) { | |
return false; | |
} | |
add_filter( 'geodir_use_bayesian', 'gd_snippet_200611_disable_use_bayesian', 10, 2 ); | |
add_filter( 'gd_use_bayesian', 'gd_snippet_200611_disable_use_bayesian', 10, 2 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Prevent specific users roles to access add listing page. | |
*/ | |
function gd_snippet_200530_prevent_add_listing( $output, $args, $widget_args, $content ) { | |
$role_to_hide = 'subscriber'; // User role prevented to add listing. | |
if ( ( $current_user = wp_get_current_user() ) ) { | |
if ( ! empty( $current_user ) && ! empty( $current_user->roles ) && in_array( $role_to_hide, $current_user->roles ) ) { | |
$output = __( 'You are not allowed to add a listing!', 'geodirectory' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function geodir_shortcode_show_geodir_here_links( $attr, $content = null ) { | |
$term_ids = array( | |
32, | |
33, | |
34, | |
35, | |
36 | |
); | |
ob_start(); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Prevent email & phone in add listing description. | |
*/ | |
function gd_snippet_200525_prevent_email_phone_in_description() { | |
if ( ! geodir_is_page( 'add-listing' ) ) { | |
return; | |
} | |
?> | |
<script type="text/javascript"> | |
jQuery(function($) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* For new listing pull address data from last post created by user. | |
*/ | |
function gd_snippet_200522_data_from_last_post( $html, $field ) { | |
global $wpdb, $post, $gd_post; | |
if ( ! empty( $gd_post ) && empty( $gd_post->street ) && empty( $gd_post->latitude ) && empty( $gd_post->longitude ) && ( $user_id = get_current_user_id() && geodir_is_page( 'add-listing' ) && ! empty( $gd_post->post_status ) && $gd_post->post_status == 'auto-draft' && ! empty( $gd_post->post_type ) && geodir_is_gd_post_type( $gd_post->post_type ) && GeoDir_Post_types::supports( $gd_post->post_type, 'location' ) ) ) { | |
$table = geodir_db_cpt_table( $gd_post->post_type ); | |
$_gd_post = $wpdb->get_row( "SELECT * FROM `{$table}` AS pd INNER JOIN `{$wpdb->posts}` AS p ON p.ID = pd.post_id WHERE ( p.post_status = 'publish' OR p.post_status = 'pending' ) ORDER BY pd.post_id DESC LIMIT 1" ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Delete Unused Image Sizes. | |
* | |
* - Go to yoursite.com/?__check_image_sizes=1 | |
* - Click on DELETE NOW | |
* | |
* NOTE: TAKE BACKUP FIRST | |
*/ | |
function gd_snippet_check_image_sizes() { | |
global $wpdb; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* CSV Export: Fix database error "WordPress database error Column 'post_category' in field list is ambiguous for query". | |
*/ | |
function gd_snippet_20190827_imex_export_posts_query( $query, $post_type ) { | |
$table = geodir_db_cpt_table( $post_type ); | |
$query = str_replace( ",post_category", ",{$table}.post_category", $query ); | |
$query = str_replace( ",`post_category`", ",`{$table}`.`post_category`", $query ); | |
return $query; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function _gd_custom_create_event_from_data() { | |
global $wpdb, $gd_session; | |
$gd_post = array(); | |
$gd_post['post_type'] = 'gd_event'; | |
$gd_post['status'] = 'publish'; | |
$gd_post['title'] = 'Italian Market Festival'; | |
$gd_post['content'] = 'There is so much great eating in and around the Italian Market that you will want to return again and again.'; |
NewerOlder