1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
function get_epl_image_sizes() {
return apply_filters(
'epl_image_sizes',
array(
array(
'id' => 'admin-list-thumb',
'height' => 100,
'width' => 100,
'crop' => true,
),
array(
'id' => 'epl-image-medium-crop',
'height' => 200,
'width' => 300,
'crop' => true,
),
)
);
}
function epl_image_sizes() {
$epl_sizes = get_epl_image_sizes();
foreach ( $epl_sizes as $epl_size ) {
add_image_size( $epl_size['id'], $epl_size['width'], $epl_size['height'], $epl_size['crop'] );
}
}
add_action( 'after_setup_theme', 'epl_image_sizes' );
function epl_image_size_names_choose( $epl_sizes ) {
return array_merge(
$epl_sizes,
array(
'epl-image-medium-crop' => __( 'Medium 300x200 hard Crop', 'easy-property-listings' ),
)
);
}
add_filter( 'image_size_names_choose', 'epl_image_size_names_choose' );
function epl_property_author_archives( $query ) {
if ( $query->is_author ) {
$query->set( 'post_type', array( 'directory', 'rental', 'testimonial', 'property', 'post' ) );
}
remove_action( 'pre_get_posts', 'epl_property_author_archives' );
}
add_action( 'pre_get_posts', 'epl_property_author_archives' );
function epl_custom_post_author_archive( $query ) {
if ( $query->is_author ) {
$query->set( 'post_type', array( 'property', 'rental', 'testimonial', 'post', 'commercial', 'land' ) );
}
remove_action( 'pre_get_posts', 'epl_custom_post_author_archive' );
}
add_action( 'pre_get_posts', 'epl_custom_post_author_archive' );
function epl_populate_post_author_email( $value ) {
if ( is_author() ) {
$author = get_queried_object();
if ( $author instanceof WP_User ) {
return $author->user_email;
}
}
global $post;
if ( $post instanceof WP_Post ) {
$author_email = get_the_author_meta( 'user_email', $post->post_author );
if ( ! empty( $author_email ) ) {
return $author_email;
}
}
return '';
}
add_filter( 'gform_field_value_author_email', 'epl_populate_post_author_email' );